Getting warning in 'eslint-plugin-react-settings' while running eslint
Asked Answered
L

3

13

Getting the:

warning: React version specified in eslint-plugin-react-settings must be a valid semver version, or "detect"; got “latest”' while running eslint.

What is the reason behind this and how to resolve it?

Screenshot of the issue

Lint answered 11/3, 2022 at 9:34 Comment(1)
perhaps, fix your eslint-plugin-react-settings so it doesn't say latestErivan
F
20

There will be an Object defined in your .eslintrc file as settings. And this error is saying that the version of react defined in it is not the version installed in your machine. Please replace settings object with following code so that es lint can detect it automatically on runtime.

"settings": {
    "react": {
      "version": "detect"
    }
  }
Fennec answered 11/3, 2022 at 9:39 Comment(0)
D
6

Just add the code in the .eslintrc file (js,json) as this eslint will automatically detect the react version 👍

"plugins": [
...
],
"settings": {
  "react": {
    "version": "detect"
  }
},
"rules": {
...
}
Dillingham answered 31/8, 2022 at 15:37 Comment(0)
S
2

adding this in my .eslintrc file fixed the problem.

"settings": {
    "react": {
      "version": "detect"
    }
  }
Schroeder answered 31/5, 2022 at 10:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.