0.0.24 • Published 6 years ago
eslint-config-prettier-react v0.0.24
Forked from wesbos
Local / Per Project Install
- Run below code
npx install-peerdeps --dev eslint-config-prettier-reactYou can see in your package.json there are now a big list of devDependencies.
Create a
.eslintrcfile in the root of your project's directory (it should live where package.json does). Your.eslintrcfile should look like this:
{
"extends": [
"prettier-react"
]
}⚠️⚠️⚠️ Delete
eslintConfigin the package.json
Tip: You can alternatively put this object in your package.json under the property "eslintConfig":. This makes one less file in your project.
- You can add two scripts to your package.json to lint and/or fix:
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},Global Install
- First install everything needed:
npx install-peerdeps --global eslint-config-prettier-react- Then you need to make a global
.eslintrcfile:
ESLint will look for one in your home directory
~/.eslintrcfor macC:\Users\username\.eslintrcfor windows
In your .eslintrc file, it should look like this:
{
"extends": [
"prettier-react"
]
}- To use from the CLI, you can now run
eslint .or configure your editor as we show next.
With VS Code
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": false
},
"[javascriptreact]": {
"editor.formatOnSave": false
},
"eslint.autoFixOnSave": true,
"prettier.disableLanguages": ["javascript", "javascriptreact"],With Create React App
- You gotta eject first
npm run ejectoryarn eject - run
npx install-peerdeps --dev eslint-config-prettier-react - Crack open your
package.jsonand replace"extends": "react-app"with"extends": "prettier-react"