Warning: React version not specified in 'eslint-plugin-react settings' while running eslint on top of React 18.2.0
Matthew C.
—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.
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.
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.
Tasty treats for web developers brought to you by Sentry. Get tips and tricks from Wes Bos and Scott Tolinski.
SEE EPISODESConsidered “not bad” by 4 million developers and more than 100,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.
Here’s a quick look at how Sentry handles your personal information (PII).
×We collect PII about people browsing our website, users of the Sentry service, prospective customers, and people who otherwise interact with us.
What if my PII is included in data sent to Sentry by a Sentry customer (e.g., someone using Sentry to monitor their app)? In this case you have to contact the Sentry customer (e.g., the maker of the app). We do not control the data that is sent to us through the Sentry service for the purposes of application monitoring.
Am I included?We may disclose your PII to the following type of recipients:
You may have the following rights related to your PII:
If you have any questions or concerns about your privacy at Sentry, please email us at compliance@sentry.io.
If you are a California resident, see our Supplemental notice.