我已经创建了React-Native网站的“文档”部分所示的“ AwesomeProject” react-native入门应用程序。
我让它同时在 Xcode模拟器和 Android Studio模拟器中运行。
当我在WebStorm中打开项目以开始编辑 JS 代码时,系统提示我错误:
ESLint: Error: ESLint configuration in .eslintrc.js » @react-native-community/eslint-config is invalid:
.eslintrc.js :
module.exports = {
root: true,
extends: '@react-native-community',
};
错误详细信息:
Error: ESLint configuration in .eslintrc.js » @react-native-community/eslint-config is invalid:
- Property "overrides" is the wrong type (expected array but got '{"files":["*/__tests__/*/*.js","* */*.spec.js","*/*.test.js"],"env":{"jest":true,"jest/globals":true}}').
Referenced from: /Users/admin/AwesomeProject/.eslintrc.js
Error: ESLint configuration in .eslintrc.js » @react-native-community/eslint-config is invalid:
- Property "overrides" is the wrong type (expected array but got '{"files":["*/__tests__/*/*.js","*/*.spec.js","*/*.test.js"],"env":{"jest":true,"jest/globals":true}}').
Referenced from: /Users/admin/AwesomeProject/.eslintrc.js
at validateConfigSchema (/Users/admin/AwesomeProject/node_modules/eslint/lib/shared/config-validator.js:286:15)
at ConfigArrayFactory._normalizeConfigData (/Users/admin/AwesomeProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:469:9)
at ConfigArrayFactory._loadConfigData (/Users/admin/AwesomeProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:414:21)
at ConfigArrayFactory._loadExtendedShareableConfig (/Users/admin/AwesomeProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:716:21)
at ConfigArrayFactory._loadExtends (/Users/admin/AwesomeProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:615:25)
at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/admin/AwesomeProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:546:25)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (/Users/admin/AwesomeProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:491:20)
at _normalizeObjectConfigData.next (<anonymous>)
at createConfigArray (/Users/admin/AwesomeProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:307:25)
Process finished with exit code -1
我希望ESLinting至少在语法和常规代码错误陷阱方面起作用,所以我不想只是尝试将其全部关闭。希望可以快速轻松地解决此问题,以便我可以继续将WebStorm用于本机项目。
提前感谢您对此社区可以提供的帮助。
利兰
答案 0 :(得分:0)
不是WebStorm问题。在终端中运行npm lint
或eslint .
时,您将面临相同的错误。
请参阅https://github.com/facebook/create-react-app/issues/7218以获得解释。
我建议将问题报告给https://github.com/facebook/react-native/issues,以便他们修复@react-native-community/eslint-config
以便与ESLint 6一起使用。*