eslint-config-isaacscript 3.7.2 → 4.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.
- package/README.md +2 -30
- package/base-eslint-comments.js +59 -0
- package/base-eslint.js +714 -277
- package/base-import.js +224 -0
- package/base-jsdoc.js +134 -135
- package/base-n.js +146 -0
- package/base-no-autofix.js +18 -0
- package/base-typescript-eslint.js +359 -223
- package/base-unicorn.js +227 -0
- package/base.js +15 -324
- package/mod.js +104 -94
- package/monorepo.js +4 -24
- package/package.json +5 -2
package/base-unicorn.js
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
// This ESLint config only contains rules from `eslint-plugin-unicorn`:
|
|
2
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
3
|
+
|
|
4
|
+
// Rules are separated into categories:
|
|
5
|
+
// 1) Normal rules
|
|
6
|
+
// 2) Deprecated rules
|
|
7
|
+
|
|
8
|
+
/** @type {import("eslint").Linter.RulesRecord} */
|
|
9
|
+
const NORMAL_RULES = {
|
|
10
|
+
"unicorn/better-regex": "error",
|
|
11
|
+
"unicorn/catch-error-name": "error",
|
|
12
|
+
|
|
13
|
+
/** Disabled because it has too many false positives. */
|
|
14
|
+
"unicorn/consistent-destructuring": "off",
|
|
15
|
+
|
|
16
|
+
"unicorn/consistent-function-scoping": "error",
|
|
17
|
+
"unicorn/custom-error-definition": "error",
|
|
18
|
+
"unicorn/empty-brace-spaces": "off", // eslint-config-prettier
|
|
19
|
+
"unicorn/error-message": "error",
|
|
20
|
+
"unicorn/escape-case": "error",
|
|
21
|
+
"unicorn/expiring-todo-comments": "error",
|
|
22
|
+
"unicorn/explicit-length-check": "error",
|
|
23
|
+
|
|
24
|
+
/** Disabled since projects may use different file naming conventions. */
|
|
25
|
+
"unicorn/filename-case": "off",
|
|
26
|
+
|
|
27
|
+
"unicorn/import-style": "error",
|
|
28
|
+
"unicorn/new-for-builtins": "error",
|
|
29
|
+
|
|
30
|
+
/** Superseded by the `eslint-comments/no-unlimited-disable` rule. */
|
|
31
|
+
"unicorn/no-abusive-eslint-disable": "off",
|
|
32
|
+
|
|
33
|
+
"unicorn/no-array-callback-reference": "error",
|
|
34
|
+
"unicorn/no-array-for-each": "error",
|
|
35
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
36
|
+
"unicorn/no-array-push-push": "error",
|
|
37
|
+
"unicorn/no-array-reduce": "error",
|
|
38
|
+
"unicorn/no-await-expression-member": "error",
|
|
39
|
+
"unicorn/no-console-spaces": "error",
|
|
40
|
+
"unicorn/no-document-cookie": "error",
|
|
41
|
+
"unicorn/no-empty-file": "error",
|
|
42
|
+
"unicorn/no-for-loop": "error",
|
|
43
|
+
"unicorn/no-hex-escape": "error",
|
|
44
|
+
"unicorn/no-instanceof-array": "error",
|
|
45
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
46
|
+
|
|
47
|
+
/** Disabled because it is common to prefix variables with "new". */
|
|
48
|
+
"unicorn/no-keyword-prefix": "off",
|
|
49
|
+
|
|
50
|
+
"unicorn/no-lonely-if": "error",
|
|
51
|
+
"unicorn/no-negated-condition": "error",
|
|
52
|
+
"unicorn/no-nested-ternary": "off", // eslint-config-prettier
|
|
53
|
+
"unicorn/no-new-array": "error",
|
|
54
|
+
"unicorn/no-new-buffer": "error",
|
|
55
|
+
"unicorn/no-null": "error",
|
|
56
|
+
"unicorn/no-object-as-default-parameter": "error",
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Disabled because using `process.exit` is common to exit command-line applications without
|
|
60
|
+
* verbose output.
|
|
61
|
+
*/
|
|
62
|
+
"unicorn/no-process-exit": "off",
|
|
63
|
+
|
|
64
|
+
"unicorn/no-static-only-class": "error",
|
|
65
|
+
"unicorn/no-thenable": "error",
|
|
66
|
+
"unicorn/no-this-assignment": "error",
|
|
67
|
+
"unicorn/no-typeof-undefined": "error",
|
|
68
|
+
"unicorn/no-unnecessary-await": "error",
|
|
69
|
+
"unicorn/no-unreadable-array-destructuring": "error",
|
|
70
|
+
"unicorn/no-unreadable-iife": "error",
|
|
71
|
+
"unicorn/no-unused-properties": "error",
|
|
72
|
+
"unicorn/no-useless-fallback-in-spread": "error",
|
|
73
|
+
"unicorn/no-useless-length-check": "error",
|
|
74
|
+
"unicorn/no-useless-promise-resolve-reject": "error",
|
|
75
|
+
"unicorn/no-useless-spread": "error",
|
|
76
|
+
"unicorn/no-useless-switch-case": "error",
|
|
77
|
+
|
|
78
|
+
/** Disabled since it does not work properly with TypeScript. */
|
|
79
|
+
"unicorn/no-useless-undefined": "off",
|
|
80
|
+
|
|
81
|
+
"unicorn/no-zero-fractions": "error",
|
|
82
|
+
"unicorn/number-literal-case": "off", // eslint-config-prettier
|
|
83
|
+
"unicorn/numeric-separators-style": "error",
|
|
84
|
+
"unicorn/prefer-add-event-listener": "error",
|
|
85
|
+
"unicorn/prefer-array-find": "error",
|
|
86
|
+
"unicorn/prefer-array-flat": "error",
|
|
87
|
+
"unicorn/prefer-array-flat-map": "error",
|
|
88
|
+
"unicorn/prefer-array-index-of": "error",
|
|
89
|
+
"unicorn/prefer-array-some": "error",
|
|
90
|
+
"unicorn/prefer-at": "error",
|
|
91
|
+
"unicorn/prefer-blob-reading-methods": "error",
|
|
92
|
+
"unicorn/prefer-code-point": "error",
|
|
93
|
+
"unicorn/prefer-date-now": "error",
|
|
94
|
+
"unicorn/prefer-default-parameters": "error",
|
|
95
|
+
"unicorn/prefer-dom-node-append": "error",
|
|
96
|
+
"unicorn/prefer-dom-node-dataset": "error",
|
|
97
|
+
"unicorn/prefer-dom-node-remove": "error",
|
|
98
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
99
|
+
"unicorn/prefer-event-target": "error",
|
|
100
|
+
"unicorn/prefer-export-from": "error",
|
|
101
|
+
"unicorn/prefer-includes": "error",
|
|
102
|
+
|
|
103
|
+
/** Disabled because the rule is not compatible with TypeScript. */
|
|
104
|
+
"unicorn/prefer-json-parse-buffer": "off",
|
|
105
|
+
|
|
106
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
107
|
+
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
108
|
+
"unicorn/prefer-math-trunc": "error",
|
|
109
|
+
"unicorn/prefer-modern-dom-apis": "error",
|
|
110
|
+
"unicorn/prefer-modern-math-apis": "error",
|
|
111
|
+
"unicorn/prefer-module": "error",
|
|
112
|
+
"unicorn/prefer-native-coercion-functions": "error",
|
|
113
|
+
"unicorn/prefer-negative-index": "error",
|
|
114
|
+
"unicorn/prefer-node-protocol": "error",
|
|
115
|
+
"unicorn/prefer-number-properties": "error",
|
|
116
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
117
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
118
|
+
"unicorn/prefer-prototype-methods": "error",
|
|
119
|
+
"unicorn/prefer-query-selector": "error",
|
|
120
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
121
|
+
"unicorn/prefer-regexp-test": "error",
|
|
122
|
+
"unicorn/prefer-set-has": "error",
|
|
123
|
+
"unicorn/prefer-set-size": "error",
|
|
124
|
+
"unicorn/prefer-spread": "error",
|
|
125
|
+
"unicorn/prefer-string-replace-all": "error",
|
|
126
|
+
"unicorn/prefer-string-slice": "error",
|
|
127
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
128
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
129
|
+
"unicorn/prefer-switch": "error",
|
|
130
|
+
"unicorn/prefer-ternary": "error",
|
|
131
|
+
"unicorn/prefer-top-level-await": "error",
|
|
132
|
+
"unicorn/prefer-type-error": "error",
|
|
133
|
+
|
|
134
|
+
/** Disabled since it is common to use the variable name of "i". */
|
|
135
|
+
"unicorn/prevent-abbreviations": "off",
|
|
136
|
+
|
|
137
|
+
"unicorn/relative-url-style": "error",
|
|
138
|
+
"unicorn/require-array-join-separator": "error",
|
|
139
|
+
"unicorn/require-number-to-fixed-digits-argument": "error",
|
|
140
|
+
|
|
141
|
+
/** Disabled since it is not recommended by the plugin authors. */
|
|
142
|
+
"unicorn/require-post-message-target-origin": "off",
|
|
143
|
+
|
|
144
|
+
/** Disabled since string content enforcement is too project-specific. */
|
|
145
|
+
"unicorn/string-content": "off",
|
|
146
|
+
|
|
147
|
+
"unicorn/switch-case-braces": "error",
|
|
148
|
+
"unicorn/template-indent": "error",
|
|
149
|
+
"unicorn/text-encoding-identifier-case": "error",
|
|
150
|
+
"unicorn/throw-new-error": "error",
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/** @type {import("eslint").Linter.RulesRecord} */
|
|
154
|
+
const DEPRECATED_RULES = {
|
|
155
|
+
/** Disabled because this rule is deprecated. */
|
|
156
|
+
"unicorn/import-index": "off",
|
|
157
|
+
|
|
158
|
+
/** Disabled because this rule is deprecated. */
|
|
159
|
+
"unicorn/no-array-instanceof": "off",
|
|
160
|
+
|
|
161
|
+
/** Disabled because this rule is deprecated. */
|
|
162
|
+
"unicorn/no-fn-reference-in-iterator": "off",
|
|
163
|
+
|
|
164
|
+
/** Disabled because this rule is deprecated. */
|
|
165
|
+
"unicorn/no-reduce": "off",
|
|
166
|
+
|
|
167
|
+
/** Disabled because this rule is deprecated. */
|
|
168
|
+
"unicorn/no-unsafe-regex": "off",
|
|
169
|
+
|
|
170
|
+
/** Disabled because this rule is deprecated. */
|
|
171
|
+
"unicorn/prefer-dataset": "off",
|
|
172
|
+
|
|
173
|
+
/** Disabled because this rule is deprecated. */
|
|
174
|
+
"unicorn/prefer-event-key": "off",
|
|
175
|
+
|
|
176
|
+
/** Disabled because this rule is deprecated. */
|
|
177
|
+
"unicorn/prefer-exponentiation-operator": "off",
|
|
178
|
+
|
|
179
|
+
/** Disabled because this rule is deprecated. */
|
|
180
|
+
"unicorn/prefer-flat-map": "off",
|
|
181
|
+
|
|
182
|
+
/** Disabled because this rule is deprecated. */
|
|
183
|
+
"unicorn/prefer-node-append": "off",
|
|
184
|
+
|
|
185
|
+
/** Disabled because this rule is deprecated. */
|
|
186
|
+
"unicorn/prefer-node-remove": "off",
|
|
187
|
+
|
|
188
|
+
/** Disabled because this rule is deprecated. */
|
|
189
|
+
"unicorn/prefer-object-has-own": "off",
|
|
190
|
+
|
|
191
|
+
/** Disabled because this rule is deprecated. */
|
|
192
|
+
"unicorn/prefer-replace-all": "off",
|
|
193
|
+
|
|
194
|
+
/** Disabled because this rule is deprecated. */
|
|
195
|
+
"unicorn/prefer-starts-ends-with": "off",
|
|
196
|
+
|
|
197
|
+
/** Disabled because this rule is deprecated. */
|
|
198
|
+
"unicorn/prefer-text-content": "off",
|
|
199
|
+
|
|
200
|
+
/** Disabled because this rule is deprecated. */
|
|
201
|
+
"unicorn/prefer-trim-start-end": "off",
|
|
202
|
+
|
|
203
|
+
/** Disabled because this rule is deprecated. */
|
|
204
|
+
"unicorn/regex-shorthand": "off",
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/** @type {import("eslint").Linter.Config} */
|
|
208
|
+
const config = {
|
|
209
|
+
plugins: ["unicorn"],
|
|
210
|
+
|
|
211
|
+
rules: {
|
|
212
|
+
...NORMAL_RULES,
|
|
213
|
+
...DEPRECATED_RULES,
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
overrides: [
|
|
217
|
+
// Disable some TypeScript-specific rules in JavaScript files.
|
|
218
|
+
{
|
|
219
|
+
files: ["*.js", "*.cjs", "*.mjs", "*.jsx"],
|
|
220
|
+
rules: {
|
|
221
|
+
"unicorn/prefer-module": "off",
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
module.exports = config;
|
package/base.js
CHANGED
|
@@ -6,21 +6,10 @@
|
|
|
6
6
|
const config = {
|
|
7
7
|
extends: [
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* https://github.com/airbnb/javascript
|
|
12
|
-
*
|
|
13
|
-
* The actual ESLint config is located here:
|
|
14
|
-
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules
|
|
15
|
-
*/
|
|
16
|
-
"airbnb-base",
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The TypeScript config extends it:
|
|
20
|
-
* https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
21
|
-
* (This includes the "parser" declaration of "@typescript-eslint/parser".)
|
|
9
|
+
* Find deprecated code:
|
|
10
|
+
* https://github.com/gund/eslint-plugin-deprecation
|
|
22
11
|
*/
|
|
23
|
-
"
|
|
12
|
+
"plugin:deprecation/recommended",
|
|
24
13
|
|
|
25
14
|
/**
|
|
26
15
|
* This provides extra miscellaneous rules to keep code safe:
|
|
@@ -28,48 +17,30 @@ const config = {
|
|
|
28
17
|
*/
|
|
29
18
|
"plugin:isaacscript/recommended",
|
|
30
19
|
|
|
31
|
-
/**
|
|
32
|
-
* Find unused "eslint-disable" comments:
|
|
33
|
-
* https://github.com/mysticatea/eslint-plugin-eslint-comments
|
|
34
|
-
*/
|
|
35
|
-
"plugin:eslint-comments/recommended",
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Lint Node-specific things:
|
|
39
|
-
* https://github.com/eslint-community/eslint-plugin-n
|
|
40
|
-
*/
|
|
41
|
-
"plugin:n/recommended",
|
|
42
|
-
|
|
43
20
|
/**
|
|
44
21
|
* Disable any ESLint rules that conflict with Prettier:
|
|
45
22
|
* https://github.com/prettier/eslint-config-prettier
|
|
46
|
-
*
|
|
23
|
+
* Otherwise, we will have unfixable ESLint errors. Note that the Prettier config has to be
|
|
24
|
+
* before the base ESLint config below since we customize some special rules as documented here:
|
|
25
|
+
* https://github.com/prettier/eslint-config-prettier#special-rules
|
|
47
26
|
*/
|
|
48
27
|
"prettier",
|
|
49
28
|
|
|
50
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Rule modifications are split out into different files for better organization (based on the
|
|
31
|
+
* originating plugin) .
|
|
32
|
+
*/
|
|
51
33
|
"./base-eslint",
|
|
34
|
+
"./base-no-autofix",
|
|
52
35
|
"./base-typescript-eslint",
|
|
36
|
+
"./base-eslint-comments",
|
|
37
|
+
"./base-import",
|
|
53
38
|
"./base-jsdoc",
|
|
39
|
+
"./base-n", // "n" stands for Node.
|
|
40
|
+
"./base-unicorn",
|
|
54
41
|
],
|
|
55
42
|
|
|
56
43
|
plugins: [
|
|
57
|
-
/** Activate the "deprecation" plugin, which helps to find deprecated code. */
|
|
58
|
-
"deprecation",
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Activate the "no-autofix" plugin, which allows the fixer for specific rules to be turned off:
|
|
62
|
-
* https://github.com/aladdin-add/eslint-plugin/tree/master/packages/no-autofix
|
|
63
|
-
*/
|
|
64
|
-
"no-autofix",
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Activate the "no-type-assertion" plugin, which allows the "no-type-assertion" rule to be
|
|
68
|
-
* optionally enabled on a per-project basis:
|
|
69
|
-
* https://github.com/Dremora/eslint-plugin-no-type-assertion
|
|
70
|
-
*/
|
|
71
|
-
"no-type-assertion",
|
|
72
|
-
|
|
73
44
|
/**
|
|
74
45
|
* Activate the "eslint-plugin-only-warn" plugin to change all errors to warnings:
|
|
75
46
|
* https://github.com/bfanger/eslint-plugin-only-warn
|
|
@@ -78,280 +49,8 @@ const config = {
|
|
|
78
49
|
* compiler (which show up in red) and ESLint rule violations (which show up in yellow).
|
|
79
50
|
*/
|
|
80
51
|
"only-warn",
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Activate the "sort-exports" plugin, which allows the "sort-exports" rule to be optionally
|
|
84
|
-
* enabled on a per-project basis:
|
|
85
|
-
* https://github.com/jrdrg/eslint-plugin-sort-exports
|
|
86
|
-
*/
|
|
87
|
-
"sort-exports",
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Activate the "unicorn" plugin, which allows for various miscellaneous useful rules:
|
|
91
|
-
* https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
92
|
-
*/
|
|
93
|
-
"unicorn",
|
|
94
52
|
],
|
|
95
53
|
|
|
96
|
-
rules: {
|
|
97
|
-
/**
|
|
98
|
-
* Documentation:
|
|
99
|
-
* https://github.com/gund/eslint-plugin-deprecation
|
|
100
|
-
*
|
|
101
|
-
* Not defined in parent configs.
|
|
102
|
-
*
|
|
103
|
-
* Warn on deprecated code.
|
|
104
|
-
*/
|
|
105
|
-
"deprecation/deprecation": "warn",
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Documentation:
|
|
109
|
-
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/docs/rules/disable-enable-pair.md
|
|
110
|
-
*
|
|
111
|
-
* Defined at:
|
|
112
|
-
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/lib/configs/recommended.js
|
|
113
|
-
*
|
|
114
|
-
* By default, it does not allow "eslint-disable" comments for a whole file, which is standard
|
|
115
|
-
* practice.
|
|
116
|
-
*/
|
|
117
|
-
"eslint-comments/disable-enable-pair": [
|
|
118
|
-
"warn",
|
|
119
|
-
{
|
|
120
|
-
allowWholeFile: true,
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Documentation:
|
|
126
|
-
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/docs/rules/no-unlimited-disable.md
|
|
127
|
-
*
|
|
128
|
-
* Defined at:
|
|
129
|
-
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/lib/configs/recommended.js
|
|
130
|
-
*
|
|
131
|
-
* If a line breaks two or more ESLint rules, then it is useful to use a single "eslint-disable"
|
|
132
|
-
* comment.
|
|
133
|
-
*/
|
|
134
|
-
"eslint-comments/no-unlimited-disable": "off",
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Documentation:
|
|
138
|
-
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/docs/rules/no-unused-disable.md
|
|
139
|
-
*
|
|
140
|
-
* Not defined in the parent configs.
|
|
141
|
-
*
|
|
142
|
-
* This can help clean up unnecessary comments.
|
|
143
|
-
*/
|
|
144
|
-
"eslint-comments/no-unused-disable": "warn",
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Documentation:
|
|
148
|
-
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/extensions.md
|
|
149
|
-
*
|
|
150
|
-
* Defined at:
|
|
151
|
-
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js
|
|
152
|
-
* https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
153
|
-
*
|
|
154
|
-
* This rule is useful in commonjs codebases that want to ban file extensions on imports.
|
|
155
|
-
* However, ESM is now the standard and file extensions should be used. Furthermore, in
|
|
156
|
-
* TypeScript codebases, the compiler will alert us to any errors on a file extension in an
|
|
157
|
-
* import statement.
|
|
158
|
-
*/
|
|
159
|
-
"import/extensions": "off",
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Documentation:
|
|
163
|
-
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
|
|
164
|
-
*
|
|
165
|
-
* Not defined in the parent configs.
|
|
166
|
-
*
|
|
167
|
-
* The case against default exports is layed out here:
|
|
168
|
-
* https://basarat.gitbook.io/typescript/main-1/defaultisbad
|
|
169
|
-
*/
|
|
170
|
-
"import/no-default-export": "warn",
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Documentation:
|
|
174
|
-
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md
|
|
175
|
-
*
|
|
176
|
-
* Defined at:
|
|
177
|
-
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js
|
|
178
|
-
*
|
|
179
|
-
* This rule is not necessary in TypeScript codebases, since the compiler would error if you had
|
|
180
|
-
* a typo in an import statement.
|
|
181
|
-
*/
|
|
182
|
-
"import/no-unresolved": "off",
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Documentation:
|
|
186
|
-
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/prefer-default-export.md
|
|
187
|
-
*
|
|
188
|
-
* Defined at:
|
|
189
|
-
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js
|
|
190
|
-
*
|
|
191
|
-
* The case against default exports is layed out here:
|
|
192
|
-
* https://basarat.gitbook.io/typescript/main-1/defaultisbad
|
|
193
|
-
*/
|
|
194
|
-
"import/prefer-default-export": "off",
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Documentation:
|
|
198
|
-
* https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/file-extension-in-import.md
|
|
199
|
-
*
|
|
200
|
-
* Not defined in parent configs.
|
|
201
|
-
*
|
|
202
|
-
* We use this to automatically fix import statements to ESM.
|
|
203
|
-
*/
|
|
204
|
-
"n/file-extension-in-import": ["warn", "always"],
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Documentation:
|
|
208
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-import.md
|
|
209
|
-
*
|
|
210
|
-
* Defined at:
|
|
211
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
212
|
-
*
|
|
213
|
-
* The TypeScript compiler will warn us if an import does not exist, so this rule is
|
|
214
|
-
* unnecessary.
|
|
215
|
-
*/
|
|
216
|
-
"n/no-extraneous-import": "off",
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Documentation:
|
|
220
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-require.md
|
|
221
|
-
*
|
|
222
|
-
* Defined at:
|
|
223
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
224
|
-
*
|
|
225
|
-
* Require statements are not used in TypeScript code.
|
|
226
|
-
*/
|
|
227
|
-
"n/no-extraneous-require": "off",
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Documentation:
|
|
231
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-missing-import.md
|
|
232
|
-
*
|
|
233
|
-
* Defined at:
|
|
234
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
235
|
-
*
|
|
236
|
-
* The TypeScript compiler will warn us if an import does not exist, so this rule is
|
|
237
|
-
* unnecessary.
|
|
238
|
-
*/
|
|
239
|
-
"n/no-missing-import": "off",
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Documentation:
|
|
243
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-exit.md
|
|
244
|
-
*
|
|
245
|
-
* Defined at:
|
|
246
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
247
|
-
*
|
|
248
|
-
* Using "process.exit" allows the ability to exit command-line applications without verbose
|
|
249
|
-
* output.
|
|
250
|
-
*/
|
|
251
|
-
"n/no-process-exit": "off",
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Documentation:
|
|
255
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-syntax.md
|
|
256
|
-
*
|
|
257
|
-
* Defined at:
|
|
258
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
259
|
-
*
|
|
260
|
-
* This rule requires adding `parserOptions.ecmaVersion` to every ESLint configuration file. The
|
|
261
|
-
* rule does not provide enough value to make that modification worth it.
|
|
262
|
-
*/
|
|
263
|
-
"n/no-unsupported-features/es-syntax": "off",
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Documentation:
|
|
267
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-syntax.md
|
|
268
|
-
*
|
|
269
|
-
* Defined at:
|
|
270
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
271
|
-
*
|
|
272
|
-
* This rule requires adding `parserOptions.ecmaVersion` to every ESLint configuration file. The
|
|
273
|
-
* rule does not provide enough value to make that modification worth it.
|
|
274
|
-
*/
|
|
275
|
-
"n/no-unsupported-features/es-builtins": "off",
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Documentation:
|
|
279
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/node-builtins.md
|
|
280
|
-
*
|
|
281
|
-
* Defined at:
|
|
282
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
283
|
-
*
|
|
284
|
-
* The TypeScript compiler will prevent us from using Node modules that are not present in the
|
|
285
|
-
* corresponding specified Node output environment, so this rule is unnecessary.
|
|
286
|
-
*/
|
|
287
|
-
"n/no-unsupported-features/node-builtins": "off",
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Documentation:
|
|
291
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/shebang.md
|
|
292
|
-
*
|
|
293
|
-
* Defined at:
|
|
294
|
-
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
295
|
-
*
|
|
296
|
-
* We need to configure this rule to be Typescript-aware.
|
|
297
|
-
*/
|
|
298
|
-
"n/shebang": [
|
|
299
|
-
"warn",
|
|
300
|
-
{
|
|
301
|
-
convertPath: {
|
|
302
|
-
"src/**/*.ts": ["^src/(.+?)\\.ts$", "dist/$1.js"],
|
|
303
|
-
},
|
|
304
|
-
},
|
|
305
|
-
],
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Documentation:
|
|
309
|
-
* https://github.com/aladdin-add/eslint-plugin/tree/master/packages/no-autofix
|
|
310
|
-
*
|
|
311
|
-
* We want to disable the autofix for this rule, since it is almost always unwanted.
|
|
312
|
-
*/
|
|
313
|
-
"no-useless-return": "off",
|
|
314
|
-
"no-autofix/no-useless-return": "warn",
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Documentation:
|
|
318
|
-
* https://github.com/aladdin-add/eslint-plugin/tree/master/packages/no-autofix
|
|
319
|
-
*
|
|
320
|
-
* We want to disable the autofix for this rule, since it is almost always unwanted.
|
|
321
|
-
*/
|
|
322
|
-
"prefer-const": "off",
|
|
323
|
-
"no-autofix/prefer-const": "warn",
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Documentation:
|
|
327
|
-
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
328
|
-
*
|
|
329
|
-
* Not defined in parent configs.
|
|
330
|
-
*
|
|
331
|
-
* Enforce the new "node:" prefix as an extra safety measure.
|
|
332
|
-
*/
|
|
333
|
-
"unicorn/prefer-node-protocol": "warn",
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Documentation:
|
|
337
|
-
* https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
338
|
-
*
|
|
339
|
-
* Not defined in parent configs.
|
|
340
|
-
*
|
|
341
|
-
* Prevent superfluous type annotations, which can cause bugs with widened types.
|
|
342
|
-
*/
|
|
343
|
-
// https://github.com/typescript-eslint/typescript-eslint/issues/6446
|
|
344
|
-
"no-restricted-syntax": [
|
|
345
|
-
"warn",
|
|
346
|
-
{
|
|
347
|
-
selector:
|
|
348
|
-
'VariableDeclarator[id.typeAnnotation] > :matches(TSTypeAssertion, TSAsExpression) > TSTypeReference.typeAnnotation > Identifier[name="const"]',
|
|
349
|
-
message:
|
|
350
|
-
"Don't use `as const` with a type annotated variable, since it widens the type.",
|
|
351
|
-
},
|
|
352
|
-
],
|
|
353
|
-
},
|
|
354
|
-
|
|
355
54
|
overrides: [
|
|
356
55
|
// Disable some TypeScript-specific rules in JavaScript files.
|
|
357
56
|
{
|
|
@@ -362,14 +61,6 @@ const config = {
|
|
|
362
61
|
"isaacscript/require-capital-read-only": "off",
|
|
363
62
|
},
|
|
364
63
|
},
|
|
365
|
-
|
|
366
|
-
// Remark configs require a default export.
|
|
367
|
-
{
|
|
368
|
-
files: [".remarkrc.mjs"],
|
|
369
|
-
rules: {
|
|
370
|
-
"import/no-default-export": "off",
|
|
371
|
-
},
|
|
372
|
-
},
|
|
373
64
|
],
|
|
374
65
|
};
|
|
375
66
|
|