June 2025
Intermediate to advanced
837 pages
24h 50m
English
Prettier follows a similar approach to the --fix option of ESLint. This tool is a code formatter. The job of Prettier is to format the source code according to the rules of your style guide. Often, Prettier is used as a save or commit hook, ensuring that only correctly formatted code enters the repository.
Prettier can be installed from the command line with npm via the npm install prettier command. Once the installation is complete, you can directly use the tool.
You can run Prettier using the npx prettier [options] [filenames] command. Using the source code shown in Listing 22.5, you can have most problems fixed automatically. The command from Listing 22.7 ensures that the lines are ...
Read now
Unlock full access