104 lines
3.5 KiB
JavaScript
104 lines
3.5 KiB
JavaScript
module.exports = {
|
|
root: true,
|
|
parser: "@typescript-eslint/parser",
|
|
parserOptions: {
|
|
ecmaVersion: "latest",
|
|
sourceType: "module",
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
project: "./tsconfig.json", // Required for type-aware rules
|
|
},
|
|
env: {
|
|
browser: true,
|
|
es2021: true,
|
|
node: true,
|
|
},
|
|
plugins: ["react", "react-hooks", "@typescript-eslint", "jsx-a11y", "import", "unused-imports"],
|
|
extends: [
|
|
"eslint:recommended",
|
|
"plugin:react/recommended",
|
|
"plugin:react-hooks/recommended",
|
|
"plugin:@typescript-eslint/recommended",
|
|
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
"plugin:jsx-a11y/recommended",
|
|
"plugin:import/errors",
|
|
"plugin:import/warnings",
|
|
"plugin:import/typescript",
|
|
"prettier",
|
|
],
|
|
rules: {
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"error",
|
|
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
|
],
|
|
"@typescript-eslint/no-explicit-any": "error",
|
|
"@typescript-eslint/explicit-function-return-type": ["error", { allowExpressions: false }],
|
|
"@typescript-eslint/strict-boolean-expressions": "error",
|
|
"@typescript-eslint/no-floating-promises": "error",
|
|
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
|
|
"@typescript-eslint/no-misused-promises": "error",
|
|
"@typescript-eslint/prefer-readonly": "error",
|
|
"@typescript-eslint/explicit-module-boundary-types": "error",
|
|
"@typescript-eslint/typedef": [
|
|
"error",
|
|
{
|
|
arrayDestructuring: true,
|
|
arrowParameter: true,
|
|
memberVariableDeclaration: true,
|
|
objectDestructuring: true,
|
|
parameter: true,
|
|
propertyDeclaration: true,
|
|
variableDeclaration: true,
|
|
variableDeclarationIgnoreFunction: false,
|
|
},
|
|
],
|
|
|
|
"react/react-in-jsx-scope": "off",
|
|
"react/prop-types": "off",
|
|
"react/jsx-uses-react": "off",
|
|
"react/jsx-uses-vars": "error",
|
|
"react/jsx-no-useless-fragment": "error",
|
|
"react/self-closing-comp": "error",
|
|
|
|
"react-hooks/rules-of-hooks": "error",
|
|
"react-hooks/exhaustive-deps": "error",
|
|
|
|
"jsx-a11y/no-noninteractive-element-interactions": "error",
|
|
"jsx-a11y/anchor-is-valid": "error",
|
|
"jsx-a11y/click-events-have-key-events": "error",
|
|
|
|
"import/order": [
|
|
"error",
|
|
{
|
|
groups: [
|
|
["builtin", "external"],
|
|
["internal", "parent", "sibling", "index"],
|
|
],
|
|
"newlines-between": "always",
|
|
alphabetize: { order: "asc", caseInsensitive: true },
|
|
},
|
|
],
|
|
"import/no-unresolved": "error",
|
|
"import/no-duplicates": "error",
|
|
|
|
"unused-imports/no-unused-imports-ts": "error",
|
|
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
"no-debugger": "error",
|
|
eqeqeq: ["error", "always"],
|
|
curly: "error",
|
|
semi: ["error", "always"],
|
|
quotes: ["error", "single", { avoidEscape: true }],
|
|
"prefer-const": "error",
|
|
"no-var": "error",
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: "detect",
|
|
},
|
|
"import/resolver": {
|
|
typescript: {},
|
|
},
|
|
},
|
|
};
|