React version not specified in eslint-plugin-react settings
执行npm start
启动项目时在 Terminal 有警告信息,如下:
Warning: React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration .
未在 eslint-plugin-react 设置中,指定 React 版本号。
解决方法:
在 Github 中有提问,并且已经解决,链接如下:
https://github.com/yannickcr/eslint-plugin-react/issues/2157
在eslintrc.js
或者.eslintrc
文件中添加配置项:
"settings": {
"react": {
"version": "detect"
}
}
配置参数detect
意思是自动检测。
至此,问题解决,重新启动项目不再警告。
另外,在警告信息里,给出的链接页面中,也有相应注明:
"settings": {
"react": {
"createClass": "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
"pragma": "React", // Pragma to use, default to "React"
"version": "detect", // React version. "detect" automatically picks the version you have installed.
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
// default to latest and warns if missing
// It will default to "detect" in the future
"flowVersion": "0.53" // Flow version
},
(完)