-
Notifications
You must be signed in to change notification settings - Fork 8
/
eslint.config.js
116 lines (115 loc) · 3.85 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
const eslint = require("@eslint/js");
const jsxA11y = require("eslint-plugin-jsx-a11y");
const react = require("eslint-plugin-react");
const tseslint = require("typescript-eslint");
module.exports = [
eslint.configs.recommended,
...tseslint.configs.recommended,
jsxA11y.flatConfigs.recommended,
{
// ESLint specific rules
// https://eslint.org/docs/latest/rules/
rules: {
"array-callback-return": "error",
"no-duplicate-imports": "error",
"no-var": "error",
"no-self-compare": "error",
"no-template-curly-in-string": "error",
curly: "error",
"default-case": "off",
"default-case-last": "error",
"dot-notation": "error",
"no-alert": "error",
"no-console": "warn",
"no-else-return": "error",
"no-eval": "warn",
"no-lonely-if": "error",
"no-multi-assign": "error",
"no-multi-str": "error",
"no-param-reassign": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-unneeded-ternary": "error",
"no-useless-call": "error",
"no-useless-constructor": "error",
"no-useless-return": "error",
"object-shorthand": "error",
"operator-assignment": ["error", "always"],
"prefer-arrow-callback": "error",
"prefer-const": "error",
"prefer-exponentiation-operator": "error",
"prefer-object-has-own": "error",
"prefer-promise-reject-errors": "error",
"prefer-object-spread": "error",
"prefer-template": "error",
yoda: "error",
radix: "error",
eqeqeq: ["error", "smart"],
"no-undef": "off",
},
},
{
// TypeScript ESLint specific rules
// https://typescript-eslint.io/rules/
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/consistent-generic-constructors": "error",
"@typescript-eslint/method-signature-style": ["error", "property"],
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/lines-between-class-members": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/comma-dangle": "off",
"@typescript-eslint/no-redeclare": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-loop-func": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "none",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
},
},
{
// React specific rules
plugins: { react },
settings: { react: { version: "detect" } },
rules: {
"react/button-has-type": "error",
"react/jsx-boolean-value": "error",
"react/jsx-curly-brace-presence": ["error", "never"],
"react/jsx-fragments": ["error", "syntax"],
"react/jsx-no-comment-textnodes": "error",
"react/jsx-no-duplicate-props": "error",
"react/jsx-no-target-blank": "error",
"react/no-children-prop": "error",
"react/no-deprecated": "error",
"react/no-find-dom-node": "error",
"react/no-string-refs": "error",
"react/self-closing-comp": "error",
"react/void-dom-elements-no-children": "error",
},
},
{
// JSX A11y specific rules
rules: {
"jsx-a11y/no-autofocus": "off",
"jsx-a11y/control-has-associated-label": "off",
"jsx-a11y/mouse-events-have-key-events": "off",
"jsx-a11y/label-has-for": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/anchor-has-content": "off",
},
},
];