Warning: React version not specified in 'eslint-plugin-react settings' while running eslint on top of React 18.2.0
Warning: React version not specified in 'eslint-plugin-react settings' while running eslint on top of React 18.2.0

Matthew C.
—The Problem
When using the eslint-plugin-react ESLint plugin, which adds React-specific linting rules to ESLint, you may encounter the following warning:
Warning: React version not specified in eslint-plugin-react settings.
The Solution
This warning occurs if you haven’t added the React version to your eslint-plugin-react configuration settings. When the React version hasn’t been specified in your eslint-plugin-react settings, eslint-plugin-react defaults to using the latest React version for linting, which may lead to incorrect ESLint warnings or errors if you aren’t using the latest React version.
Specify which React version you’re using in your eslint-plugin-react configuration settings. If you’re using the new ESLint configuration system, modify your eslint.config.js, eslint.config.mjs, or eslint.config.cjs ESLint configuration file to include the React version:
export default [ { settings: { react: { version: "detect", // ... }, }, // ... plugins: ["react"], // ... }, ];
When you specify “detect” as the React version, eslint-plugin-react automatically uses the React version of your project. You can also set a React version number, such as 16.0, if you want to override the detected value.
The new configuration system was added in ESLint version 8.21.0. This new system doesn’t use the legacy .eslintrc config file name and instead uses eslint.config.js as the new default config file name. From ESLint version 9 onwards, only the new system is supported.
If you’re using an older ESLint version, update your .eslintrc file to include the React version:
{ "settings": { "react": { "version": "detect" // ... }, // ... "plugins": [ "react" ] // ... } }
The React default version is configurable from eslint-plugin-react version 7.35.0.
Note
The React version not specified in eslint-plugin-react settings. warning was added to eslint-plugin-react version 7.12.0 in response to this GitHub issue: React 16 lifecycle errors appearing in a React 15 project.
- Sentry BlogGuide to Error & Exception Handling in React (opens in a new tab)
- Sentry BlogHow to identify fetch waterfalls in React (opens in a new tab)
- Syntax.fmReact Server Components (opens in a new tab)
- Sentry BlogSentry can’t fix React hydration errors, but it can really help you debug them (opens in a new tab)
- Syntax.fmWhy the jQuery Creator Uses React and Typescript (opens in a new tab)
- Syntax.fmListen to the Syntax Podcast (opens in a new tab)
- Sentry BlogReact Native Debugging and Error Tracking During App Development (opens in a new tab)
- Syntax.fmDiscussion on building native iOS and Android apps with React Native (opens in a new tab)
- SentryReact Error & Performance Monitoring (opens in a new tab)
- Sentry BlogFixing memoization-breaking re-renders in React (opens in a new tab)
- SentryReact Debug Hub (opens in a new tab)
- Listen to the Syntax Podcast (opens in a new tab)
![Syntax.fm logo]()
Tasty treats for web developers brought to you by Sentry. Get tips and tricks from Wes Bos and Scott Tolinski.
SEE EPISODES
Considered “not bad” by 4 million developers and more than 150,000 organizations worldwide, Sentry provides code-level observability to many of the world’s best-known companies like Disney, Peloton, Cloudflare, Eventbrite, Slack, Supercell, and Rockstar Games. Each month we process billions of exceptions from the most popular products on the internet.
