[英]Eslint rises unexpected "EnumInvalidMemberName" error
I'm triyng to config eslint for gatsby app with TS and during the integration faced linter issue Parsing error: Enum member names cannot start with lowercase 'a' through 'z'.
我正在尝试使用 TS 为 gatsby 应用程序配置 eslint,并且在集成期间面临 linter 问题
Parsing error: Enum member names cannot start with lowercase 'a' through 'z'.
It comes during linter run, but I didn't see any rules how to disable it since I'm not going to follow that rule (legacy copde base)它是在 linter 运行期间出现的,但我没有看到任何如何禁用它的规则,因为我不会遵循该规则(遗留 copde 基础)
Does anybody know how to disable/override this rule?有人知道如何禁用/覆盖此规则吗?
"dependencies": {
"gatsby": "^4.11.2",
"react": "^17.0.2",
},
"devDependencies": {
"@babel/preset-env": "^7.18.2",
"@babel/preset-react": "^7.17.12",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.5",
"@testing-library/react-hooks": "^8.0.1",
"@types/node": "^18.0.6",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "5.0.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^28.1.0",
"babel-preset-gatsby": "^2.15.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-react": "^7.30.1",
"eslint-webpack-plugin": "^3.2.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^28.1.0",
"jest-environment-jsdom": "^28.1.2",
"prettier": "^2.7.1",
"ts-jest": "^28.0.7",
"typescript": "^4.7.4"
},
Looks like my issue was that I used to have not propriate parserfor ts files: once I switch babel-eslint
to @typescript-eslint/parser
the issue is solved.看起来我的问题是我曾经没有适当的 parserfor ts 文件:一旦我将
babel-eslint
切换到@typescript-eslint/parser
问题就解决了。
//.eslintrc
{
- "parser": "babel-eslint"
+ "parser": "@typescript-eslint/parser"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.