-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
eslint.config.js
316 lines (246 loc) · 10.9 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
import globals from "globals";
import stylistic from "@stylistic/eslint-plugin";
export default [
{
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
globals: {
...globals.browser,
},
},
plugins: {
"@stylistic": stylistic,
},
rules: {
/**
* ESLint rules: https://eslint.org/docs/latest/rules/
* Based off of: https://github.com/eslint/eslint/blob/v8.54.0/packages/js/src/configs/eslint-recommended.js
*/
// Enforce curly braces for all control statements
// https://eslint.org/docs/latest/rules/curly
curly: 1,
// Require `super()` calls in constructors
// https://eslint.org/docs/latest/rules/constructor-super
"constructor-super": 1,
// Enforce “for” loop update clause moving the counter in the right direction
// https://eslint.org/docs/latest/rules/for-direction
"for-direction": 1,
// Enforce `return` statements in getters
// https://eslint.org/docs/latest/rules/getter-return
"getter-return": 1,
// Disallow using an async function as a Promise executor
// https://eslint.org/docs/latest/rules/no-async-promise-executor
"no-async-promise-executor": 1,
// Disallow `let`/const`/function`/`class` in `case`/`default` clauses
// https://eslint.org/docs/latest/rules/no-case-declarations
"no-case-declarations": 1,
// Disallow reassigning class members
// https://eslint.org/docs/latest/rules/no-class-assign
"no-class-assign": 1,
// Disallow comparing against -0
// https://eslint.org/docs/latest/rules/no-compare-neg-zero
"no-compare-neg-zero": 1,
// Disallow reassigning `const` variables
// https://eslint.org/docs/latest/rules/no-const-assign
"no-const-assign": 1,
// Disallow constant expressions in conditions
// https://eslint.org/docs/latest/rules/no-constant-condition
"no-constant-condition": 1,
// Disallow control characters in regular expressions
// https://eslint.org/docs/latest/rules/no-control-regex
"no-control-regex": 1,
// Disallow the use of `debugger`
// https://eslint.org/docs/latest/rules/no-debugger
"no-debugger": 1,
// Disallow deleting variables
// https://eslint.org/docs/latest/rules/no-delete-var
"no-delete-var": 1,
// Disallow duplicate arguments in `function` definitions
// https://eslint.org/docs/latest/rules/no-dupe-args
"no-dupe-args": 1,
// Disallow duplicate class members
// https://eslint.org/docs/latest/rules/no-dupe-class-members
"no-dupe-class-members": 1,
// Disallow duplicate conditions in if-else-if chains
// https://eslint.org/docs/latest/rules/no-dupe-else-if
"no-dupe-else-if": 1,
// Disallow duplicate keys in object literals
// https://eslint.org/docs/latest/rules/no-dupe-keys
"no-dupe-keys": 1,
// Disallow duplicate case labels
// https://eslint.org/docs/latest/rules/no-duplicate-case
"no-duplicate-case": 1,
// Disallow empty character classes in regular expressions
// https://eslint.org/docs/latest/rules/no-empty-character-class
"no-empty-character-class": 1,
// Disallow empty destructuring patterns
// https://eslint.org/docs/latest/rules/no-empty-pattern
"no-empty-pattern": 1,
// Disallow reassigning exceptions in `catch` clauses
// https://eslint.org/docs/latest/rules/no-ex-assign
"no-ex-assign": 1,
// Disallow unnecessary boolean casts
// https://eslint.org/docs/latest/rules/no-extra-boolean-cast
"no-extra-boolean-cast": 1,
// Disallow fallthrough of `case` statements
// unless marked with a comment that matches `/falls?\s?through/i` regex
// https://eslint.org/docs/latest/rules/no-fallthrough
"no-fallthrough": 1,
// Disallow reassigning `function` declarations
// https://eslint.org/docs/latest/rules/no-func-assign
"no-func-assign": 1,
// Disallow assignments to native objects or read-only global variables
// https://eslint.org/docs/latest/rules/no-global-assign
"no-global-assign": 1,
// Disallow assigning to imported bindings
// https://eslint.org/docs/latest/rules/no-import-assign
"no-import-assign": 1,
// Disallow invalid regular expression strings in `RegExp` constructors
// https://eslint.org/docs/latest/rules/no-invalid-regexp
"no-invalid-regexp": 1,
// Disallow whitespace that is not `tab` or `space` except in string literals
// https://eslint.org/docs/latest/rules/no-irregular-whitespace
"no-irregular-whitespace": 1,
// Disallow characters which are made with multiple code points in character class syntax
// https://eslint.org/docs/latest/rules/no-misleading-character-class
"no-misleading-character-class": 1,
// Disallow `new` operators with the `Symbol` object
// https://eslint.org/docs/latest/rules/no-new-symbol
"no-new-symbol": 1,
// Disallow `\8` and `\9` escape sequences in string literals
// https://eslint.org/docs/latest/rules/no-nonoctal-decimal-escape
"no-nonoctal-decimal-escape": 1,
// Disallow calling global object properties as functions
// https://eslint.org/docs/latest/rules/no-obj-calls
"no-obj-calls": 1,
// Disallow octal literals
// https://eslint.org/docs/latest/rules/no-octal
"no-octal": 1,
// Disallow calling some `Object.prototype` methods directly on objects
// https://eslint.org/docs/latest/rules/no-prototype-builtins
"no-prototype-builtins": 1,
// Disallow multiple spaces in regular expressions
// https://eslint.org/docs/latest/rules/no-regex-spaces
"no-regex-spaces": 1,
// Disallow assignments where both sides are exactly the same
// https://eslint.org/docs/latest/rules/no-self-assign
"no-self-assign": 1,
// Disallow identifiers from shadowing restricted names
// https://eslint.org/docs/latest/rules/no-shadow-restricted-names
"no-shadow-restricted-names": 1,
// Disallow `this`/`super` before calling `super()` in constructors
// https://eslint.org/docs/latest/rules/no-this-before-super
"no-this-before-super": 1,
// Disallow the use of undeclared variables unless mentioned in `/*global */` comments
// https://eslint.org/docs/latest/rules/no-undef
// TODO: At-risk; subject to change.
"no-undef": 1,
// Disallow confusing multiline expressions
// https://eslint.org/docs/latest/rules/no-unexpected-multiline
// TODO: At-risk; subject to change.
"no-unexpected-multiline": 1,
// Disallow unreachable code after `return`, `throw`, `continue`, and `break` statements
// https://eslint.org/docs/latest/rules/no-unreachable
"no-unreachable": 1,
// Disallow control flow statements in `finally` blocks
// https://eslint.org/docs/latest/rules/no-unsafe-finally
"no-unsafe-finally": 1,
// Disallow negating the left operand of relational operators
// https://eslint.org/docs/latest/rules/no-unsafe-negation
"no-unsafe-negation": 1,
// Disallow use of optional chaining in contexts where the `undefined` value is not allowed
// https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining
"no-unsafe-optional-chaining": 1,
// Disallow unused labels
// https://eslint.org/docs/latest/rules/no-unused-labels
"no-unused-labels": 1,
// Disallow useless backreferences in regular expressions
// https://eslint.org/docs/latest/rules/no-useless-backreference
"no-useless-backreference": 1,
// Disallow unnecessary calls to `.call()` and `.apply()`
// https://eslint.org/docs/latest/rules/no-useless-call
"no-useless-call": 1,
// Disallow unnecessary `catch` clauses
// https://eslint.org/docs/latest/rules/no-useless-catch
"no-useless-catch": 1,
// Disallow unnecessary escape characters
// https://eslint.org/docs/latest/rules/no-useless-escape
"no-useless-escape": 1,
// Disallow `with` statements
// https://eslint.org/docs/latest/rules/no-with
"no-with": 1,
// Require generator functions to contain `yield`
// https://eslint.org/docs/latest/rules/require-yield
"require-yield": 1,
// Require calls to `isNaN()` when checking for `NaN`
// https://eslint.org/docs/latest/rules/use-isnan
"use-isnan": 1,
// Enforce comparing `typeof` expressions against valid strings
// https://eslint.org/docs/latest/rules/valid-typeof
"valid-typeof": 1,
/**
* ESLint Stylistic rules: https://eslint.style/packages/default#rules
*/
// Enforce a space before and after `=>` in arrow functions
// https://eslint.style/rules/default/arrow-spacing
"@stylistic/arrow-spacing": 1,
// Enforce consistent brace style for blocks
// https://eslint.style/rules/default/brace-style
"@stylistic/brace-style": [1, "stroustrup"],
// Enforce trailing commas unless closing `]` or `}` is on the same line
// https://eslint.style/rules/default/comma-dangle
"@stylistic/comma-dangle": [1, "always-multiline"],
// Enforce no space before and one or more spaces after a comma
// https://eslint.style/rules/default/comma-spacing
"@stylistic/comma-spacing": 1,
// Require newline at the end of files
// https://eslint.style/rules/default/eol-last
"@stylistic/eol-last": 1,
// Enforce consistent indentation
// https://eslint.style/rules/default/indent
"@stylistic/indent": [1, "tab", { SwitchCase: 1, outerIIFEBody: 0 }],
// Enforce consistent spacing before and after keywords
// https://eslint.style/rules/default/keyword-spacing
"@stylistic/keyword-spacing": 1,
// Disallow unnecessary semicolons
// https://eslint.style/rules/default/no-extra-semi
"@stylistic/no-extra-semi": 1,
// Disallow mixed spaces and tabs for indentation
// https://eslint.style/rules/default/no-mixed-spaces-and-tabs
"@stylistic/no-mixed-spaces-and-tabs": [1, "smart-tabs"],
// Disallow trailing whitespace at the end of lines
// https://eslint.style/rules/default/no-trailing-spaces
"@stylistic/no-trailing-spaces": 1,
// Enforce the consistent use of double quotes
// https://eslint.style/rules/default/quotes
"@stylistic/quotes": [
1,
"double",
{ avoidEscape: true, allowTemplateLiterals: true },
],
// Require semicolons instead of ASI
// https://eslint.style/rules/default/semi
"@stylistic/semi": 1,
// Enforce at least one space before blocks
// https://eslint.style/rules/default/space-before-blocks
"@stylistic/space-before-blocks": 1,
// Enforce a space before `function` definition opening parenthesis
// https://eslint.style/rules/default/space-before-function-paren
"@stylistic/space-before-function-paren": 1,
// Require spaces around infix operators (e.g. `+`, `=`, `?`, `:`)
// https://eslint.style/rules/default/space-infix-ops
"@stylistic/space-infix-ops": 1,
// Enforce a space after unary word operators (`new`, `delete`, `typeof`, `void`, `yield`)
// https://eslint.style/rules/default/space-unary-ops
"@stylistic/space-unary-ops": 1,
// Enforce whitespace after the `//` or `/*` in a comment
// https://eslint.style/rules/default/spaced-comment
"@stylistic/spaced-comment": [
1,
"always",
{ block: { exceptions: ["*"] } },
],
},
},
];