eslint-config-isaacscript 3.7.2 → 4.0.1

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.
@@ -1,239 +1,376 @@
1
- /**
2
- * This config only contains rules from `@typescript-eslint` plugin.
3
- *
4
- * @type {import("eslint").Linter.Config}
5
- */
6
- const config = {
7
- /** This plugin has three separate configs that are recommended to extend from. */
8
- extends: [
9
- // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.ts
10
- "plugin:@typescript-eslint/recommended",
1
+ // This ESLint config only contains rules from `@typescript-eslint/eslint-plugin`:
2
+ // https://typescript-eslint.io/rules/
3
+
4
+ // Rules are separated into categories:
5
+ // 1) Supported Rules
6
+ // 2) Extension Rules
11
7
 
12
- // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts
13
- "plugin:@typescript-eslint/recommended-requiring-type-checking",
8
+ /** @type {import("eslint").Linter.RulesRecord} */
9
+ const SUPPORTED_RULES = {
10
+ "@typescript-eslint/adjacent-overload-signatures": "error",
14
11
 
15
- // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
16
- "plugin:@typescript-eslint/strict",
12
+ /**
13
+ * The default value is `array`. We choose `array-simple` because it makes complicated arrays
14
+ * easier to understand. This is worth the cost of deviating from the base rule configuration.
15
+ */
16
+ "@typescript-eslint/array-type": [
17
+ "error",
18
+ {
19
+ default: "array-simple",
20
+ },
17
21
  ],
18
22
 
19
- rules: {
20
- /**
21
- * Documentation:
22
- * https://typescript-eslint.io/rules/array-type
23
- *
24
- * Not defined in the parent configs.
25
- *
26
- * Prefer the "string[]" syntax over "Array<string>".
27
- */
28
- "@typescript-eslint/array-type": [
29
- "warn",
30
- {
31
- default: "array-simple",
32
- },
33
- ],
34
-
35
- /**
36
- * Documentation:
37
- * https://typescript-eslint.io/rules/explicit-module-boundary-types
38
- *
39
- * Not defined in the parent configs.
40
- *
41
- * Specifying explicit return types can help prevent bugs, but only require it on exported
42
- * functions.
43
- */
44
- "@typescript-eslint/explicit-module-boundary-types": "warn",
45
-
46
- /**
47
- * Documentation:
48
- * https://typescript-eslint.io/rules/lines-between-class-members
49
- *
50
- * Defined at:
51
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
52
- *
53
- * Airbnb has "exceptAfterSingleLine" turned off by default. A list of single-line variable
54
- * declarations at the top of a class is common in TypeScript.
55
- */
56
- "@typescript-eslint/lines-between-class-members": [
57
- "warn",
58
- "always",
59
- {
60
- exceptAfterSingleLine: true,
61
- },
62
- ],
63
-
64
- /**
65
- * Documentation:
66
- * https://typescript-eslint.io/rules/naming-convention
67
- *
68
- * Defined at:
69
- * https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
70
- *
71
- * Modify the Airbnb config to allow for a leading underscore, which signifies that it is
72
- * temporarily not being used.
73
- */
74
- "@typescript-eslint/naming-convention": [
75
- "warn",
76
- // Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables
77
- // (23.10).
78
- {
79
- selector: "variable",
80
- format: ["camelCase", "PascalCase", "UPPER_CASE"],
81
- leadingUnderscore: "allow",
82
- },
83
- // Allow camelCase functions (23.2), and PascalCase functions (23.8).
84
- {
85
- selector: "function",
86
- format: ["camelCase", "PascalCase"],
87
- leadingUnderscore: "allow",
88
- },
89
- // Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make
90
- // TypeScript recommendations, we are assuming this rule would similarly apply to anything
91
- // "type like", including interfaces, type aliases, and enums.
92
- {
93
- selector: "typeLike",
94
- format: ["PascalCase"],
95
- },
96
- ],
97
-
98
- /**
99
- * Documentation:
100
- * https://typescript-eslint.io/rules/no-confusing-void-expression
101
- *
102
- * Not defined in the parent configs.
103
- *
104
- * This prevents assigning void to variables, which is almost certainly a bug.
105
- */
106
- "@typescript-eslint/no-confusing-void-expression": "warn",
107
-
108
- /**
109
- * Documentation:
110
- * https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
111
- *
112
- * Not defined in the parent configs.
113
- *
114
- * This prevents useless code after refactoring variables to pure booleans.
115
- */
116
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
117
-
118
- /**
119
- * Documentation:
120
- * https://typescript-eslint.io/rules/no-unused-vars
121
- *
122
- * Defined at:
123
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js
124
- *
125
- * We want to lint unused arguments (the default is "after-used"). We also want to ignore
126
- * arguments/variables that start with an underscore. This matches the behavior of the
127
- * TypeScript compiler flag "--noUnusedLocals".
128
- */
129
- "@typescript-eslint/no-unused-vars": [
130
- "warn",
131
- {
132
- args: "all",
133
- argsIgnorePattern: "^_",
134
- varsIgnorePattern: "^_",
135
- },
136
- ],
137
-
138
- /**
139
- * Documentation:
140
- * https://typescript-eslint.io/rules/no-use-before-define
141
- *
142
- * Defined at:
143
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js
144
- *
145
- * This allows code to be structured in a more logical order.
146
- */
147
- "@typescript-eslint/no-use-before-define": "off",
148
-
149
- /**
150
- * Documentation:
151
- * https://typescript-eslint.io/rules/prefer-optional-chain
152
- *
153
- * Defined at:
154
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
155
- *
156
- * This can modify the type of boolean declarations to `boolean | undefined`, which is undesired
157
- * in some circumstances:
158
- * https://github.com/typescript-eslint/typescript-eslint/issues/5269
159
- */
160
- "@typescript-eslint/prefer-optional-chain": "off",
161
-
162
- /**
163
- * Documentation:
164
- * https://typescript-eslint.io/rules/quotes
165
- *
166
- * Defined at:
167
- * https://github.com/prettier/eslint-config-prettier/blob/main/%40typescript-eslint.js
168
- *
169
- * In order to forbid unnecessary backticks, we must re-enable the "@typescript-eslint/quotes"
170
- * rule as specified in the eslint-config-prettier documentation:
171
- * https://github.com/prettier/eslint-config-prettier#enforce-backticks
172
- */
173
- "@typescript-eslint/quotes": [
174
- "warn",
175
- "double",
176
- {
177
- avoidEscape: true,
178
- allowTemplateLiterals: false,
179
- },
180
- ],
181
-
182
- // This is part of the recommended config, but we turn it off because of this issue:
183
- // https://github.com/typescript-eslint/typescript-eslint/issues/7067
184
- "@typescript-eslint/no-unsafe-enum-comparison": "off",
185
-
186
- /**
187
- * Documentation:
188
- * https://typescript-eslint.io/rules/restrict-template-expressions
189
- *
190
- * Defined at:
191
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts
192
- *
193
- * This rule disallows booleans and nulls in template expressions. However, a common use-case of
194
- * template strings is to coerce everything to a string.
195
- */
196
- "@typescript-eslint/restrict-template-expressions": "off",
197
-
198
- /**
199
- * Documentation:
200
- * https://typescript-eslint.io/rules/strict-boolean-expressions
201
- *
202
- * Not defined in the parent configs.
203
- *
204
- * This rule prevents bugs when refactoring a boolean to a number.
205
- */
206
- "@typescript-eslint/strict-boolean-expressions": [
207
- "warn",
208
- {
209
- allowString: false,
210
- allowNumber: false,
211
- allowNullableObject: false,
212
- allowNullableBoolean: false,
213
- allowNullableString: false,
214
- allowNullableNumber: false,
215
- allowAny: false,
23
+ "@typescript-eslint/await-thenable": "error",
24
+ "@typescript-eslint/ban-ts-comment": "error",
25
+ "@typescript-eslint/ban-tslint-comment": "error",
26
+ "@typescript-eslint/ban-types": "error",
27
+ "@typescript-eslint/class-literal-property-style": "error",
28
+ "@typescript-eslint/consistent-generic-constructors": "error",
29
+ "@typescript-eslint/consistent-indexed-object-style": "error",
30
+ "@typescript-eslint/consistent-type-assertions": "error",
31
+ "@typescript-eslint/consistent-type-definitions": "error",
32
+ "@typescript-eslint/consistent-type-exports": "error",
33
+ "@typescript-eslint/consistent-type-imports": "error",
34
+
35
+ /**
36
+ * Disabled since it would be to cumbersome to require return types for non-exported functions.
37
+ * (It is more reasonable to require it for exported functions only, since it speeds up the
38
+ * type-checker in large codebases.)
39
+ */
40
+ "@typescript-eslint/explicit-function-return-type": "off",
41
+
42
+ /**
43
+ * Disabled since many programs may have internal-only classes that would not benefit from an
44
+ * explicit public/private distinction.
45
+ */
46
+ "@typescript-eslint/explicit-member-accessibility": "off",
47
+
48
+ "@typescript-eslint/explicit-module-boundary-types": "error",
49
+ "@typescript-eslint/member-delimiter-style": "off", // eslint-config-prettier
50
+
51
+ /** Disabled since prescribed class ordering is too project-specific. */
52
+ "@typescript-eslint/member-ordering": "off",
53
+
54
+ "@typescript-eslint/method-signature-style": "error",
55
+
56
+ /**
57
+ * The options are [copied from
58
+ * Airbnb](https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js).
59
+ * We also allow a leading underscore, which signifies that the element is temporarily not being
60
+ * used.
61
+ */
62
+ "@typescript-eslint/naming-convention": [
63
+ "error",
64
+ // Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables
65
+ // (23.10).
66
+ {
67
+ selector: "variable",
68
+ format: ["camelCase", "PascalCase", "UPPER_CASE"],
69
+ leadingUnderscore: "allow",
70
+
71
+ // Polyfilling "__dirname" in ESM files is a common pattern.
72
+ filter: {
73
+ regex: "^__dirname$",
74
+ match: false,
216
75
  },
217
- ],
218
-
219
- /**
220
- * Documentation:
221
- * https://typescript-eslint.io/rules/switch-exhaustiveness-check/
222
- *
223
- * Not defined in the parent configs.
224
- *
225
- * This rule ensures type-safety with switch statements, which can be especially helpful when
226
- * values are added or removed from an enum.
227
- */
228
- "@typescript-eslint/switch-exhaustiveness-check": "warn",
76
+ },
77
+ // Allow camelCase functions (23.2), and PascalCase functions (23.8).
78
+ {
79
+ selector: "function",
80
+ format: ["camelCase", "PascalCase"],
81
+ leadingUnderscore: "allow",
82
+ },
83
+ // Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make TypeScript
84
+ // recommendations, we are assuming this rule would similarly apply to anything "type like",
85
+ // including interfaces, type aliases, and enums.
86
+ {
87
+ selector: "typeLike",
88
+ format: ["PascalCase"],
89
+ leadingUnderscore: "allow",
90
+ },
91
+ ],
92
+
93
+ "@typescript-eslint/no-base-to-string": "error",
94
+ "@typescript-eslint/no-confusing-non-null-assertion": "error",
95
+ "@typescript-eslint/no-confusing-void-expression": "error",
96
+ "@typescript-eslint/no-duplicate-enum-values": "error",
97
+ "@typescript-eslint/no-duplicate-type-constituents": "error",
98
+ "@typescript-eslint/no-dynamic-delete": "error",
99
+ "@typescript-eslint/no-empty-interface": "error",
100
+ "@typescript-eslint/no-explicit-any": "error",
101
+ "@typescript-eslint/no-extra-non-null-assertion": "error",
102
+ "@typescript-eslint/no-extraneous-class": "error",
103
+ "@typescript-eslint/no-floating-promises": "error",
104
+ "@typescript-eslint/no-for-in-array": "error",
105
+ "@typescript-eslint/no-import-type-side-effects": "error",
106
+ "@typescript-eslint/no-inferrable-types": "error",
107
+ "@typescript-eslint/no-invalid-void-type": "error",
108
+ "@typescript-eslint/no-meaningless-void-operator": "error",
109
+ "@typescript-eslint/no-misused-new": "error",
110
+ "@typescript-eslint/no-misused-promises": "error",
111
+ "@typescript-eslint/no-mixed-enums": "error",
112
+ "@typescript-eslint/no-namespace": "error",
113
+ "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
114
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
115
+ "@typescript-eslint/no-non-null-assertion": "error",
116
+ "@typescript-eslint/no-redundant-type-constituents": "error",
117
+ "@typescript-eslint/no-require-imports": "error",
118
+ "@typescript-eslint/no-this-alias": "error",
119
+
120
+ /** Disabled because this rule is deprecated. */
121
+ "@typescript-eslint/no-type-alias": "off",
122
+
123
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
124
+ "@typescript-eslint/no-unnecessary-condition": "error",
125
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
126
+ "@typescript-eslint/no-unnecessary-type-arguments": "error",
127
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
128
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
129
+ "@typescript-eslint/no-unsafe-argument": "error",
130
+ "@typescript-eslint/no-unsafe-assignment": "error",
131
+ "@typescript-eslint/no-unsafe-call": "error",
132
+ "@typescript-eslint/no-unsafe-declaration-merging": "error",
133
+ "@typescript-eslint/no-unsafe-enum-comparison": "error",
134
+ "@typescript-eslint/no-unsafe-member-access": "error",
135
+ "@typescript-eslint/no-unsafe-return": "error",
136
+ "@typescript-eslint/no-useless-empty-export": "error",
137
+ "@typescript-eslint/no-var-requires": "error",
138
+ "@typescript-eslint/non-nullable-type-assertion-style": "error",
139
+ "@typescript-eslint/parameter-properties": "error",
140
+ "@typescript-eslint/prefer-as-const": "error",
141
+ "@typescript-eslint/prefer-enum-initializers": "error",
142
+ "@typescript-eslint/prefer-for-of": "error",
143
+ "@typescript-eslint/prefer-function-type": "error",
144
+ "@typescript-eslint/prefer-includes": "error",
145
+ "@typescript-eslint/prefer-literal-enum-member": "error",
146
+ "@typescript-eslint/prefer-namespace-keyword": "error",
147
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
148
+
149
+ /**
150
+ * Disabled because it can modify the type of `boolean` declarations, which is [undesired in some
151
+ * circumstances](https://github.com/typescript-eslint/typescript-eslint/issues/5269).
152
+ */
153
+ "@typescript-eslint/prefer-optional-chain": "off",
154
+
155
+ "@typescript-eslint/prefer-readonly": "error",
156
+
157
+ /** Disabled since it can obfuscate the intended input types of a function. */
158
+ "@typescript-eslint/prefer-readonly-parameter-types": "off",
159
+
160
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
161
+
162
+ /** Disabled since using the `String.match` form might make code easier to read. */
163
+ "@typescript-eslint/prefer-regexp-exec": "off",
164
+
165
+ "@typescript-eslint/prefer-return-this-type": "error",
166
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
167
+ "@typescript-eslint/prefer-ts-expect-error": "error",
168
+ "@typescript-eslint/promise-function-async": "error",
169
+ "@typescript-eslint/require-array-sort-compare": "error",
170
+ "@typescript-eslint/restrict-plus-operands": "error",
171
+
172
+ /** Disabled since a common use-case of template strings is to coerce everything to a string. */
173
+ "@typescript-eslint/restrict-template-expressions": "off",
174
+
175
+ /** Disabled since in it does not make sense to sort a union alphabetically in many cases. */
176
+ "@typescript-eslint/sort-type-constituents": "off",
177
+
178
+ "@typescript-eslint/strict-boolean-expressions": "error",
179
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
180
+ "@typescript-eslint/triple-slash-reference": "error",
181
+ "@typescript-eslint/type-annotation-spacing": "off", // eslint-config-prettier
182
+
183
+ /**
184
+ * Disabled since it is not recommended by the `typescript-eslint` team. (They recommend using the
185
+ * `noImplicitAny` and `strictPropertyInitialization` TypeScript compiler options instead.)
186
+ */
187
+ "@typescript-eslint/typedef": "off",
188
+
189
+ "@typescript-eslint/unbound-method": "error",
190
+ "@typescript-eslint/unified-signatures": "error",
191
+ };
192
+
193
+ /** @type {import("eslint").Linter.RulesRecord} */
194
+ const EXTENSION_RULES = {
195
+ "@typescript-eslint/block-spacing": "off", // eslint-config-prettier
196
+ "@typescript-eslint/brace-style": "off", // eslint-config-prettier
197
+ "@typescript-eslint/class-methods-use-this": "error",
198
+ "@typescript-eslint/comma-dangle": "off", // eslint-config-prettier
199
+ "@typescript-eslint/comma-spacing": "off", // eslint-config-prettier
200
+ "@typescript-eslint/default-param-last": "error",
201
+ "@typescript-eslint/dot-notation": "error",
202
+ "@typescript-eslint/func-call-spacing": "off", // eslint-config-prettier
203
+ "@typescript-eslint/indent": "off", // eslint-config-prettier
204
+
205
+ /**
206
+ * Disabled since it is superfluous to require an `= undefined` during variable initialization
207
+ * (and TypeScript will take care of the non-undefined cases).
208
+ */
209
+ "@typescript-eslint/init-declarations": "off",
210
+
211
+ "@typescript-eslint/key-spacing": "off", // eslint-config-prettier
212
+ "@typescript-eslint/keyword-spacing": "off", // eslint-config-prettier
213
+
214
+ /**
215
+ * Even though the `typescript-eslint` team does not recommend using formatting rules, this rule
216
+ * is not handled by Prettier, so we must use ESLint to enforce it.
217
+ */
218
+ "@typescript-eslint/lines-around-comment": [
219
+ "error",
220
+ {
221
+ // All of these properties default to false.
222
+ allowBlockStart: true,
223
+ allowObjectStart: true,
224
+ allowArrayStart: true,
225
+ allowClassStart: true,
226
+ allowEnumStart: true,
227
+ allowInterfaceStart: true,
228
+ allowModuleStart: true,
229
+ allowTypeStart: true,
230
+ },
231
+ ],
232
+
233
+ /**
234
+ * Even though the `typescript-eslint` team does not recommend using formatting rules, this rule
235
+ * is not handled by Prettier, so we must use ESLint to enforce it.
236
+ */
237
+ "@typescript-eslint/lines-between-class-members": [
238
+ "error",
239
+ "always",
240
+ {
241
+ exceptAfterSingleLine: true,
242
+ },
243
+ ],
244
+
245
+ "@typescript-eslint/no-array-constructor": "error",
246
+
247
+ /**
248
+ * Disabled since it is superfluous when using TypeScript according to [the ESLint
249
+ * documentation](https://eslint.org/docs/latest/rules/no-dupe-class-members#when-not-to-use-it).
250
+ */
251
+ "@typescript-eslint/no-dupe-class-members": "off",
252
+
253
+ "@typescript-eslint/no-empty-function": "error",
254
+ "@typescript-eslint/no-extra-parens": "off", // eslint-config-prettier
255
+ "@typescript-eslint/no-extra-semi": "off", // eslint-config-prettier
256
+ "@typescript-eslint/no-implied-eval": "error",
257
+
258
+ /** The `capIsConstructor` option is disabled to make the rule stricter. */
259
+ "@typescript-eslint/no-invalid-this": [
260
+ "error",
261
+ {
262
+ capIsConstructor: false,
263
+ },
264
+ ],
265
+
266
+ "@typescript-eslint/no-loop-func": "error",
267
+ "@typescript-eslint/no-loss-of-precision": "error",
268
+
269
+ /** Disabled since it results in too many false positives. */
270
+ "@typescript-eslint/no-magic-numbers": "off",
271
+
272
+ /**
273
+ * Disabled since it is handled by the combination of the TypeScript compiler and the `no-var`
274
+ * ESLint rule.
275
+ */
276
+ "@typescript-eslint/no-redeclare": "off",
277
+
278
+ /**
279
+ * Disabled since it would only be needed in specific environments (such as forbidding Node.js
280
+ * imports in a browser environment).
281
+ */
282
+ "@typescript-eslint/no-restricted-imports": "off",
283
+
284
+ "@typescript-eslint/no-shadow": "error",
285
+ "@typescript-eslint/no-throw-literal": "error",
286
+ "@typescript-eslint/no-unused-expressions": "error",
287
+
288
+ /**
289
+ * The `args` option is set to `all` make the rule stricter. Additionally, we ignore things that
290
+ * begin with an underscore, since this matches the behavior of the `--noUnusedLocals` TypeScript
291
+ * compiler flag.
292
+ */
293
+ "@typescript-eslint/no-unused-vars": [
294
+ "error",
295
+ {
296
+ args: "all", // "after-used" is the default.
297
+ argsIgnorePattern: "^_",
298
+ varsIgnorePattern: "^_",
299
+ },
300
+ ],
301
+
302
+ /** Disabled because it can prevent code from being structured sequentially. */
303
+ "@typescript-eslint/no-use-before-define": "off",
304
+
305
+ "@typescript-eslint/no-useless-constructor": "error",
306
+ "@typescript-eslint/object-curly-spacing": "off", // eslint-config-prettier
307
+
308
+ /**
309
+ * Disabled since it is for inserting extra newlines between specific kinds of statements, which
310
+ * would be project-dependant. (This kind of formatting is not handled by Prettier.)
311
+ */
312
+ "@typescript-eslint/padding-line-between-statements": "off",
313
+
314
+ /**
315
+ * We forbid unnecessary backticks by using the options specified in [the `eslint-config-prettier`
316
+ * documentation](https://github.com/prettier/eslint-config-prettier#enforce-backticks).
317
+ */
318
+ "@typescript-eslint/quotes": [
319
+ "error",
320
+ "double",
321
+ {
322
+ avoidEscape: true,
323
+ allowTemplateLiterals: false,
324
+ },
325
+ ],
326
+
327
+ "@typescript-eslint/require-await": "error",
328
+
329
+ /**
330
+ * Even though the core rule was deprecated, the extended rule uses type information, so it is
331
+ * much better.
332
+ */
333
+ "@typescript-eslint/return-await": "error",
334
+
335
+ "@typescript-eslint/semi": "off", // eslint-config-prettier
336
+ "@typescript-eslint/space-before-blocks": "off", // eslint-config-prettier
337
+ "@typescript-eslint/space-before-function-paren": "off", // eslint-config-prettier
338
+ "@typescript-eslint/space-infix-ops": "off", // eslint-config-prettier
339
+ };
340
+
341
+ /** @type {import("eslint").Linter.Config} */
342
+ const config = {
343
+ // We need to provide some special configuration to ESLint in order for it to parse TypeScript
344
+ // files. From:
345
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/base.ts
346
+ parser: "@typescript-eslint/parser",
347
+ parserOptions: {
348
+ sourceType: "module",
349
+
350
+ // Needed for `eslint-plugin-import` to work properly:
351
+ // https://github.com/import-js/eslint-plugin-import/blob/main/config/recommended.js
352
+ ecmaVersion: "latest",
353
+ },
354
+ plugins: ["@typescript-eslint"],
355
+
356
+ rules: {
357
+ ...SUPPORTED_RULES,
358
+ ...EXTENSION_RULES,
229
359
  },
230
360
 
231
361
  overrides: [
362
+ // We list a "blank" override for the purposes of enabling new file extensions. (ESLint adds any
363
+ // new extensions included in `overrides` to the list of linted extensions.)
364
+ {
365
+ files: ["*.ts", "*.tsx", "*.mts", "*.cts"],
366
+ },
367
+
232
368
  // Disable some TypeScript-specific rules in JavaScript files.
233
369
  {
234
370
  files: ["*.js", "*.cjs", "*.mjs", "*.jsx"],
235
371
  rules: {
236
372
  "@typescript-eslint/explicit-module-boundary-types": "off",
373
+ "@typescript-eslint/no-require-imports": "off",
237
374
  "@typescript-eslint/no-unsafe-argument": "off",
238
375
  "@typescript-eslint/no-unsafe-assignment": "off",
239
376
  "@typescript-eslint/no-unsafe-call": "off",