问题
Git bash在运行eslint时显示Warning: React version not specified in eslint-plugin-react settings. See https://github.com/jsx-eslint/eslint-plugin-react#configuration .
。
如何生产
create-react-app my-app
cd app
npm install eslint --save-dev
npx eslint --init
npx eslint .
软件包. 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"
}
}
我试图找到解决办法,但失败了。我恳请你的帮助。
3条答案
按热度按时间yx2lnoni1#
将此添加到您的配置中:
请在此处查看配置:https://github.com/jsx-eslint/eslint-plugin-react/blob/master/README.md#configuration
xxhby3vn2#
在您的
folder root
编辑.eslintrc.js
文件,并把"version": "detect"
.喜欢bakd9h0s3#
问题出在
eslint-plugin-react
v.7.30.1中,请将其降级到v.7.30.0,它将正常工作