Warning: React version not specified in 'eslint-plugin-react settings' while running eslint on top of React 18.2.0
Full error message
Issue
Git bash shows Warning: React version not specified in eslint-plugin-react settings. See https://github.com/jsx-eslint/eslint-plugin-react#configuration . while running eslint.
How to produce
create-react-app my-app
cd app
npm install eslint --save-dev
npx eslint --init
npx eslint .
package.json
{
...
"dependencies": {
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
...
"devDependencies": {
"eslint": "^8.18.0",
"eslint-plugin-react": "^7.30.1"
}
}
I tried to find solutions but failed.
I kindly ask for your help.Solutionsource: stackoverflow \u2197
Add this to your config in ESLint Config File, i.e. .eslintrc or eslint.config.js { "settings": { "react": { "version": "detect" } } } See the config here: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/README.md#configuration Docs https://eslint.org/docs/ https://eslint.org/docs/latest/use/configure/migration-guide https://eslint.org/docs/latest/use/configure/configuration-files
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/c7ea7ba99df4437fad38c86c4f7e73f2aba5eb59815b557a540b627b194bfc83hash \u00b7 c7ea7ba99df4437fad38c86c4f7e73f2aba5eb59815b557a540b627b194bfc83