feat: add eslint support for typescript files and fix no unused vars
error when add support for TypeScript features (we must disable the base rule as it can report incorrect errors, use instead of @typescript-eslint/no-unused-vars) ref: https://github.com/typescript-eslint/typescript-eslint /blob/main/packages/eslint-plugin/docs/rules/no-unused-vars.md
This commit is contained in:
+14
-3
@@ -1,19 +1,21 @@
|
||||
{
|
||||
"extends": ["eslint:recommended", "plugin:react/recommended", "prettier"],
|
||||
"plugins": ["react-hooks"],
|
||||
"plugins": ["import", "react", "react-hooks", "@typescript-eslint"],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-vars": ["error", { "ignoreRestSiblings": true }],
|
||||
"react/jsx-uses-react": "off",
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"semi": 2,
|
||||
"no-console": "off",
|
||||
"react/prop-types": 0,
|
||||
"react/no-unescaped-entities": "off",
|
||||
"no-unused-vars": ["error", { "ignoreRestSiblings": true }],
|
||||
"no-unused-vars": "off",
|
||||
"react-hooks/rules-of-hooks": "error",
|
||||
"react-hooks/exhaustive-deps": "warn",
|
||||
"max-lines": ["warn", { "max": 500 }],
|
||||
"react/display-name": 0
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2021,
|
||||
"sourceType": "module",
|
||||
@@ -32,7 +34,16 @@
|
||||
},
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "17"
|
||||
"version": "18"
|
||||
},
|
||||
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
|
||||
"import/parsers": {
|
||||
"@typescript-eslint/parser": [".ts", ".tsx"]
|
||||
},
|
||||
"import/resolver": {
|
||||
"node": {
|
||||
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user