A eslint plugin for react project.
You just need to install eslint-plugin-react-project
.
npm install eslint-plugin-react-project --save-dev
Add .eslintrc.json
configuration file to the project root directory:
-
if you use React and JavaScript:
{ "extends": [ "plugin:react-project/base" ], "plugins": [ "react-project" ] }
-
if you use React and TypeScript:
{ "extends": [ "plugin:react-project/typescript" ], "plugins": [ "react-project" ] }
1、Install VS Code ESLint extension.
2、Add .vscode/settings.json
file to the project root directory:
{
"javascript.format.enable": false,
"typescript.format.enable": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
},
"editor.formatOnSave": true,
"eslint.format.enable": true,
"eslint.alwaysShowStatus": true,
"eslint.validate": [
"javascript",
"typescript",
"javascriptreact",
"typescriptreact"
],
"prettier.enable": false
}
3、Reload your VS Code window.