eslint-config-isaacscript 3.4.0 → 3.5.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,18 +1,23 @@
1
1
  // This is a shared configuration file for ESLint:
2
2
  // https://eslint.org/docs/latest/user-guide/configuring
3
3
  // This config only contains modifications to the built-in rules from the ESLint tool.
4
+ // https://eslint.org/docs/latest/rules/
4
5
  module.exports = {
5
6
  rules: {
6
- /**
7
- * Documentation:
8
- * https://eslint.org/docs/latest/rules/array-callback-return
9
- *
10
- * Defined at:
11
- * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
12
- *
13
- * Airbnb changes the default options for some reason, which makes the rule less strict.
14
- */
15
- "array-callback-return": ["warn", {}],
7
+ // -----------------
8
+ // Possible Problems
9
+ // -----------------
10
+
11
+ // https://eslint.org/docs/latest/rules/array-callback-return
12
+ // - Using "checkForEach" makes the rule stricter.
13
+ "array-callback-return": [
14
+ "warn",
15
+ {
16
+ checkForEach: true,
17
+ },
18
+ ],
19
+
20
+ // asdf
16
21
 
17
22
  /**
18
23
  * Documentation:
@@ -280,5 +285,13 @@ module.exports = {
280
285
 
281
286
  // "valid-typeof" is disabled due to conflicting with the TypeScript compiler:
282
287
  // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
288
+
289
+ /**
290
+ * Documentation: https://eslint.org/docs/latest/rules/class-methods-use-this
291
+ *
292
+ * Defined at:
293
+ * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
294
+ */
295
+ // class-methods-use-this
283
296
  },
284
297
  };
package/base-jsdoc.js CHANGED
@@ -244,4 +244,14 @@ module.exports = {
244
244
 
245
245
  // - jsdoc/valid-types - Not needed in TypeScript.
246
246
  },
247
+
248
+ overrides: [
249
+ // Disable some TypeScript-specific rules in JavaScript files.
250
+ {
251
+ files: ["*.js", "*.cjs", "*.mjs", "*.jsx"],
252
+ rules: {
253
+ "jsdoc/no-types": "off",
254
+ },
255
+ },
256
+ ],
247
257
  };
@@ -82,6 +82,16 @@ module.exports = {
82
82
  },
83
83
  ],
84
84
 
85
+ /**
86
+ * Documentation:
87
+ * https://typescript-eslint.io/rules/no-confusing-void-expression
88
+ *
89
+ * Not defined in the parent configs.
90
+ *
91
+ * This prevents assigning void to variables, which is almost certainly a bug.
92
+ */
93
+ "@typescript-eslint/no-confusing-void-expression": "warn",
94
+
85
95
  /**
86
96
  * Documentation:
87
97
  * https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
@@ -214,7 +224,6 @@ module.exports = {
214
224
  "@typescript-eslint/no-unsafe-return": "off",
215
225
  "@typescript-eslint/no-var-requires": "off",
216
226
  "@typescript-eslint/strict-boolean-expressions": "off",
217
- "isaacscript/no-object-any": "off",
218
227
  },
219
228
  },
220
229
  ],
package/base.js CHANGED
@@ -201,6 +201,16 @@ module.exports = {
201
201
  */
202
202
  "import/prefer-default-export": "off",
203
203
 
204
+ /**
205
+ * Documentation:
206
+ * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/file-extension-in-import.md
207
+ *
208
+ * Not defined in parent configs.
209
+ *
210
+ * We use this to automatically fix import statements to ESM.
211
+ */
212
+ "n/file-extension-in-import": ["error", "always"],
213
+
204
214
  /**
205
215
  * Documentation:
206
216
  * https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-import.md
@@ -297,7 +307,7 @@ module.exports = {
297
307
  "error",
298
308
  {
299
309
  convertPath: {
300
- "src/**/*.ts": ["^src/(.+?)\\.ts$", "src/$1.js"],
310
+ "src/**/*.ts": ["^src/(.+?)\\.ts$", "dist/$1.js"],
301
311
  },
302
312
  },
303
313
  ],
@@ -329,5 +339,37 @@ module.exports = {
329
339
  * Enforce the new "node:" prefix as an extra safety measure.
330
340
  */
331
341
  "unicorn/prefer-node-protocol": "warn",
342
+
343
+ // TEST
344
+ // https://github.com/typescript-eslint/typescript-eslint/issues/6446
345
+ "no-restricted-syntax": [
346
+ "error",
347
+ {
348
+ selector:
349
+ 'VariableDeclarator[id.typeAnnotation] > :matches(TSTypeAssertion, TSAsExpression) > TSTypeReference.typeAnnotation > Identifier[name="const"]',
350
+ message:
351
+ "Don't use `as const` with a type annotated variable, since it widens the type.",
352
+ },
353
+ ],
332
354
  },
355
+
356
+ overrides: [
357
+ // Disable some TypeScript-specific rules in JavaScript files.
358
+ {
359
+ files: ["*.js", "*.cjs", "*.mjs", "*.jsx"],
360
+ rules: {
361
+ "isaacscript/no-object-any": "off",
362
+ "isaacscript/require-capital-const-assertions": "off",
363
+ "isaacscript/require-capital-read-only": "off",
364
+ },
365
+ },
366
+
367
+ // Remark configs require a default export.
368
+ {
369
+ files: [".remarkrc.mjs"],
370
+ rules: {
371
+ "import/no-default-export": "off",
372
+ },
373
+ },
374
+ ],
333
375
  };
package/mod.js CHANGED
@@ -142,6 +142,16 @@ module.exports = {
142
142
  */
143
143
  "isaacscript/no-throw": "warn",
144
144
 
145
+ /**
146
+ * Documentation:
147
+ * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/file-extension-in-import.md
148
+ *
149
+ * Defined in "base.js".
150
+ *
151
+ * IsaacScript mods to not use ESM, so we must turn this rule off.
152
+ */
153
+ "n/file-extension-in-import": "off",
154
+
145
155
  /**
146
156
  * Documentation:
147
157
  * https://eslint.org/docs/latest/rules/no-bitwise
package/monorepo.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const path = require("node:path");
2
2
 
3
- const REPO_ROOT = path.join(__dirname, "..", "..");
3
+ const REPO_ROOT = path.join(__dirname, "..", "..", "..");
4
4
 
5
5
  // This is a shared configuration file for ESLint:
6
6
  // https://eslint.org/docs/latest/user-guide/configuring
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-isaacscript",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "A sharable ESLint config for TypeScript and IsaacScript projects.",
5
5
  "keywords": [
6
6
  "eslint",