eslint-config-isaacscript 3.7.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/base-eslint.js CHANGED
@@ -1,284 +1,721 @@
1
- /**
2
- * This ESLint config only contains built-in rules from ESLint itself:
3
- * https://eslint.org/docs/latest/rules/
4
- *
5
- * @type {import("eslint").Linter.Config}
6
- */
7
- const config = {
8
- rules: {
9
- // -----------------
10
- // Possible Problems
11
- // -----------------
12
-
13
- // https://eslint.org/docs/latest/rules/array-callback-return
14
- // - Using "checkForEach" makes the rule stricter.
15
- "array-callback-return": [
16
- "warn",
17
- {
18
- checkForEach: true,
19
- },
20
- ],
21
-
22
- // TODO
23
-
24
- /**
25
- * Documentation:
26
- * https://eslint.org/docs/latest/rules/consistent-return
27
- *
28
- * Defined at:
29
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
30
- *
31
- * We prefer the "noImplicitReturns" compiler flag over the "consistent-return" ESLint rule,
32
- * since it is type-aware:
33
- * https://github.com/typescript-eslint/typescript-eslint/issues/5254
34
- */
35
- "consistent-return": ["off"],
36
-
37
- /**
38
- * Documentation:
39
- * https://eslint.org/docs/latest/rules/curly
40
- *
41
- * Defined at:
42
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
43
- *
44
- * Always requiring curly braces can partially ward against Apple-style if statement bugs:
45
- * https://www.imperialviolet.org/2014/02/22/applebug.html
46
- *
47
- * Additionally, this rule needs to be set to "all" to work properly with
48
- * `eslint-prettier-config`:
49
- * https://github.com/prettier/eslint-config-prettier#curly
50
- */
51
- curly: ["warn", "all"],
52
-
53
- /**
54
- * Documentation:
55
- * https://eslint.org/docs/latest/rules/default-case
56
- *
57
- * Defined at:
58
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
59
- *
60
- * This rule is generally bad to have on in TypeScript projects:
61
- * https://github.com/typescript-eslint/typescript-eslint/issues/5254
62
- */
63
- "default-case": "off",
64
-
65
- /**
66
- * Documentation:
67
- * https://eslint.org/docs/latest/rules/no-console
68
- *
69
- * Defined at:
70
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js
71
- *
72
- * Command-line programs commonly write to standard out and standard error.
73
- */
74
- "no-console": "off",
75
-
76
- /**
77
- * Documentation:
78
- * https://eslint.org/docs/latest/rules/no-constant-binary-expression
79
- *
80
- * Not defined in parent configs.
81
- *
82
- * This rule was released in 2022 and is known to catch many subtle bugs:
83
- * https://github.com/eslint/eslint.org/pull/240/files
84
- */
85
- "no-constant-binary-expression": "warn",
86
-
87
- /**
88
- * Documentation:
89
- * https://eslint.org/docs/latest/rules/no-continue
90
- *
91
- * Defined at:
92
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
93
- *
94
- * Proper use of continues can reduce indentation for long blocks of code.
95
- */
96
- "no-continue": "off",
97
-
98
- /**
99
- * Documentation:
100
- * https://eslint.org/docs/latest/rules/no-plusplus
101
- *
102
- * Defined at:
103
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
104
- *
105
- * Airbnb disallows these because it can lead to errors with minified code. When using Prettier,
106
- * it adds semi-colons everywhere, so we don't have to worry about this.
107
- */
108
- "no-plusplus": "off",
109
-
110
- /**
111
- * Documentation:
112
- * https://eslint.org/docs/latest/rules/no-restricted-syntax
113
- *
114
- * Defined at:
115
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
116
- *
117
- * - We remove the `ForOfStatement` selector, since they are commonly used.
118
- */
119
- "no-restricted-syntax": [
120
- "warn",
121
- {
122
- selector: "ForInStatement",
123
- message:
124
- "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
125
- },
126
- {
127
- selector: "LabeledStatement",
128
- message:
129
- "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
130
- },
131
- {
132
- selector: "WithStatement",
133
- message:
134
- "`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
1
+ // This ESLint config only contains built-in rules from ESLint itself:
2
+ // https://eslint.org/docs/latest/rules/
3
+
4
+ const confusingBrowserGlobals = require("confusing-browser-globals");
5
+
6
+ // Rules are separated into categories:
7
+ // 1) Possible Problems
8
+ // 2) Suggestions
9
+ // 3) Layout & Formatting
10
+
11
+ /** @type {import("eslint").Linter.RulesRecord} */
12
+ const POSSIBLE_PROBLEMS = {
13
+ /** The `checkForEach` option is enabled to make the rule stricter. */
14
+ "array-callback-return": [
15
+ "error",
16
+ {
17
+ checkForEach: true,
18
+ },
19
+ ],
20
+
21
+ "constructor-super": "off", // @typescript-eslint/eslint-recommended
22
+ "for-direction": "error",
23
+ "getter-return": "off", // @typescript-eslint/eslint-recommended
24
+ "no-async-promise-executor": "error",
25
+ "no-await-in-loop": "error",
26
+ "no-class-assign": "error",
27
+ "no-compare-neg-zero": "error",
28
+ "no-cond-assign": "error",
29
+ "no-const-assign": "off", // @typescript-eslint/eslint-recommended
30
+ "no-constant-binary-expression": "error",
31
+ "no-constant-condition": "error",
32
+ "no-constructor-return": "error",
33
+ "no-control-regex": "error",
34
+ "no-debugger": "error",
35
+ "no-dupe-args": "off", // @typescript-eslint/eslint-recommended
36
+ "no-dupe-class-members": "off", // @typescript-eslint/eslint-recommended
37
+ "no-dupe-else-if": "error",
38
+ "no-dupe-keys": "off", // @typescript-eslint/eslint-recommended
39
+ "no-duplicate-case": "error",
40
+
41
+ /**
42
+ * Superseded by the `import/no-duplicates` rule (which is provided by the `import/recommended`
43
+ * config).
44
+ */
45
+ "no-duplicate-imports": "off",
46
+
47
+ "no-empty-character-class": "error",
48
+ "no-empty-pattern": "error",
49
+ "no-ex-assign": "error",
50
+ "no-fallthrough": "error",
51
+ "no-func-assign": "off", // @typescript-eslint/eslint-recommended
52
+ "no-import-assign": "off", // @typescript-eslint/eslint-recommended
53
+ "no-inner-declarations": "error",
54
+ "no-invalid-regexp": "error",
55
+ "no-irregular-whitespace": "error",
56
+
57
+ /** Superseded by the `@typescript-eslint/no-loss-of-precision` rule. */
58
+ "no-loss-of-precision": "off",
59
+
60
+ "no-misleading-character-class": "error",
61
+ "no-new-native-nonconstructor": "error",
62
+ "no-new-symbol": "off", // @typescript-eslint/eslint-recommended
63
+ "no-obj-calls": "off", // @typescript-eslint/eslint-recommended`
64
+ "no-promise-executor-return": "error",
65
+ "no-prototype-builtins": "error",
66
+ "no-self-assign": "error",
67
+ "no-self-compare": "error",
68
+ "no-setter-return": "off", // @typescript-eslint/eslint-recommended
69
+ "no-sparse-arrays": "error",
70
+ "no-template-curly-in-string": "error",
71
+ "no-this-before-super": "off", // @typescript-eslint/eslint-recommended`
72
+ "no-undef": "off", // @typescript-eslint/eslint-recommended
73
+ "no-unexpected-multiline": "off", // eslint-config-prettier
74
+ "no-unmodified-loop-condition": "error",
75
+ "no-unreachable": "off", // @typescript-eslint/eslint-recommended
76
+ "no-unreachable-loop": "error",
77
+ "no-unsafe-finally": "error",
78
+ "no-unsafe-negation": "off", // @typescript-eslint/eslint-recommended
79
+ "no-unsafe-optional-chaining": "error",
80
+ "no-unused-private-class-members": "error",
81
+
82
+ /** Superseded by the `@typescript-eslint/no-unused-vars` rule. */
83
+ "no-unused-vars": "off",
84
+
85
+ /** Superseded by the `@typescript-eslint/no-use-before-define` rule. */
86
+ "no-use-before-define": "off",
87
+
88
+ "no-useless-backreference": "error",
89
+
90
+ /**
91
+ * Disabled since [Airbnb reports that the rule is "very
92
+ * buggy"](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js).
93
+ */
94
+ "require-atomic-updates": "off",
95
+
96
+ "use-isnan": "error",
97
+ "valid-typeof": "error",
98
+ };
99
+
100
+ /** @type {import("eslint").Linter.RulesRecord} */
101
+ const SUGGESTIONS = {
102
+ "accessor-pairs": "error",
103
+ "arrow-body-style": "error",
104
+ "block-scoped-var": "error",
105
+
106
+ /**
107
+ * Superseded by the `@typescript-eslint/naming-convention` rule. (`camelcase` is used to enforce
108
+ * naming conventions.)
109
+ */
110
+ camelcase: "off",
111
+
112
+ /**
113
+ * Superseded by the `isaacscript/complete-sentences-jsdoc` and
114
+ * `isaacscript/complete-sentences-line-comments` rules.
115
+ */
116
+ "capitalized-comments": "off",
117
+
118
+ /** Superseded by the `@typescript-eslint/class-methods-use-this` rule. */
119
+ "class-methods-use-this": "off",
120
+
121
+ /**
122
+ * Disabled since cyclomatic complexity is not a good enough general indicator of code complexity.
123
+ */
124
+ complexity: "off",
125
+
126
+ /** Disabled since this is handled by the `noImplicitReturns` TypeScript compiler flag. */
127
+ "consistent-return": "off",
128
+
129
+ /** Disabled since capturing `this` is largely obviated by using modern arrow functions. */
130
+ "consistent-this": "off",
131
+
132
+ /**
133
+ * Always requiring curly braces can partially ward against [Apple-style if statement
134
+ * bugs](https://www.imperialviolet.org/2014/02/22/applebug.html). Additionally, this rule needs
135
+ * to be set to "all" to [work properly with
136
+ * `eslint-prettier-config`](https://github.com/prettier/eslint-config-prettier#curly).
137
+ */
138
+ curly: ["error", "all"],
139
+
140
+ /**
141
+ * Disabled since it is [generally bad in TypeScript
142
+ * projects](https://github.com/typescript-eslint/typescript-eslint/issues/5254#issuecomment-1168992749).
143
+ */
144
+ "default-case": "off",
145
+
146
+ "default-case-last": "error",
147
+
148
+ /** Superseded by the `@typescript-eslint/default-param-last` rule. */
149
+ "default-param-last": "off",
150
+
151
+ /** Superseded by the `@typescript-eslint/dot-notation` rule. */
152
+ "dot-notation": "off",
153
+
154
+ /** Superseded by the `isaacscript/eqeqeq-fix` rule. */
155
+ eqeqeq: "off",
156
+
157
+ "func-name-matching": "error",
158
+ "func-names": "error",
159
+
160
+ /** Disabled since it is common to use both function forms, depending on the situation. */
161
+ "func-style": "off",
162
+
163
+ "grouped-accessor-pairs": "error",
164
+ "guard-for-in": "error",
165
+
166
+ /** Disabled since it is expected to be configured with project-specific keywords. */
167
+ "id-denylist": "off",
168
+
169
+ /** Disabled because short variable names are understandable in many contexts. */
170
+ "id-length": "off",
171
+
172
+ /**
173
+ * Superseded by the `@typescript-eslint/naming-convention` rule. (`id-match` is used to enforce
174
+ * naming conventions.)
175
+ */
176
+ "id-match": "off",
177
+
178
+ /** Superseded by the `@typescript-eslint/init-declarations` rule. */
179
+ "init-declarations": "off",
180
+
181
+ /** The `enforceForIfStatements` option is enabled to make the rule stricter. */
182
+ "logical-assignment-operators": [
183
+ "error",
184
+ "always",
185
+ {
186
+ enforceForIfStatements: true,
187
+ },
188
+ ],
189
+
190
+ "max-classes-per-file": "error",
191
+ "max-depth": "error",
192
+
193
+ /**
194
+ * Disabled because enforcing an arbitrary line threshold for every file in a project does not
195
+ * provide much value.
196
+ */
197
+ "max-lines": "off",
198
+
199
+ /**
200
+ * Disabled because enforcing an arbitrary line threshold for every function in a project does not
201
+ * provide much value.
202
+ */
203
+ "max-lines-per-function": "off",
204
+
205
+ "max-nested-callbacks": "error",
206
+
207
+ /**
208
+ * Disabled because enforcing an arbitrary parameter number threshold for every function in a
209
+ * project does not provide much value. (Additionally, using TypeScript reduces the value of such
210
+ * a check.)
211
+ */
212
+ "max-params": "off",
213
+
214
+ /**
215
+ * Disabled because enforcing an arbitrary statement threshold for every function in a project
216
+ * does not provide much value.
217
+ */
218
+ "max-statements": "off",
219
+
220
+ /** Disabled because it is conventional to use both kinds of comments in TypeScript projects. */
221
+ "multiline-comment-style": "off",
222
+
223
+ "new-cap": "error",
224
+ "no-alert": "error",
225
+
226
+ /** Superseded by the `@typescript-eslint/no-array-constructor` rule. */
227
+ "no-array-constructor": "off",
228
+
229
+ "no-bitwise": "error",
230
+ "no-caller": "error",
231
+ "no-case-declarations": "error",
232
+ "no-confusing-arrow": "off", // eslint-config-prettier
233
+
234
+ /**
235
+ * Disabled because command-line programs written in TypeScript commonly write to standard out and
236
+ * standard error.
237
+ */
238
+ "no-console": "off",
239
+
240
+ /** Disabled because proper use of continues can reduce indentation for long blocks of code. */
241
+ "no-continue": "off",
242
+
243
+ "no-delete-var": "error",
244
+ "no-div-regex": "error",
245
+
246
+ /** The `allowElseIf` option is disabled to make the rule stricter. */
247
+ "no-else-return": [
248
+ "error",
249
+ {
250
+ allowElseIf: false,
251
+ },
252
+ ],
253
+
254
+ "no-empty": "error",
255
+
256
+ /** Superseded by the `@typescript-eslint/no-empty-function` rule. */
257
+ "no-empty-function": "off",
258
+
259
+ "no-empty-static-block": "error",
260
+ "no-eq-null": "error",
261
+ "no-eval": "error",
262
+ "no-extend-native": "error",
263
+ "no-extra-bind": "error",
264
+ "no-extra-boolean-cast": "error",
265
+ "no-extra-label": "error",
266
+
267
+ /** Superseded by the `@typescript-eslint/no-extra-semi` rule. */
268
+ "no-extra-semi": "off",
269
+
270
+ "no-floating-decimal": "off", // eslint-config-prettier
271
+ "no-global-assign": "error",
272
+ "no-implicit-coercion": "error",
273
+ "no-implicit-globals": "error",
274
+
275
+ /** Superseded by the `@typescript-eslint/no-implied-eval` rule. */
276
+ "no-implied-eval": "off",
277
+
278
+ /** Disabled because inline comments are common in the TypeScript ecosystem. */
279
+ "no-inline-comments": "off",
280
+
281
+ /** Superseded by the `@typescript-eslint/no-invalid-this` rule. */
282
+ "no-invalid-this": "off",
283
+
284
+ "no-iterator": "error",
285
+ "no-label-var": "error",
286
+ "no-labels": "error",
287
+ "no-lone-blocks": "error",
288
+ "no-lonely-if": "error",
289
+
290
+ /** Superseded by the `@typescript-eslint/no-loop-func` rule. */
291
+ "no-loop-func": "off",
292
+
293
+ /** Superseded by the `@typescript-eslint/no-magic-numbers` rule. */
294
+ "no-magic-numbers": "off",
295
+
296
+ "no-mixed-operators": "off", // eslint-config-prettier
297
+ "no-multi-assign": "error",
298
+ "no-multi-str": "error",
299
+
300
+ /** Superseded by the `unicorn/no-negated-condition` rule. */
301
+ "no-negated-condition": "off",
302
+
303
+ /**
304
+ * `unicorn/no-nested-ternary` is a modified version of this rule but that version is less strict.
305
+ */
306
+ "no-nested-ternary": "error",
307
+
308
+ "no-new": "error",
309
+ "no-new-func": "error",
310
+ "no-new-object": "error",
311
+ "no-new-wrappers": "error",
312
+ "no-nonoctal-decimal-escape": "error",
313
+ "no-octal": "error",
314
+ "no-octal-escape": "error",
315
+
316
+ /**
317
+ * The options are [copied from
318
+ * Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js).
319
+ */
320
+ "no-param-reassign": [
321
+ "error",
322
+ {
323
+ props: true,
324
+ ignorePropertyModificationsFor: [
325
+ "acc", // for reduce accumulators
326
+ "accumulator", // for reduce accumulators
327
+ "e", // for e.returnvalue
328
+ "ctx", // for Koa routing
329
+ "context", // for Koa routing
330
+ "req", // for Express requests
331
+ "request", // for Express requests
332
+ "res", // for Express responses
333
+ "response", // for Express responses
334
+ "$scope", // for Angular 1 scopes
335
+ "staticContext", // for ReactRouter context
336
+ ],
337
+ },
338
+ ],
339
+
340
+ /**
341
+ * Disabled because the rule is unnecessary when using Prettier. (Unary operators can lead to
342
+ * errors with minified code, but Prettier adds semicolons automatically.)
343
+ */
344
+ "no-plusplus": "off",
345
+
346
+ "no-proto": "error",
347
+
348
+ /** Superseded by the `@typescript-eslint/block-spacing` rule. */
349
+ "no-redeclare": "off",
350
+
351
+ "no-regex-spaces": "error",
352
+
353
+ /**
354
+ * The options are [copied from
355
+ * Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/es6.js).
356
+ */
357
+ "no-restricted-exports": [
358
+ "error",
359
+ {
360
+ restrictedNamedExports: [
361
+ "default", // use `export default` to provide a default export
362
+ "then", // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
363
+ ],
364
+ },
365
+ ],
366
+
367
+ /**
368
+ * The options are [copied from
369
+ * Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js).
370
+ */
371
+ "no-restricted-globals": [
372
+ "error",
373
+ {
374
+ name: "isFinite",
375
+ message:
376
+ "Use Number.isFinite instead: https://github.com/airbnb/javascript#standard-library--isfinite",
377
+ },
378
+ {
379
+ name: "isNaN",
380
+ message:
381
+ "Use Number.isNaN instead: https://github.com/airbnb/javascript#standard-library--isnan",
382
+ },
383
+ ...confusingBrowserGlobals,
384
+ ],
385
+
386
+ /** Superseded by the `@typescript-eslint/no-restricted-imports` rule. */
387
+ "no-restricted-imports": "off",
388
+
389
+ /**
390
+ * The options are [copied from
391
+ * Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js).
392
+ */
393
+ "no-restricted-properties": [
394
+ "error",
395
+ {
396
+ object: "arguments",
397
+ property: "callee",
398
+ message: "arguments.callee is deprecated",
399
+ },
400
+ {
401
+ object: "global",
402
+ property: "isFinite",
403
+ message: "Please use Number.isFinite instead",
404
+ },
405
+ {
406
+ object: "self",
407
+ property: "isFinite",
408
+ message: "Please use Number.isFinite instead",
409
+ },
410
+ {
411
+ object: "window",
412
+ property: "isFinite",
413
+ message: "Please use Number.isFinite instead",
414
+ },
415
+ {
416
+ object: "global",
417
+ property: "isNaN",
418
+ message: "Please use Number.isNaN instead",
419
+ },
420
+ {
421
+ object: "self",
422
+ property: "isNaN",
423
+ message: "Please use Number.isNaN instead",
424
+ },
425
+ {
426
+ object: "window",
427
+ property: "isNaN",
428
+ message: "Please use Number.isNaN instead",
429
+ },
430
+ {
431
+ property: "__defineGetter__",
432
+ message: "Please use Object.defineProperty instead.",
433
+ },
434
+ {
435
+ property: "__defineSetter__",
436
+ message: "Please use Object.defineProperty instead.",
437
+ },
438
+ {
439
+ object: "Math",
440
+ property: "pow",
441
+ message: "Use the exponentiation operator (**) instead.",
442
+ },
443
+ ],
444
+
445
+ /** Disabled because it is intended for disallowing specific language features per-project. */
446
+ "no-restricted-syntax": "off",
447
+
448
+ /** The `always` option is provided to make the rule stricter. */
449
+ "no-return-assign": ["error", "always"],
450
+
451
+ "no-script-url": "error",
452
+
453
+ /**
454
+ * Disabled because [it can conflict with
455
+ * Prettier](https://github.com/prettier/eslint-config-prettier/tree/main#no-sequences).
456
+ */
457
+ "no-sequences": "off",
458
+
459
+ /** Superseded by the `@typescript-eslint/no-shadow` rule. */
460
+ "no-shadow": "off",
461
+
462
+ "no-shadow-restricted-names": "error",
463
+
464
+ /**
465
+ * Disabled because ternaries are common in the TypeScript ecosystem and can often lead to concise
466
+ * code that is easy to read.
467
+ */
468
+ "no-ternary": "off",
469
+
470
+ /** Superseded by the `@typescript-eslint/no-throw-literal` rule. */
471
+ "no-throw-literal": "off",
472
+
473
+ "no-undef-init": "error",
474
+
475
+ /**
476
+ * Disabled because in TypeScript, it is common to explicitly check for undefined for the purposes
477
+ * of type narrowing.
478
+ */
479
+ "no-undefined": "off",
480
+
481
+ /**
482
+ * Disabled since it is a common pattern to use underscores to temporarily allow unused variables
483
+ * during development.
484
+ */
485
+ "no-underscore-dangle": "off",
486
+
487
+ /** The `defaultAssignment` option is disabled to make the rule stricter. */
488
+ "no-unneeded-ternary": [
489
+ "error",
490
+ {
491
+ defaultAssignment: false,
492
+ },
493
+ ],
494
+
495
+ /** Superseded by the `@typescript-eslint/no-unused-expressions` rule. */
496
+ "no-unused-expressions": "off",
497
+
498
+ "no-unused-labels": "error",
499
+ "no-useless-call": "error",
500
+ "no-useless-catch": "error",
501
+
502
+ /** The `enforceForClassMembers` option is enabled to make the rule stricter. */
503
+ "no-useless-computed-key": [
504
+ "error",
505
+ {
506
+ enforceForClassMembers: true,
507
+ },
508
+ ],
509
+
510
+ "no-useless-concat": "error",
511
+
512
+ /** Superseded by the `@typescript-eslint/no-useless-constructor` rule. */
513
+ "no-useless-constructor": "off",
514
+
515
+ "no-useless-escape": "error",
516
+ "no-useless-rename": "error",
517
+
518
+ /**
519
+ * Superseded by the `no-autofix/no-useless-return` rule (since the autofix is usually unwanted).
520
+ */
521
+ "no-useless-return": "off",
522
+
523
+ "no-var": "error",
524
+ "no-void": "error",
525
+
526
+ /** Superseded by the `unicorn/expiring-todo-comments` rule. */
527
+ "no-warning-comments": "off",
528
+
529
+ "no-with": "error",
530
+
531
+ /** The `ignoreConstructors` option is disabled to make the rule stricter. */
532
+ "object-shorthand": [
533
+ "error",
534
+ "always",
535
+ {
536
+ ignoreConstructors: false,
537
+ },
538
+ ],
539
+
540
+ /**
541
+ * The `never` option is provided to disallow multi-variable declarations (since they can be
542
+ * confusing).
543
+ */
544
+ "one-var": ["error", "never"],
545
+
546
+ "one-var-declaration-per-line": "off", // eslint-config-prettier
547
+ "operator-assignment": "error",
548
+ "prefer-arrow-callback": "error",
549
+
550
+ /** Superseded by the `no-autofix/prefer-const` rule (since the autofix is usually unwanted). */
551
+ "prefer-const": "off",
552
+
553
+ /**
554
+ * Object destructuring is enforced but array destructuring is not. This matches usage in the
555
+ * general TypeScript ecosystem.
556
+ */
557
+ "prefer-destructuring": [
558
+ "error",
559
+ {
560
+ VariableDeclarator: {
561
+ array: false,
562
+ object: true,
135
563
  },
136
- ],
137
-
138
- /**
139
- * Documentation:
140
- * https://eslint.org/docs/latest/rules/prefer-destructuring
141
- *
142
- * Defined at:
143
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/es6.js
144
- *
145
- * Array destructuring can result in non-intuitive code.
146
- */
147
- "prefer-destructuring": [
148
- "warn",
149
- {
150
- VariableDeclarator: {
151
- array: false,
152
- object: true,
153
- },
154
- AssignmentExpression: {
155
- array: false,
156
- object: false,
157
- },
564
+ AssignmentExpression: {
565
+ array: false,
566
+ object: true,
158
567
  },
159
- ],
160
-
161
- // "constructor-super" is disabled due to conflicting with the TypeScript compiler:
162
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
163
-
164
- // "for-direction" is enabled here:
165
- // https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js
166
-
167
- // "getter-return" is disabled due to conflicting with the TypeScript compiler:
168
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
169
-
170
- // "no-async-promise-executor"
171
-
172
- // "no-await-in-loop"
173
-
174
- // "no-class-assign"
175
-
176
- // "no-compare-neg-zero"
177
-
178
- // "no-cond-assign"
179
-
180
- // "no-const-assign" is disabled due to conflicting with the TypeScript compiler:
181
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
182
-
183
- // "no-constant-binary-expression"
184
-
185
- // "no-constant-condition"
186
-
187
- // "no-constructor-return"
188
-
189
- // "no-control-regex"
190
-
191
- // "no-debugger"
192
-
193
- // "no-dupe-args" is disabled due to conflicting with the TypeScript compiler:
194
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
195
-
196
- // "no-dupe-class-members" is disabled due to conflicting with the TypeScript compiler:
197
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
198
-
199
- // "no-dupe-else-if"
200
-
201
- // "no-dupe-keys" is disabled due to conflicting with the TypeScript compiler:
202
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
203
-
204
- // "no-duplicate-case"
205
-
206
- // "no-duplicate-imports"
207
-
208
- // "no-empty-character-class"
209
-
210
- // "no-empty-pattern"
211
-
212
- // "no-ex-assign"
213
-
214
- // "no-fallthrough"
215
-
216
- // "no-func-assign" is disabled due to conflicting with the TypeScript compiler:
217
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
218
-
219
- // "no-import-assign" is disabled due to conflicting with the TypeScript compiler:
220
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
221
-
222
- // "no-inner-declarations"
223
-
224
- // "no-invalid-regexp"
225
-
226
- // "no-irregular-whitespace"
227
-
228
- // "no-loss-of-precision"
229
-
230
- // "no-misleading-character-class"
231
-
232
- // "no-new-native-nonconstructor"
233
-
234
- // "no-new-symbol" is disabled due to conflicting with the TypeScript compiler:
235
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
236
-
237
- // "no-obj-calls" is disabled due to conflicting with the TypeScript compiler:
238
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
239
-
240
- // "no-promise-executor-return"
241
-
242
- // "no-prototype-builtins"
243
-
244
- // "no-self-assign"
245
-
246
- // "no-self-compare"
247
-
248
- // "no-setter-return"
249
-
250
- // "no-sparse-arrays"
251
-
252
- // "no-template-curly-in-string"
253
-
254
- // "no-redeclare" is disabled due to conflicting with the TypeScript compiler:
255
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
256
-
257
- // "no-setter-return" is disabled due to conflicting with the TypeScript compiler:
258
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
259
-
260
- // "no-this-before-super" is disabled due to conflicting with the TypeScript compiler:
261
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
262
-
263
- // "no-undef" is disabled due to conflicting with the TypeScript compiler:
264
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
265
-
266
- // "no-unreachable" is disabled due to conflicting with the TypeScript compiler:
267
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
268
-
269
- // "no-unsafe-negation" is disabled due to conflicting with the TypeScript compiler:
270
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
568
+ },
569
+ {
570
+ // We disable this for renamed properties, this this is a valid use-case.
571
+ // e.g. `const collectibleUsedToShowFlight = CollectibleType.FATE;`
572
+ enforceForRenamedProperties: false,
573
+ },
574
+ ],
575
+
576
+ "prefer-exponentiation-operator": "error",
577
+ "prefer-named-capture-group": "error",
578
+ "prefer-numeric-literals": "error",
579
+ "prefer-object-has-own": "error",
580
+ "prefer-object-spread": "error",
581
+
582
+ /** The `allowEmptyReject` option is enabled since this is a common pattern. */
583
+ "prefer-promise-reject-errors": [
584
+ "error",
585
+ {
586
+ allowEmptyReject: true,
587
+ },
588
+ ],
589
+
590
+ /** The `disallowRedundantWrapping` option is enabled to make the rule stricter. */
591
+ "prefer-regex-literals": [
592
+ "error",
593
+ {
594
+ disallowRedundantWrapping: true,
595
+ },
596
+ ],
597
+
598
+ "prefer-rest-params": "error",
599
+ "prefer-spread": "error",
600
+ "prefer-template": "error",
601
+ "quote-props": "off", // eslint-config-prettier
602
+ radix: "error",
603
+
604
+ /** Superseded by the `@typescript-eslint/require-await` rule. */
605
+ "require-await": "off",
606
+
607
+ /**
608
+ * Disabled because requiring the `u` or the `v` flag for ASCII text is verbose and cumbersome.
609
+ * (Even though these flags would also enable regex strict mode, the marginal benefit is not worth
610
+ * the verbosity.)
611
+ */
612
+ "require-unicode-regexp": "off",
613
+
614
+ "require-yield": "error",
615
+
616
+ /** Disabled since this is automatically handled by `prettier-plugin-organize-imports`. */
617
+ "sort-imports": "off",
618
+
619
+ /** Disabled because object keys are often not meant to be sorted in alphabetical order. */
620
+ "sort-keys": "off",
621
+
622
+ /**
623
+ * Disabled because variable declarations are often not meant to be sorted in alphabetical order.
624
+ */
625
+ "sort-vars": "off",
626
+
627
+ /** Superseded by `isaacscript/format-jsdoc-comments` and `isaacscript/format-line-comments`. */
628
+ "spaced-comment": "off",
629
+
630
+ /** The `never` option is provided to make the rule stricter. */
631
+ strict: ["error", "never"],
632
+
633
+ "symbol-description": "error",
634
+ "vars-on-top": "error",
635
+ yoda: "error",
636
+ };
271
637
 
272
- // "valid-typeof" is disabled due to conflicting with the TypeScript compiler:
273
- // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
638
+ /** @type {import("eslint").Linter.RulesRecord} */
639
+ const LAYOUT_AND_FORMATTING = {
640
+ "array-bracket-newline": "off", // eslint-config-prettier
641
+ "array-bracket-spacing": "off", // eslint-config-prettier
642
+ "array-element-newline": "off", // eslint-config-prettier
643
+ "arrow-parens": "off", // eslint-config-prettier
644
+ "arrow-spacing": "off", // eslint-config-prettier
645
+ "block-spacing": "off", // eslint-config-prettier
646
+ "brace-style": "off", // eslint-config-prettier
647
+ "comma-dangle": "off", // eslint-config-prettier
648
+ "comma-spacing": "off", // eslint-config-prettier
649
+ "comma-style": "off", // eslint-config-prettier
650
+ "computed-property-spacing": "off", // eslint-config-prettier
651
+ "dot-location": "off", // eslint-config-prettier
652
+ "eol-last": "off", // eslint-config-prettier
653
+ "func-call-spacing": "off", // eslint-config-prettier
654
+ "function-call-argument-newline": "off", // eslint-config-prettier
655
+ "function-paren-newline": "off", // eslint-config-prettier
656
+ "generator-star-spacing": "off", // eslint-config-prettier
657
+ "implicit-arrow-linebreak": "off", // eslint-config-prettier
658
+ indent: "off", // eslint-config-prettier
659
+ "jsx-quotes": "off", // eslint-config-prettier
660
+ "key-spacing": "off", // eslint-config-prettier
661
+ "keyword-spacing": "off", // eslint-config-prettier
662
+
663
+ /** Disabled since it is common in the TypeScript ecosystem to use both types of comments. */
664
+ "line-comment-position": "off",
665
+
666
+ "linebreak-style": "off", // eslint-config-prettier
667
+ "lines-around-comment": "off", // eslint-config-prettier
668
+
669
+ /** Superseded by the `@typescript-eslint/lines-between-class-members` rule. */
670
+ "lines-between-class-members": "off",
671
+
672
+ "max-len": "off", // eslint-config-prettier
673
+ "max-statements-per-line": "off", // eslint-config-prettier
674
+ "multiline-ternary": "off", // eslint-config-prettier
675
+ "new-parens": "off", // eslint-config-prettier
676
+ "newline-per-chained-call": "off", // eslint-config-prettier
677
+ "no-extra-parens": "off", // eslint-config-prettier
678
+ "no-mixed-spaces-and-tabs": "off", // eslint-config-prettier
679
+ "no-multi-spaces": "off", // eslint-config-prettier
680
+ "no-multiple-empty-lines": "off", // eslint-config-prettier
681
+ "no-tabs": "off", // eslint-config-prettier
682
+ "no-trailing-spaces": "off", // eslint-config-prettier
683
+ "no-whitespace-before-property": "off", // eslint-config-prettier
684
+ "nonblock-statement-body-position": "off", // eslint-config-prettier
685
+ "object-curly-newline": "off", // eslint-config-prettier
686
+ "object-curly-spacing": "off", // eslint-config-prettier
687
+ "object-property-newline": "off", // eslint-config-prettier
688
+ "operator-linebreak": "off", // eslint-config-prettier
689
+ "padded-blocks": "off", // eslint-config-prettier
690
+
691
+ /** Superseded by the `@typescript-eslint/padding-line-between-statements` rule. */
692
+ "padding-line-between-statements": "off",
693
+
694
+ quotes: "off", // eslint-config-prettier
695
+ "rest-spread-spacing": "off", // eslint-config-prettier
696
+ semi: "off", // eslint-config-prettier
697
+ "semi-spacing": "off", // eslint-config-prettier
698
+ "semi-style": "off", // eslint-config-prettier
699
+ "space-before-blocks": "off", // eslint-config-prettier
700
+ "space-before-function-paren": "off", // eslint-config-prettier
701
+ "space-in-parens": "off", // eslint-config-prettier
702
+ "space-infix-ops": "off", // eslint-config-prettier
703
+ "space-unary-ops": "off", // eslint-config-prettier
704
+ "switch-colon-spacing": "off", // eslint-config-prettier
705
+ "template-curly-spacing": "off", // eslint-config-prettier
706
+ "template-tag-spacing": "off", // eslint-config-prettier
707
+ "unicode-bom": "off", // eslint-config-prettier
708
+ "wrap-iife": "off", // eslint-config-prettier
709
+ "wrap-regex": "off", // eslint-config-prettier
710
+ "yield-star-spacing": "off", // eslint-config-prettier
711
+ };
274
712
 
275
- /**
276
- * Documentation: https://eslint.org/docs/latest/rules/class-methods-use-this
277
- *
278
- * Defined at:
279
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
280
- */
281
- // class-methods-use-this
713
+ /** @type {import("eslint").Linter.Config} */
714
+ const config = {
715
+ rules: {
716
+ ...POSSIBLE_PROBLEMS,
717
+ ...SUGGESTIONS,
718
+ ...LAYOUT_AND_FORMATTING,
282
719
  },
283
720
  };
284
721