Prettier
Use Prettier to make your code uniform and maintain code style integrity.
Refer to official documentation for detailed usage. →
caution
All required configurations will be handled automatically by CLI as long as you choose plugins during the project creation phase.
package.json
{ "scripts": { "prettier": "prettier '**/*.{js,jsx,ts,tsx}'" }, "dependencies": { "prettier": "^2.2.1" }}
Prettier uses cosmiconfig
for configuration file support.
This means you can configure Prettier in the ways specified in the original document.
.prettierrc
{ "semi": true, "trailingComma": "all", "singleQuote": false, "printWidth": 80, "tabWidth": 4}
To exclude files from formatting, create a .prettierignore
file in the root of your project.
.prettierignore
node_modules__generated__
#
Adding Prettier to your project later- npm
- yarn
npm i -D prettier
yarn add -D prettier