简体   繁体   中英

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'.

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)

例子

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.

//.eslintrc
{
-  "parser": "babel-eslint"
+  "parser": "@typescript-eslint/parser"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM