Eslint:React version not specified in eslint-plugin-react settings

在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 错误

你可能感兴趣的:(ESLint)