[英]Warning: React version not specified in 'eslint-plugin-react settings' while running eslint on top of React 18.2.0
Git bash shows Warning: React version not specified in eslint-plugin-react settings. See https://github.com/jsx-eslint/eslint-plugin-react#configuration .
Git bash 显示
Warning: React version not specified in eslint-plugin-react settings. See https://github.com/jsx-eslint/eslint-plugin-react#configuration .
Warning: React version not specified in eslint-plugin-react settings. See https://github.com/jsx-eslint/eslint-plugin-react#configuration .
while running eslint.在运行 eslint 时。
create-react-app my-app
cd app
npm install eslint --save-dev
npx eslint --init
npx eslint .
{
...
"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.
我恳请您的帮助。
Add this to your config:将此添加到您的配置中:
{
"settings": {
"react": {
"version": "detect"
}
}
}
See the config here: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/README.md#configuration在此处查看配置: https ://github.com/jsx-eslint/eslint-plugin-react/blob/master/README.md#configuration
The problem is in the eslint-plugin-react
v.7.30.1.问题出在
eslint-plugin-react
v.7.30.1 中。 Downgrade it to v.7.30.0 and it will work将其降级到 v.7.30.0 即可使用
"eslint-plugin-react": "^7.30.0"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.