eslint-config-isaacscript 4.6.0 → 4.8.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.js CHANGED
@@ -30,14 +30,14 @@ const config = {
30
30
  * Rule modifications are split out into different files for better organization (based on the
31
31
  * originating plugin) .
32
32
  */
33
- "./base-eslint",
34
- "./base-no-autofix",
35
- "./base-typescript-eslint",
36
- "./base-eslint-comments",
37
- "./base-import",
38
- "./base-jsdoc",
39
- "./base-n", // "n" stands for Node.
40
- "./base-unicorn",
33
+ "./configs/base-eslint",
34
+ "./configs/base-no-autofix",
35
+ "./configs/base-typescript-eslint",
36
+ "./configs/base-eslint-comments",
37
+ "./configs/base-import",
38
+ "./configs/base-jsdoc",
39
+ "./configs/base-n", // "n" stands for Node.
40
+ "./configs/base-unicorn",
41
41
  ],
42
42
 
43
43
  plugins: [
@@ -209,11 +209,7 @@ const SUGGESTIONS = {
209
209
 
210
210
  "max-nested-callbacks": "error",
211
211
 
212
- /**
213
- * Disabled because enforcing an arbitrary parameter number threshold for every function in a
214
- * project does not provide much value. (Additionally, using TypeScript reduces the value of such
215
- * a check.)
216
- */
212
+ /** Superseded by the `@typescript-eslint/max-params` rule. */
217
213
  "max-params": "off",
218
214
 
219
215
  /**
@@ -561,28 +557,8 @@ const SUGGESTIONS = {
561
557
  /** Superseded by the `no-autofix/prefer-const` rule (since the autofix is usually unwanted). */
562
558
  "prefer-const": "off",
563
559
 
564
- /**
565
- * Object destructuring is enforced but array destructuring is not. This matches usage in the
566
- * general TypeScript ecosystem.
567
- */
568
- "prefer-destructuring": [
569
- "error",
570
- {
571
- VariableDeclarator: {
572
- array: false,
573
- object: true,
574
- },
575
- AssignmentExpression: {
576
- array: false,
577
- object: true,
578
- },
579
- },
580
- {
581
- // We disable this for renamed properties, this this is a valid use-case.
582
- // e.g. `const collectibleUsedToShowFlight = CollectibleType.FATE;`
583
- enforceForRenamedProperties: false,
584
- },
585
- ],
560
+ /** Superseded by the `@typescript-eslint/prefer-destructuring` rule. */
561
+ "prefer-destructuring": "off",
586
562
 
587
563
  "prefer-exponentiation-operator": "error",
588
564
 
@@ -22,6 +22,8 @@ const HELPFUL_WARNINGS = {
22
22
  /**
23
23
  * The options are [copied from
24
24
  * Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/import.js).
25
+ *
26
+ * We also add a "scripts" directory entry for "devDependency".
25
27
  */
26
28
  "import/no-extraneous-dependencies": [
27
29
  "error",
@@ -49,6 +51,8 @@ const HELPFUL_WARNINGS = {
49
51
  "**/protractor.conf.*.js", // protractor config
50
52
  "**/karma.conf.js", // karma config
51
53
  "**/.eslintrc.js", // eslint config
54
+
55
+ "**/scripts/*.{ts,cts,mts}", // TypeScript files inside of a "scripts" directory.
52
56
  ],
53
57
  optionalDependencies: false,
54
58
  },
@@ -217,7 +221,14 @@ const config = {
217
221
 
218
222
  // Disable some specific rules in config files.
219
223
  {
220
- files: [".remarkrc.mjs", "prettier.config.mjs"],
224
+ files: [
225
+ ".remarkrc.mjs",
226
+ ".remarkrc.js",
227
+ "prettier.config.mjs",
228
+ "prettier.config.js",
229
+ "typedoc.config.mjs",
230
+ "typedoc.config.js",
231
+ ],
221
232
  rules: {
222
233
  "import/no-default-export": "off",
223
234
  },
@@ -61,15 +61,11 @@ const POSSIBLE_ERRORS = {
61
61
 
62
62
  "n/process-exit-as-throw": "error",
63
63
 
64
- /** This rule is configured to work with TypeScript file extensions. */
65
- "n/shebang": [
66
- "error",
67
- {
68
- convertPath: {
69
- "src/**/*.ts": ["^src/(.+?)\\.ts$", "dist/$1.js"],
70
- },
71
- },
72
- ],
64
+ /**
65
+ * Disabled since it does not work very well with TypeScript. (It needs project-specific
66
+ * configuration depending on where the output directory is located.)
67
+ */
68
+ "n/shebang": "off",
73
69
  };
74
70
 
75
71
  /** @type {import("eslint").Linter.RulesRecord} */
@@ -46,6 +46,14 @@ const SUPPORTED_RULES = {
46
46
  "@typescript-eslint/explicit-member-accessibility": "off",
47
47
 
48
48
  "@typescript-eslint/explicit-module-boundary-types": "error",
49
+
50
+ /**
51
+ * Disabled because enforcing an arbitrary parameter number threshold for every function in a
52
+ * project does not provide much value. (Additionally, using TypeScript reduces the value of such
53
+ * a check.)
54
+ */
55
+ "@typescript-eslint/max-params": "off",
56
+
49
57
  "@typescript-eslint/member-delimiter-style": "off", // eslint-config-prettier
50
58
 
51
59
  /** Disabled since prescribed class ordering is too project-specific. */
@@ -100,7 +108,13 @@ const SUPPORTED_RULES = {
100
108
  "@typescript-eslint/no-explicit-any": "error",
101
109
  "@typescript-eslint/no-extra-non-null-assertion": "error",
102
110
  "@typescript-eslint/no-extraneous-class": "error",
111
+
112
+ /**
113
+ * The rule is disabled in "*.test.ts" files, since the built-in Node test runner returns a
114
+ * promise that is not meant to be awaited.
115
+ */
103
116
  "@typescript-eslint/no-floating-promises": "error",
117
+
104
118
  "@typescript-eslint/no-for-in-array": "error",
105
119
  "@typescript-eslint/no-import-type-side-effects": "error",
106
120
  "@typescript-eslint/no-inferrable-types": "error",
@@ -138,6 +152,30 @@ const SUPPORTED_RULES = {
138
152
  "@typescript-eslint/non-nullable-type-assertion-style": "error",
139
153
  "@typescript-eslint/parameter-properties": "error",
140
154
  "@typescript-eslint/prefer-as-const": "error",
155
+
156
+ /**
157
+ * Object destructuring is enforced but array destructuring is not. This matches usage in the
158
+ * general TypeScript ecosystem.
159
+ */
160
+ "@typescript-eslint/prefer-destructuring": [
161
+ "error",
162
+ {
163
+ VariableDeclarator: {
164
+ array: false,
165
+ object: true,
166
+ },
167
+ AssignmentExpression: {
168
+ array: false,
169
+ object: true,
170
+ },
171
+ },
172
+ {
173
+ // We disable this for renamed properties, this this is a valid use-case.
174
+ // e.g. `const collectibleUsedToShowFlight = CollectibleType.FATE;`
175
+ enforceForRenamedProperties: false,
176
+ },
177
+ ],
178
+
141
179
  "@typescript-eslint/prefer-enum-initializers": "error",
142
180
  "@typescript-eslint/prefer-for-of": "error",
143
181
  "@typescript-eslint/prefer-function-type": "error",
@@ -298,7 +336,17 @@ const EXTENSION_RULES = {
298
336
 
299
337
  "@typescript-eslint/no-shadow": "error",
300
338
  "@typescript-eslint/no-throw-literal": "error",
301
- "@typescript-eslint/no-unused-expressions": "error",
339
+
340
+ /**
341
+ * The `allowTaggedTemplates` option is enabled to allow the rule to work with libraries like
342
+ * `execa`.
343
+ */
344
+ "@typescript-eslint/no-unused-expressions": [
345
+ "error",
346
+ {
347
+ allowTaggedTemplates: true,
348
+ },
349
+ ],
302
350
 
303
351
  /**
304
352
  * The `args` option is set to `all` make the rule stricter. Additionally, we ignore things that
@@ -357,7 +405,7 @@ const EXTENSION_RULES = {
357
405
  const config = {
358
406
  // We need to provide some special configuration to ESLint in order for it to parse TypeScript
359
407
  // files. From:
360
- // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/base.ts
408
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/base.ts
361
409
  parser: "@typescript-eslint/parser",
362
410
  parserOptions: {
363
411
  sourceType: "module",
@@ -395,6 +443,14 @@ const config = {
395
443
  "@typescript-eslint/strict-boolean-expressions": "off",
396
444
  },
397
445
  },
446
+
447
+ // The built-in Node.js test-runner returns a promise which is not meant to be awaited.
448
+ {
449
+ files: ["*.test.ts"],
450
+ rules: {
451
+ "@typescript-eslint/no-floating-promises": "off",
452
+ },
453
+ },
398
454
  ],
399
455
  };
400
456
 
package/mod.js CHANGED
@@ -7,7 +7,7 @@ const config = {
7
7
  extends: [
8
8
  /**
9
9
  * The IsaacScript mod config extends the base configuration:
10
- * https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-config-isaacscript/configs/base.js
10
+ * https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-config-isaacscript/base.js
11
11
  * (Normal TypeScript projects would just use the base configuration directly.)
12
12
  */
13
13
  "./base",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-isaacscript",
3
- "version": "4.6.0",
3
+ "version": "4.8.0",
4
4
  "description": "A sharable ESLint config for TypeScript and IsaacScript projects.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -22,6 +22,17 @@
22
22
  "license": "MIT",
23
23
  "author": "Zamiell",
24
24
  "type": "commonjs",
25
+ "files": [
26
+ "configs",
27
+ "base.js",
28
+ "LICENSE",
29
+ "mod.js",
30
+ "package.json",
31
+ "README.md"
32
+ ],
33
+ "scripts": {
34
+ "lint": "tsx ./scripts/lint.mts"
35
+ },
25
36
  "dependencies": {
26
37
  "confusing-browser-globals": "^1.0.11"
27
38
  }
package/monorepo.js DELETED
@@ -1,31 +0,0 @@
1
- const path = require("node:path");
2
-
3
- const REPO_ROOT = path.join(__dirname, "..", "..", "..");
4
-
5
- /**
6
- * This config is meant to be used in the IsaacScript monorepo.
7
- *
8
- * @type {import("eslint").Linter.Config}
9
- */
10
- const config = {
11
- // We need to add the `tsconfigRootDir` property, but we must also repeat the options from
12
- // "base-typescript-eslint.js" or they will be deleted.
13
- parserOptions: {
14
- sourceType: "module",
15
- ecmaVersion: "latest",
16
- tsconfigRootDir: REPO_ROOT,
17
- project: true,
18
- },
19
-
20
- rules: {
21
- // This rule has to be told which "package.json" file that the dependencies are located in.
22
- "import/no-extraneous-dependencies": [
23
- "error",
24
- {
25
- packageDir: REPO_ROOT,
26
- },
27
- ],
28
- },
29
- };
30
-
31
- module.exports = config;
File without changes
File without changes