You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
eslint-plugin-prettier — this plugin allows you to format code using Prettier when you run --fix
eslint-config-prettier — This library solves the conflicts between eslint and prettier. It turns off conflicting rules. ESLint’s rules, not Prettier’s. Obviously.
eslint
eslint
is the core JavaScript linter.eslint-loader
tells webpack that you want to use eslint in our buildbabel-loader
transpiles our code with webpackbabel-eslint
provides linting for valid ES6 codeeslint-plugin-react
extends ESLint rules to cover Reactadd the following rules in your
.eslintrc
file, or you can make your own rulesprettier
prettier
— the core prettier library. Duh.eslint-plugin-prettier
— this plugin allows you to format code using Prettier when you run --fixeslint-config-prettier
— This library solves the conflicts between eslint and prettier. It turns off conflicting rules. ESLint’s rules, not Prettier’s. Obviously.vscode settings
.vscode/settings.json
after the above setting, you vscode should be able to lint and fix your code automatically
git hook
Add the following code into
package.json
file, it’ll fix the error automaticallynow try a commit, what a beautiful result
references
Add ESLint & Prettier to VS Code for a Create React App - YouTube
Linting React Using ESLint with Create React App ← Alligator.io
React Code Style with ESLint + Babel + Webpack - RWieruch
ESLint + Prettier For a Consistent React Codebase – GO-JEK Product + Tech
The text was updated successfully, but these errors were encountered: