eslint-config-isaacscript 2.0.0 → 3.0.2

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // This is a shared configuration file for ESLint:
2
- // https://eslint.org/docs/user-guide/configuring
2
+ // https://eslint.org/docs/latest/user-guide/configuring
3
3
  module.exports = {
4
4
  extends: [
5
5
  /**
@@ -20,15 +20,17 @@ module.exports = {
20
20
  "airbnb-typescript/base",
21
21
 
22
22
  /**
23
- * We extend the Airbnb rules with the "recommended" and "recommended-requiring-type-checking"
24
- * rules from the "typescript-eslint" plugin, which is also recommended by Matt Turnbull, the
25
- * author of "airbnb-typescript/base":
23
+ * We extend the Airbnb rules with the "recommended", "recommended-requiring-type-checking", and
24
+ * "strict" rules from the "typescript-eslint" plugin, which is also recommended by Matt
25
+ * Turnbull, the author of "airbnb-typescript/base":
26
26
  * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/README.md#recommended
27
27
  * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.ts
28
28
  * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts
29
+ * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
29
30
  */
30
31
  "plugin:@typescript-eslint/recommended",
31
32
  "plugin:@typescript-eslint/recommended-requiring-type-checking",
33
+ "plugin:@typescript-eslint/strict",
32
34
 
33
35
  /**
34
36
  * This provides extra miscellaneous rules to keep code safe:
@@ -73,7 +75,7 @@ module.exports = {
73
75
  rules: {
74
76
  /**
75
77
  * Documentation:
76
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/array-type.md
78
+ * https://typescript-eslint.io/rules/array-type
77
79
  *
78
80
  * Not defined in the parent configs.
79
81
  *
@@ -88,7 +90,7 @@ module.exports = {
88
90
 
89
91
  /**
90
92
  * Documentation:
91
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md
93
+ * https://typescript-eslint.io/rules/explicit-module-boundary-types
92
94
  *
93
95
  * Not defined in the parent configs.
94
96
  *
@@ -99,7 +101,7 @@ module.exports = {
99
101
 
100
102
  /**
101
103
  * Documentation:
102
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/lines-between-class-members.md
104
+ * https://typescript-eslint.io/rules/lines-between-class-members
103
105
  *
104
106
  * Defined at:
105
107
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
@@ -117,7 +119,7 @@ module.exports = {
117
119
 
118
120
  /**
119
121
  * Documentation:
120
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/naming-convention.md
122
+ * https://typescript-eslint.io/rules/naming-convention
121
123
  *
122
124
  * Defined at:
123
125
  * https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
@@ -151,7 +153,7 @@ module.exports = {
151
153
 
152
154
  /**
153
155
  * Documentation:
154
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md
156
+ * https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
155
157
  *
156
158
  * Not defined in the parent configs.
157
159
  *
@@ -161,7 +163,7 @@ module.exports = {
161
163
 
162
164
  /**
163
165
  * Documentation:
164
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unused-vars.md
166
+ * https://typescript-eslint.io/rules/no-unused-vars
165
167
  *
166
168
  * Defined at:
167
169
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js
@@ -181,7 +183,7 @@ module.exports = {
181
183
 
182
184
  /**
183
185
  * Documentation:
184
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-use-before-define.md
186
+ * https://typescript-eslint.io/rules/no-use-before-define
185
187
  *
186
188
  * Defined at:
187
189
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js
@@ -192,7 +194,20 @@ module.exports = {
192
194
 
193
195
  /**
194
196
  * Documentation:
195
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/quotes.md
197
+ * https://typescript-eslint.io/rules/prefer-optional-chain
198
+ *
199
+ * Defined at:
200
+ * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
201
+ *
202
+ * This can modify the type of boolean declarations to "boolean | undefined", which is undesired
203
+ * in some circumstances:
204
+ * https://github.com/typescript-eslint/typescript-eslint/issues/5269
205
+ */
206
+ "@typescript-eslint/prefer-optional-chain": "off",
207
+
208
+ /**
209
+ * Documentation:
210
+ * https://typescript-eslint.io/rules/quotes
196
211
  *
197
212
  * Defined at:
198
213
  * https://github.com/prettier/eslint-config-prettier/blob/main/%40typescript-eslint.js
@@ -212,7 +227,7 @@ module.exports = {
212
227
 
213
228
  /**
214
229
  * Documentation:
215
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/restrict-template-expressions.md
230
+ * https://typescript-eslint.io/rules/restrict-template-expressions
216
231
  *
217
232
  * Defined at:
218
233
  * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts
@@ -224,7 +239,7 @@ module.exports = {
224
239
 
225
240
  /**
226
241
  * Documentation:
227
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/restrict-template-expressions.md
242
+ * https://typescript-eslint.io/rules/strict-boolean-expressions
228
243
  *
229
244
  * Not defined in the parent configs.
230
245
  *
@@ -243,18 +258,58 @@ module.exports = {
243
258
  },
244
259
  ],
245
260
 
261
+ /**
262
+ * Documentation:
263
+ * https://typescript-eslint.io/rules/switch-exhaustiveness-check/
264
+ *
265
+ * Not defined in the parent configs.
266
+ *
267
+ * This rule ensures type-safety with switch statements, which can be especially helpful when
268
+ * values are added or removed from an enum.
269
+ */
270
+ "@typescript-eslint/switch-exhaustiveness-check": "warn",
271
+
272
+ /**
273
+ * Documentation:
274
+ * https://eslint.org/docs/latest/rules/consistent-return
275
+ *
276
+ * Defined at:
277
+ * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
278
+ *
279
+ * We prefer the "noImplicitReturns" compiler flag over the "consistent-return" ESLint rule,
280
+ * since it is type-aware:
281
+ * https://github.com/typescript-eslint/typescript-eslint/issues/5254
282
+ */
283
+ "consistent-return": ["off"],
284
+
246
285
  /**
247
286
  * Documentation:
248
287
  * https://eslint.org/docs/latest/rules/curly
249
288
  *
250
- * Defined at: ?
289
+ * Defined at:
290
+ * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
251
291
  *
252
292
  * Always requiring curly braces can partially ward against Apple-style if statement bugs:
253
293
  * https://www.imperialviolet.org/2014/02/22/applebug.html
254
- * ?
294
+ *
295
+ * Additionally, this rule needs to be set to "all" to work properly with
296
+ * `eslint-prettier-config`:
297
+ * https://github.com/prettier/eslint-config-prettier#curly
255
298
  */
256
299
  curly: ["warn", "all"],
257
300
 
301
+ /**
302
+ * Documentation:
303
+ * https://eslint.org/docs/latest/rules/default-case
304
+ *
305
+ * Defined at:
306
+ * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
307
+ *
308
+ * This rule is generally bad to have on in TypeScript projects:
309
+ * https://github.com/typescript-eslint/typescript-eslint/issues/5254
310
+ */
311
+ "default-case": "off",
312
+
258
313
  /**
259
314
  * Documentation:
260
315
  * https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/docs/rules/disable-enable-pair.md
@@ -308,7 +363,7 @@ module.exports = {
308
363
 
309
364
  /**
310
365
  * Documentation:
311
- * https://eslint.org/docs/rules/no-console
366
+ * https://eslint.org/docs/latest/rules/no-console
312
367
  *
313
368
  * Defined at:
314
369
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js
@@ -330,7 +385,7 @@ module.exports = {
330
385
 
331
386
  /**
332
387
  * Documentation:
333
- * https://eslint.org/docs/rules/no-continue
388
+ * https://eslint.org/docs/latest/rules/no-continue
334
389
  *
335
390
  * Defined at:
336
391
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
@@ -341,24 +396,19 @@ module.exports = {
341
396
 
342
397
  /**
343
398
  * Documentation:
344
- * https://eslint.org/docs/rules/no-plusplus
399
+ * https://eslint.org/docs/latest/rules/no-plusplus
345
400
  *
346
401
  * Defined at:
347
402
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
348
403
  *
349
- * Airbnb disallows these because it can lead to errors with minified code. We don't have to
350
- * worry about this in for loops though.
404
+ * Airbnb disallows these because it can lead to errors with minified code. When using Prettier,
405
+ * it adds semi-colons everywhere, so we don't have to worry about this.
351
406
  */
352
- "no-plusplus": [
353
- "warn",
354
- {
355
- allowForLoopAfterthoughts: true,
356
- },
357
- ],
407
+ "no-plusplus": "off",
358
408
 
359
409
  /**
360
410
  * Documentation:
361
- * https://eslint.org/docs/rules/no-restricted-syntax
411
+ * https://eslint.org/docs/latest/rules/no-restricted-syntax
362
412
  *
363
413
  * Defined at:
364
414
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
@@ -392,7 +442,7 @@ module.exports = {
392
442
 
393
443
  /**
394
444
  * Documentation:
395
- * https://eslint.org/docs/rules/prefer-destructuring
445
+ * https://eslint.org/docs/latest/rules/prefer-destructuring
396
446
  *
397
447
  * Defined at:
398
448
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/es6.js
package/jsdoc.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // This is a shared configuration file for ESLint:
2
- // https://eslint.org/docs/user-guide/configuring
2
+ // https://eslint.org/docs/latest/user-guide/configuring
3
3
  module.exports = {
4
4
  plugins: [
5
5
  /**
package/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // This is a shared configuration file for ESLint:
2
- // https://eslint.org/docs/user-guide/configuring
2
+ // https://eslint.org/docs/latest/user-guide/configuring
3
3
  module.exports = {
4
4
  extends: [
5
5
  /**
@@ -12,7 +12,7 @@ module.exports = {
12
12
  rules: {
13
13
  /**
14
14
  * Documentation:
15
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/naming-convention.md
15
+ * https://typescript-eslint.io/rules/naming-convention
16
16
  *
17
17
  * Defined at:
18
18
  * https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
@@ -54,7 +54,41 @@ module.exports = {
54
54
 
55
55
  /**
56
56
  * Documentation:
57
- * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-loop-func.md
57
+ * https://typescript-eslint.io/rules/no-base-to-string/
58
+ *
59
+ * Defined at:
60
+ * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
61
+ *
62
+ * The `Vector` object has a `tostring` meta-method, so it can be properly printed without
63
+ * explicitly specifying the X and Y values.
64
+ */
65
+ "@typescript-eslint/no-base-to-string": [
66
+ "warn",
67
+ {
68
+ ignoredTypeNames: ["Vector"],
69
+ },
70
+ ],
71
+
72
+ /**
73
+ * Documentation:
74
+ * https://typescript-eslint.io/rules/no-invalid-void-type
75
+ *
76
+ * Defined at:
77
+ * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
78
+ *
79
+ * TSTL has special behavior with respect to "this: void", so we need to configure this rule to
80
+ * allow the "this" parameter.
81
+ */
82
+ "@typescript-eslint/no-invalid-void-type": [
83
+ "warn",
84
+ {
85
+ allowAsThisParameter: true,
86
+ },
87
+ ],
88
+
89
+ /**
90
+ * Documentation:
91
+ * https://typescript-eslint.io/rules/no-loop-func
58
92
  *
59
93
  * Defined at:
60
94
  * https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
@@ -87,7 +121,7 @@ module.exports = {
87
121
 
88
122
  /**
89
123
  * Documentation:
90
- * https://github.com/eslint/eslint/blob/master/docs/rules/no-bitwise.md
124
+ * https://eslint.org/docs/latest/rules/no-bitwise
91
125
  *
92
126
  * Defined at:
93
127
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
@@ -98,7 +132,7 @@ module.exports = {
98
132
 
99
133
  /**
100
134
  * Documentation:
101
- * https://eslint.org/docs/rules/no-param-reassign
135
+ * https://eslint.org/docs/latest/rules/no-param-reassign
102
136
  *
103
137
  * Defined at:
104
138
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
@@ -109,7 +143,7 @@ module.exports = {
109
143
 
110
144
  /**
111
145
  * Documentation:
112
- * https://eslint.org/docs/rules/no-restricted-globals
146
+ * https://eslint.org/docs/latest/rules/no-restricted-globals
113
147
  *
114
148
  * Defined at:
115
149
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js
@@ -120,7 +154,7 @@ module.exports = {
120
154
 
121
155
  /**
122
156
  * Documentation:
123
- * https://eslint.org/docs/rules/no-underscore-dangle
157
+ * https://eslint.org/docs/latest/rules/no-underscore-dangle
124
158
  *
125
159
  * Defined at:
126
160
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
package/monorepo.js CHANGED
@@ -3,7 +3,7 @@ const path = require("path"); // eslint-disable-line @typescript-eslint/no-var-r
3
3
  const REPO_ROOT = path.join(__dirname, "..", "..");
4
4
 
5
5
  // This is a shared configuration file for ESLint:
6
- // https://eslint.org/docs/user-guide/configuring
6
+ // https://eslint.org/docs/latest/user-guide/configuring
7
7
  module.exports = {
8
8
  plugins: ["@nrwl/nx"],
9
9
 
@@ -12,8 +12,7 @@ module.exports = {
12
12
  parserOptions: {
13
13
  ecmaVersion: 2020,
14
14
  sourceType: "module",
15
- /* eslint-disable-next-line isaacscript/complete-sentences-line-comments */
16
- // This cannot be simplified to "./../.." because of relative path shenanigans.
15
+ // This cannot be simplified to `./../..` because of relative path shenanigans.
17
16
  tsconfigRootDir: REPO_ROOT,
18
17
  },
19
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-isaacscript",
3
- "version": "2.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "A sharable ESLint config for TypeScript and IsaacScript projects.",
5
5
  "keywords": [
6
6
  "eslint",