eslint-config-isaacscript 1.3.0 → 3.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.
Files changed (4) hide show
  1. package/base.js +96 -18
  2. package/jsdoc.js +4 -3
  3. package/mod.js +25 -8
  4. package/package.json +1 -1
package/base.js CHANGED
@@ -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,6 +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
+
285
+ /**
286
+ * Documentation:
287
+ * https://eslint.org/docs/latest/rules/curly
288
+ *
289
+ * Defined at:
290
+ * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
291
+ *
292
+ * Always requiring curly braces can partially ward against Apple-style if statement bugs:
293
+ * https://www.imperialviolet.org/2014/02/22/applebug.html
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
298
+ */
299
+ curly: ["warn", "all"],
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
+
246
313
  /**
247
314
  * Documentation:
248
315
  * https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/docs/rules/disable-enable-pair.md
@@ -296,7 +363,7 @@ module.exports = {
296
363
 
297
364
  /**
298
365
  * Documentation:
299
- * https://eslint.org/docs/rules/no-console
366
+ * https://eslint.org/docs/latest/rules/no-console
300
367
  *
301
368
  * Defined at:
302
369
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js
@@ -307,7 +374,18 @@ module.exports = {
307
374
 
308
375
  /**
309
376
  * Documentation:
310
- * https://eslint.org/docs/rules/no-continue
377
+ * https://eslint.org/docs/latest/rules/no-constant-binary-expression
378
+ *
379
+ * Not defined in parent configs.
380
+ *
381
+ * This rule was released in 2022 and is known to catch many subtle bugs:
382
+ * https://github.com/eslint/eslint.org/pull/240/files
383
+ */
384
+ "no-constant-binary-expression": "warn",
385
+
386
+ /**
387
+ * Documentation:
388
+ * https://eslint.org/docs/latest/rules/no-continue
311
389
  *
312
390
  * Defined at:
313
391
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
@@ -318,7 +396,7 @@ module.exports = {
318
396
 
319
397
  /**
320
398
  * Documentation:
321
- * https://eslint.org/docs/rules/no-plusplus
399
+ * https://eslint.org/docs/latest/rules/no-plusplus
322
400
  *
323
401
  * Defined at:
324
402
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
@@ -335,7 +413,7 @@ module.exports = {
335
413
 
336
414
  /**
337
415
  * Documentation:
338
- * https://eslint.org/docs/rules/no-restricted-syntax
416
+ * https://eslint.org/docs/latest/rules/no-restricted-syntax
339
417
  *
340
418
  * Defined at:
341
419
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
@@ -369,7 +447,7 @@ module.exports = {
369
447
 
370
448
  /**
371
449
  * Documentation:
372
- * https://eslint.org/docs/rules/prefer-destructuring
450
+ * https://eslint.org/docs/latest/rules/prefer-destructuring
373
451
  *
374
452
  * Defined at:
375
453
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/es6.js
package/jsdoc.js CHANGED
@@ -47,16 +47,17 @@ module.exports = {
47
47
  "warn",
48
48
  {
49
49
  definedTags: [
50
- // Used by the TypeScript compiler:
50
+ // Ignore tags used by the TypeScript compiler:
51
51
  // https://www.typescriptlang.org/tsconfig#stripInternal
52
52
  "internal", // Used by TypeScript
53
53
 
54
- // Add tags used in TypeDoc:
54
+ // Ignore tags used in TypeDoc:
55
55
  // https://typedoc.org/guides/doccomments/
56
56
  "category",
57
57
  "hidden",
58
+ "notExported",
58
59
 
59
- // Add tags used in TypeScriptToLua:
60
+ // Ignore tags used in TypeScriptToLua:
60
61
  // https://typescripttolua.github.io/docs/advanced/compiler-annotations
61
62
  "noResolution",
62
63
  "noSelf",
package/mod.js CHANGED
@@ -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,24 @@ 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-invalid-void-type
58
+ *
59
+ * Defined at:
60
+ * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
61
+ *
62
+ * TSTL has special behavior with respect to "this: void", so we need to configure this rule to
63
+ * allow the "this" parameter.
64
+ */
65
+ "@typescript-eslint/no-invalid-void-type": [
66
+ "warn",
67
+ {
68
+ allowAsThisParameter: true,
69
+ },
70
+ ],
71
+
72
+ /**
73
+ * Documentation:
74
+ * https://typescript-eslint.io/rules/no-loop-func
58
75
  *
59
76
  * Defined at:
60
77
  * https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
@@ -67,7 +84,7 @@ module.exports = {
67
84
 
68
85
  /**
69
86
  * Documentation:
70
- * https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-plugin-isaacscript/main/docs/rules/enum-member-number-separation.md
87
+ * https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-plugin-isaacscript/docs/rules/enum-member-number-separation.md
71
88
  *
72
89
  * Not defined in the parent configs.
73
90
  *
@@ -77,7 +94,7 @@ module.exports = {
77
94
 
78
95
  /**
79
96
  * Documentation:
80
- * https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-plugin-isaacscript/main/docs/rules/no-invalid-default-map.md
97
+ * https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-plugin-isaacscript/docs/rules/no-invalid-default-map.md
81
98
  *
82
99
  * Not defined in the parent configs.
83
100
  *
@@ -87,7 +104,7 @@ module.exports = {
87
104
 
88
105
  /**
89
106
  * Documentation:
90
- * https://github.com/eslint/eslint/blob/master/docs/rules/no-bitwise.md
107
+ * https://eslint.org/docs/latest/rules/no-bitwise
91
108
  *
92
109
  * Defined at:
93
110
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
@@ -98,7 +115,7 @@ module.exports = {
98
115
 
99
116
  /**
100
117
  * Documentation:
101
- * https://eslint.org/docs/rules/no-param-reassign
118
+ * https://eslint.org/docs/latest/rules/no-param-reassign
102
119
  *
103
120
  * Defined at:
104
121
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
@@ -109,7 +126,7 @@ module.exports = {
109
126
 
110
127
  /**
111
128
  * Documentation:
112
- * https://eslint.org/docs/rules/no-restricted-globals
129
+ * https://eslint.org/docs/latest/rules/no-restricted-globals
113
130
  *
114
131
  * Defined at:
115
132
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js
@@ -120,7 +137,7 @@ module.exports = {
120
137
 
121
138
  /**
122
139
  * Documentation:
123
- * https://eslint.org/docs/rules/no-underscore-dangle
140
+ * https://eslint.org/docs/latest/rules/no-underscore-dangle
124
141
  *
125
142
  * Defined at:
126
143
  * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-isaacscript",
3
- "version": "1.3.0",
3
+ "version": "3.0.0",
4
4
  "description": "A sharable ESLint config for TypeScript and IsaacScript projects.",
5
5
  "keywords": [
6
6
  "eslint",