eslint-plugin-react-app
raw JSON → 6.2.2 verified Sat Apr 25 auth: no javascript
ESLint configuration and rules bundle based on Create React App's eslint-config-react-app. Version 6.2.2 wraps eslint-config-react-app 5.2.1 and includes plugins for import, flowtype, JSX-a11y, React, React Hooks, and TypeScript. Designed as a single-dependency drop-in for CRA-style linting without manually installing each sub-plugin. Works in React Native. Requires ESLint 6.x peer dependency. Release cadence is sporadic, tied to upstream CRA config updates.
Common errors
error Error: Failed to load plugin 'react-app' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-react-app' ↓
cause Plugin package not installed or not in node_modules.
fix
Run
npm install --save-dev eslint-plugin-react-app and ensure it's in package.json. error Error: Definition for rule 'react/react-in-jsx-scope' was not found ↓
cause Rule name without 'react-app/' prefix.
fix
Use 'react-app/react/react-in-jsx-scope' instead.
error ESLint couldn't find the plugin "eslint-plugin-import". ↓
cause The plugin only includes eslint-config-react-app but not its sub-plugins as direct deps? Actually they are bundled. This error appears if eslint cache is stale or install corrupted.
fix
Delete node_modules and package-lock.json, then reinstall.
error TypeError: Cannot read property 'some' of undefined (eslint-plugin-import) ↓
cause Incompatible ESLint version (e.g., ESLint 7).
fix
Downgrade ESLint to 6.x:
npm install --save-dev eslint@6. Warnings
gotcha All rules from sub-plugins must be prefixed with 'react-app/' to avoid 'Definition for rule not found' errors. ↓
fix Prefix any rule from eslint-plugin-import, eslint-plugin-react, etc. with 'react-app/', e.g., 'react-app/react/jsx-uses-react'.
breaking Version 6.0.0 updated eslint-config-react-app to 5.0.0, which may include breaking rule changes (e.g., new TypeScript rules). ↓
fix Review changelog of eslint-config-react-app for rule changes; adjust your overrides.
deprecated This plugin is not maintained by the CRA team; it may lag behind upstream eslint-config-react-app updates. ↓
fix Consider using @rushstack/eslint-config or direct eslint-config-react-app with all peer deps for official support.
gotcha Requires ESLint 6.x; incompatible with ESLint 7+. ↓
fix Stay on ESLint 6.x or use later version of eslint-plugin-react-app if available (currently none). Check peerDependencies.
Install
npm install eslint-plugin-react-app yarn add eslint-plugin-react-app pnpm add eslint-plugin-react-app Imports
- plugin:react-app/recommended wrong
extends: ['eslint:recommended', 'plugin:react-app/recommended'] (double extends, but not wrong per se; common mistake is omitting 'plugin:' prefix)correctextends: ['plugin:react-app/recommended'] in .eslintrc - react-app/react/react-in-jsx-scope wrong
'react/react-in-jsx-scope': ['warn'] (missing 'react-app/' prefix) leads to 'Definition for rule 'react/react-in-jsx-scope' was not found'correct'react-app/react/react-in-jsx-scope': ['warn'] in rules - react-app wrong
extends: 'react-app' (missing array brackets - ESLint accepts string, but common mistake is using wrong key 'plugins' instead of 'extends')correctextends: ['react-app'] (also works without 'plugin:' prefix for the base config)
Quickstart
// Install
npm install --save-dev eslint eslint-plugin-react-app@6.2.2
// .eslintrc.json
{
"extends": ["plugin:react-app/recommended"],
"rules": {
"react-app/react/react-in-jsx-scope": ["warn"]
}
}
// Then lint:
npx eslint src/