Created
October 31, 2021 18:05
-
-
Save hdsenevi/2ad654e434fdac46119dffdf096dec0c to your computer and use it in GitHub Desktop.
Setup prettier for new create react app project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. npx create-react-app <project-name> | |
2. npm i --save-dev prettier | |
3. npm i --save-dev eslint-config-prettier eslint-plugin-prettier | |
4. Edit the "eslintConfig" section in package.json or create a .eslintrc file at the project root to hold our ESLint configuration. | |
``` | |
{ | |
"extends": ["react-app"], | |
"rules": {} | |
} | |
``` | |
5. Add a .prettierrc file at the project root to hold our Prettier configuration. I like all the default Prettier provides except trailing commas which I configure. | |
``` | |
{ | |
"trailingComma": "all" | |
} | |
``` | |
6. Add a .prettierignore | |
``` | |
# Ignore artifacts: | |
build | |
coverage | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment