Step 29: Prettier

Prettier is a code formatter. In the terminal, run the following command to install it.

yarn add --dev prettier

Create a config file, .prettierrc, to let editors and other tools know you are using Prettier with the following content:

{
  "endOfLine": "auto"
}

Add the following command to the end of the scripts section in package.json:

"prettier": "prettier --write \"src/**/*.{jsx,js}\" --config \".prettierrc\""

Don't forget to add , to the end of the command for preview!

Run prettier by executing the following command:

yarn prettier