在react項目中,配置了eslint,但在 npm start
時,給了這樣的提示:React version not specified in eslint-plugin-react settings
解決方案:
// 在 .eslintrc.js 中需要指定react版本號:
"settings": {
"react": {
/**
* "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
*/
"version": "999.999.999" // It will default to "detect" in the future
// "version": "detect"
// "version": "16.12.0"
}
}
Git Issues查看:eslint-plugin-react 錯誤