eslint-config-isaacscript 3.3.0 → 3.3.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.
package/README.md CHANGED
@@ -4,6 +4,32 @@
4
4
 
5
5
  This is a sharable configuration for ESLint that is intended to be used in TypeScript and IsaacScript projects.
6
6
 
7
- This package is consumed by the [`isaacscript-lint`](https://github.com/IsaacScript/isaacscript/tree/main/packages/isaacscript-lint) meta-linting package.
7
+ This package is consumed by the [`isaacscript-lint`](https://github.com/IsaacScript/isaacscript/tree/main/packages/isaacscript-lint) meta-linting package. It is recommended that instead of consuming this package directly, you instead list `isaacscript-lint` as a dependency, as it includes all of the corresponding plugins and so on.
8
+
9
+ For TypeScript projects, set up your `.eslintrc.cjs` file to extend from the config like this:
10
+
11
+ ```js
12
+ // This is the configuration file for ESLint, the TypeScript linter:
13
+ // https://eslint.org/docs/user-guide/configuring
14
+ module.exports = {
15
+ extends: [
16
+ // The linter base is the shared IsaacScript config:
17
+ // https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-config-isaacscript/base.js
18
+ "eslint-config-isaacscript/base",
19
+ ],
20
+
21
+ // Don't bother linting the compiled output.
22
+ ignorePatterns: ["**/dist/**"],
23
+
24
+ parserOptions: {
25
+ // ESLint needs to know about the project's TypeScript settings in order for TypeScript-specific
26
+ // things to lint correctly. We do not point this at "./tsconfig.json" because certain files
27
+ // (such at this file) should be linted but not included in the actual project output.
28
+ project: "./tsconfig.eslint.json",
29
+ },
30
+
31
+ rules: {},
32
+ };
33
+ ```
8
34
 
9
35
  Please see the [IsaacScript webpage](https://isaacscript.github.io/) for more information.
package/base-eslint.js ADDED
@@ -0,0 +1,131 @@
1
+ // This is a shared configuration file for ESLint:
2
+ // https://eslint.org/docs/latest/user-guide/configuring
3
+ // This config only contains modifications to the built-in rules from the ESLint tool.
4
+ module.exports = {
5
+ 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", {}],
16
+ },
17
+
18
+ // "constructor-super" is disabled due to conflicting with the TypeScript compiler:
19
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
20
+
21
+ // "for-direction" is enabled here:
22
+ // https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js
23
+
24
+ // "getter-return" is disabled due to conflicting with the TypeScript compiler:
25
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
26
+
27
+ // "no-async-promise-executor"
28
+
29
+ // "no-await-in-loop"
30
+
31
+ // "no-class-assign"
32
+
33
+ // "no-compare-neg-zero"
34
+
35
+ // "no-cond-assign"
36
+
37
+ // "no-const-assign" is disabled due to conflicting with the TypeScript compiler:
38
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
39
+
40
+ // "no-constant-binary-expression"
41
+
42
+ // "no-constant-condition"
43
+
44
+ // "no-constructor-return"
45
+
46
+ // "no-control-regex"
47
+
48
+ // "no-debugger"
49
+
50
+ // "no-dupe-args" is disabled due to conflicting with the TypeScript compiler:
51
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
52
+
53
+ // "no-dupe-class-members" is disabled due to conflicting with the TypeScript compiler:
54
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
55
+
56
+ // "no-dupe-else-if"
57
+
58
+ // "no-dupe-keys" is disabled due to conflicting with the TypeScript compiler:
59
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
60
+
61
+ // "no-duplicate-case"
62
+
63
+ // "no-duplicate-imports"
64
+
65
+ // "no-empty-character-class"
66
+
67
+ // "no-empty-pattern"
68
+
69
+ // "no-ex-assign"
70
+
71
+ // "no-fallthrough"
72
+
73
+ // "no-func-assign" is disabled due to conflicting with the TypeScript compiler:
74
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
75
+
76
+ // "no-import-assign" is disabled due to conflicting with the TypeScript compiler:
77
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
78
+
79
+ // "no-inner-declarations"
80
+
81
+ // "no-invalid-regexp"
82
+
83
+ // "no-irregular-whitespace"
84
+
85
+ // "no-loss-of-precision"
86
+
87
+ // "no-misleading-character-class"
88
+
89
+ // "no-new-native-nonconstructor"
90
+
91
+ // "no-new-symbol" is disabled due to conflicting with the TypeScript compiler:
92
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
93
+
94
+ // "no-obj-calls" is disabled due to conflicting with the TypeScript compiler:
95
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
96
+
97
+ // "no-promise-executor-return"
98
+
99
+ // "no-prototype-builtins"
100
+
101
+ // "no-self-assign"
102
+
103
+ // "no-self-compare"
104
+
105
+ // "no-setter-return"
106
+
107
+ // "no-sparse-arrays"
108
+
109
+ // "no-template-curly-in-string"
110
+
111
+ // "no-redeclare" is disabled due to conflicting with the TypeScript compiler:
112
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
113
+
114
+ // "no-setter-return" is disabled due to conflicting with the TypeScript compiler:
115
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
116
+
117
+ // "no-this-before-super" is disabled due to conflicting with the TypeScript compiler:
118
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
119
+
120
+ // "no-undef" is disabled due to conflicting with the TypeScript compiler:
121
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
122
+
123
+ // "no-unreachable" is disabled due to conflicting with the TypeScript compiler:
124
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
125
+
126
+ // "no-unsafe-negation" is disabled due to conflicting with the TypeScript compiler:
127
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
128
+
129
+ // "valid-typeof" is disabled due to conflicting with the TypeScript compiler:
130
+ // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
131
+ };
@@ -1,5 +1,6 @@
1
1
  // This is a shared configuration file for ESLint:
2
2
  // https://eslint.org/docs/latest/user-guide/configuring
3
+ // This config contains only rules from the "jsdoc" ESLint plugin.
3
4
  module.exports = {
4
5
  plugins: [
5
6
  /**
package/base.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // This is a shared configuration file for ESLint:
2
2
  // https://eslint.org/docs/latest/user-guide/configuring
3
+ // This config is meant to be used as a base for all TypeScript projects.
3
4
  module.exports = {
4
5
  extends: [
5
6
  /**
@@ -23,7 +24,6 @@ module.exports = {
23
24
  * We extend the Airbnb rules with the "recommended", "recommended-requiring-type-checking", and
24
25
  * "strict" rules from the "typescript-eslint" plugin, which is also recommended by Matt
25
26
  * Turnbull, the author of "airbnb-typescript/base":
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
29
  * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
@@ -44,8 +44,11 @@ module.exports = {
44
44
  */
45
45
  "plugin:eslint-comments/recommended",
46
46
 
47
+ /** Rule modifications are split out into different files for better organization. */
48
+ "./base-eslint",
49
+
47
50
  /** Lint JSDoc comments. */
48
- "./jsdoc",
51
+ "./base-jsdoc",
49
52
 
50
53
  /**
51
54
  * Disable any ESLint rules that conflict with Prettier:
@@ -57,7 +60,13 @@ module.exports = {
57
60
 
58
61
  plugins: [
59
62
  /**
60
- * Use the "eslint-plugin-only-warn" plugin to change all errors to warnings:
63
+ * Activate the "no-type-assertion" plugin, which allows the "no-type-assertion" rule to be
64
+ * optionally enabled on a per-project basis.
65
+ */
66
+ "no-type-assertion",
67
+
68
+ /**
69
+ * Activate the "eslint-plugin-only-warn" plugin to change all errors to warnings:
61
70
  * https://github.com/bfanger/eslint-plugin-only-warn
62
71
  *
63
72
  * This allows the end-user to more easily distinguish between errors from the TypeScript
@@ -65,12 +74,6 @@ module.exports = {
65
74
  */
66
75
  "only-warn",
67
76
 
68
- /**
69
- * Activate the "no-type-assertion" plugin, which allows the "no-type-assertion" rule to be
70
- * optionally enabled on a per-project basis.
71
- */
72
- "no-type-assertion",
73
-
74
77
  /**
75
78
  * Activate the "sort-exports" plugin, which allows the "sort-exports" rule to be optionally
76
79
  * enabled on a per-project basis.
@@ -366,6 +369,17 @@ module.exports = {
366
369
  */
367
370
  "import/no-default-export": "warn",
368
371
 
372
+ /**
373
+ * Documentation:
374
+ * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md
375
+ *
376
+ * Defined at:
377
+ * https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js
378
+ *
379
+ * It is a useful rule and it is turned off in the parent configs with no explanation.
380
+ */
381
+ "import/no-deprecated": "off",
382
+
369
383
  /**
370
384
  * Documentation:
371
385
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/prefer-default-export.md
@@ -490,4 +504,22 @@ module.exports = {
490
504
  },
491
505
  ],
492
506
  },
507
+
508
+ overrides: [
509
+ // Disable some TypeScript-specific rules in JavaScript files.
510
+ {
511
+ files: ["*.js", "*.cjs", "*.mjs", "*.jsx"],
512
+ rules: {
513
+ "@typescript-eslint/explicit-module-boundary-types": "off",
514
+ "@typescript-eslint/no-unsafe-argument": "off",
515
+ "@typescript-eslint/no-unsafe-assignment": "off",
516
+ "@typescript-eslint/no-unsafe-call": "off",
517
+ "@typescript-eslint/no-unsafe-member-access": "off",
518
+ "@typescript-eslint/no-unsafe-return": "off",
519
+ "@typescript-eslint/no-var-requires": "off",
520
+ "@typescript-eslint/strict-boolean-expressions": "off",
521
+ "isaacscript/no-object-any": "off",
522
+ },
523
+ },
524
+ ],
493
525
  };
package/mod.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // This is a shared configuration file for ESLint:
2
2
  // https://eslint.org/docs/latest/user-guide/configuring
3
+ // This config is meant to be used as a base for IsaacScript mods.
3
4
  module.exports = {
4
5
  extends: [
5
6
  /**
package/monorepo.js CHANGED
@@ -1,4 +1,4 @@
1
- const path = require("path"); // eslint-disable-line @typescript-eslint/no-var-requires
1
+ const path = require("path");
2
2
 
3
3
  const REPO_ROOT = path.join(__dirname, "..", "..");
4
4
 
@@ -16,6 +16,8 @@ module.exports = {
16
16
  tsconfigRootDir: REPO_ROOT,
17
17
  },
18
18
 
19
+ ignorePatterns: ["!.prettierrc.cjs"],
20
+
19
21
  rules: {
20
22
  "@nrwl/nx/enforce-module-boundaries": [
21
23
  "warn",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-isaacscript",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "A sharable ESLint config for TypeScript and IsaacScript projects.",
5
5
  "keywords": [
6
6
  "eslint",