Installation Steps
- Install ESLint and React plugin:
npm install --save-dev eslint eslint-plugin-react eslint-plugin-react-hooks
Configuration Steps
- Create
.eslintrc.jsor.eslintrc.jsonfile in project root:- Location:
.eslintrc.jsor.eslintrc.json(root directory)
{ "extends": ["eslint:recommended", "plugin:react/recommended"], "parserOptions": { "ecmaVersion": 2022, "sourceType": "module", "ecmaFeatures": { "jsx": true } }, "rules": { "react/react-in-jsx-scope": "off" } } - Location:
- Add to
package.jsonscripts section:- Location:
package.json(scripts section)
"scripts": { "lint": "eslint .", "lint:fix": "eslint . --fix" } - Location:
- Verify configuration is committed to version control
- Check:
.eslintrc.jsor.eslintrc.jsonshould be in repository
- Check: