eslint-config-isaacscript 3.3.1 → 3.4.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/base-eslint.js +220 -67
- package/base-typescript-eslint.js +221 -0
- package/base.js +119 -311
- package/monorepo.js +2 -1
- package/package.json +1 -1
package/base-eslint.js
CHANGED
|
@@ -13,119 +13,272 @@ module.exports = {
|
|
|
13
13
|
* Airbnb changes the default options for some reason, which makes the rule less strict.
|
|
14
14
|
*/
|
|
15
15
|
"array-callback-return": ["warn", {}],
|
|
16
|
-
},
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Documentation:
|
|
19
|
+
* https://eslint.org/docs/latest/rules/consistent-return
|
|
20
|
+
*
|
|
21
|
+
* Defined at:
|
|
22
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
|
|
23
|
+
*
|
|
24
|
+
* We prefer the "noImplicitReturns" compiler flag over the "consistent-return" ESLint rule,
|
|
25
|
+
* since it is type-aware:
|
|
26
|
+
* https://github.com/typescript-eslint/typescript-eslint/issues/5254
|
|
27
|
+
*/
|
|
28
|
+
"consistent-return": ["off"],
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Documentation:
|
|
32
|
+
* https://eslint.org/docs/latest/rules/curly
|
|
33
|
+
*
|
|
34
|
+
* Defined at:
|
|
35
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
|
|
36
|
+
*
|
|
37
|
+
* Always requiring curly braces can partially ward against Apple-style if statement bugs:
|
|
38
|
+
* https://www.imperialviolet.org/2014/02/22/applebug.html
|
|
39
|
+
*
|
|
40
|
+
* Additionally, this rule needs to be set to "all" to work properly with
|
|
41
|
+
* `eslint-prettier-config`:
|
|
42
|
+
* https://github.com/prettier/eslint-config-prettier#curly
|
|
43
|
+
*/
|
|
44
|
+
curly: ["warn", "all"],
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Documentation:
|
|
48
|
+
* https://eslint.org/docs/latest/rules/default-case
|
|
49
|
+
*
|
|
50
|
+
* Defined at:
|
|
51
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js
|
|
52
|
+
*
|
|
53
|
+
* This rule is generally bad to have on in TypeScript projects:
|
|
54
|
+
* https://github.com/typescript-eslint/typescript-eslint/issues/5254
|
|
55
|
+
*/
|
|
56
|
+
"default-case": "off",
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Documentation:
|
|
60
|
+
* https://eslint.org/docs/latest/rules/no-console
|
|
61
|
+
*
|
|
62
|
+
* Defined at:
|
|
63
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js
|
|
64
|
+
*
|
|
65
|
+
* Command-line programs commonly write to standard out and standard error.
|
|
66
|
+
*/
|
|
67
|
+
"no-console": "off",
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Documentation:
|
|
71
|
+
* https://eslint.org/docs/latest/rules/no-constant-binary-expression
|
|
72
|
+
*
|
|
73
|
+
* Not defined in parent configs.
|
|
74
|
+
*
|
|
75
|
+
* This rule was released in 2022 and is known to catch many subtle bugs:
|
|
76
|
+
* https://github.com/eslint/eslint.org/pull/240/files
|
|
77
|
+
*/
|
|
78
|
+
"no-constant-binary-expression": "warn",
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Documentation:
|
|
82
|
+
* https://eslint.org/docs/latest/rules/no-continue
|
|
83
|
+
*
|
|
84
|
+
* Defined at:
|
|
85
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
86
|
+
*
|
|
87
|
+
* Proper use of continues can reduce indentation for long blocks of code.
|
|
88
|
+
*/
|
|
89
|
+
"no-continue": "off",
|
|
20
90
|
|
|
21
|
-
|
|
22
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Documentation:
|
|
93
|
+
* https://eslint.org/docs/latest/rules/no-plusplus
|
|
94
|
+
*
|
|
95
|
+
* Defined at:
|
|
96
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
97
|
+
*
|
|
98
|
+
* Airbnb disallows these because it can lead to errors with minified code. When using Prettier,
|
|
99
|
+
* it adds semi-colons everywhere, so we don't have to worry about this.
|
|
100
|
+
*/
|
|
101
|
+
"no-plusplus": "off",
|
|
23
102
|
|
|
24
|
-
|
|
25
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Documentation:
|
|
105
|
+
* https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
106
|
+
*
|
|
107
|
+
* Defined at:
|
|
108
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
109
|
+
*
|
|
110
|
+
* - We move the selector for "for..of" loops, since they are commonly used.
|
|
111
|
+
* - We add a selector for "empty" invocations of the "array.push()" method.
|
|
112
|
+
*/
|
|
113
|
+
"no-restricted-syntax": [
|
|
114
|
+
"warn",
|
|
115
|
+
{
|
|
116
|
+
selector: "ForInStatement",
|
|
117
|
+
message:
|
|
118
|
+
"for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
selector: "LabeledStatement",
|
|
122
|
+
message:
|
|
123
|
+
"Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
selector: "WithStatement",
|
|
127
|
+
message:
|
|
128
|
+
"`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
selector:
|
|
132
|
+
"CallExpression[callee.property.name='push'][arguments.length=0]",
|
|
133
|
+
message: "push must always be called with at least one argument.",
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Documentation:
|
|
139
|
+
* https://eslint.org/docs/latest/rules/no-unused-expressions
|
|
140
|
+
*
|
|
141
|
+
* Not defined in parent configs.
|
|
142
|
+
*
|
|
143
|
+
* An unused expression which has no effect on the state of the program indicates a logic error.
|
|
144
|
+
*/
|
|
145
|
+
"no-unused-expressions": "warn",
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Documentation:
|
|
149
|
+
* https://eslint.org/docs/latest/rules/prefer-destructuring
|
|
150
|
+
*
|
|
151
|
+
* Defined at:
|
|
152
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/es6.js
|
|
153
|
+
*
|
|
154
|
+
* Array destructuring can result in non-intuitive code.
|
|
155
|
+
*/
|
|
156
|
+
"prefer-destructuring": [
|
|
157
|
+
"warn",
|
|
158
|
+
{
|
|
159
|
+
VariableDeclarator: {
|
|
160
|
+
array: false,
|
|
161
|
+
object: true,
|
|
162
|
+
},
|
|
163
|
+
AssignmentExpression: {
|
|
164
|
+
array: false,
|
|
165
|
+
object: false,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
],
|
|
26
169
|
|
|
27
|
-
|
|
170
|
+
// "constructor-super" is disabled due to conflicting with the TypeScript compiler:
|
|
171
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
28
172
|
|
|
29
|
-
|
|
173
|
+
// "for-direction" is enabled here:
|
|
174
|
+
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js
|
|
30
175
|
|
|
31
|
-
|
|
176
|
+
// "getter-return" is disabled due to conflicting with the TypeScript compiler:
|
|
177
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
32
178
|
|
|
33
|
-
|
|
179
|
+
// "no-async-promise-executor"
|
|
34
180
|
|
|
35
|
-
|
|
181
|
+
// "no-await-in-loop"
|
|
36
182
|
|
|
37
|
-
|
|
38
|
-
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
183
|
+
// "no-class-assign"
|
|
39
184
|
|
|
40
|
-
|
|
185
|
+
// "no-compare-neg-zero"
|
|
41
186
|
|
|
42
|
-
|
|
187
|
+
// "no-cond-assign"
|
|
43
188
|
|
|
44
|
-
|
|
189
|
+
// "no-const-assign" is disabled due to conflicting with the TypeScript compiler:
|
|
190
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
45
191
|
|
|
46
|
-
|
|
192
|
+
// "no-constant-binary-expression"
|
|
47
193
|
|
|
48
|
-
|
|
194
|
+
// "no-constant-condition"
|
|
49
195
|
|
|
50
|
-
|
|
51
|
-
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
196
|
+
// "no-constructor-return"
|
|
52
197
|
|
|
53
|
-
|
|
54
|
-
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
198
|
+
// "no-control-regex"
|
|
55
199
|
|
|
56
|
-
|
|
200
|
+
// "no-debugger"
|
|
57
201
|
|
|
58
|
-
|
|
59
|
-
|
|
202
|
+
// "no-dupe-args" is disabled due to conflicting with the TypeScript compiler:
|
|
203
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
60
204
|
|
|
61
|
-
|
|
205
|
+
// "no-dupe-class-members" is disabled due to conflicting with the TypeScript compiler:
|
|
206
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
62
207
|
|
|
63
|
-
|
|
208
|
+
// "no-dupe-else-if"
|
|
64
209
|
|
|
65
|
-
|
|
210
|
+
// "no-dupe-keys" is disabled due to conflicting with the TypeScript compiler:
|
|
211
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
66
212
|
|
|
67
|
-
|
|
213
|
+
// "no-duplicate-case"
|
|
68
214
|
|
|
69
|
-
|
|
215
|
+
// "no-duplicate-imports"
|
|
70
216
|
|
|
71
|
-
|
|
217
|
+
// "no-empty-character-class"
|
|
72
218
|
|
|
73
|
-
|
|
74
|
-
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
219
|
+
// "no-empty-pattern"
|
|
75
220
|
|
|
76
|
-
|
|
77
|
-
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
221
|
+
// "no-ex-assign"
|
|
78
222
|
|
|
79
|
-
|
|
223
|
+
// "no-fallthrough"
|
|
80
224
|
|
|
81
|
-
|
|
225
|
+
// "no-func-assign" is disabled due to conflicting with the TypeScript compiler:
|
|
226
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
82
227
|
|
|
83
|
-
|
|
228
|
+
// "no-import-assign" is disabled due to conflicting with the TypeScript compiler:
|
|
229
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
84
230
|
|
|
85
|
-
|
|
231
|
+
// "no-inner-declarations"
|
|
86
232
|
|
|
87
|
-
|
|
233
|
+
// "no-invalid-regexp"
|
|
88
234
|
|
|
89
|
-
|
|
235
|
+
// "no-irregular-whitespace"
|
|
90
236
|
|
|
91
|
-
|
|
92
|
-
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
237
|
+
// "no-loss-of-precision"
|
|
93
238
|
|
|
94
|
-
|
|
95
|
-
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
239
|
+
// "no-misleading-character-class"
|
|
96
240
|
|
|
97
|
-
|
|
241
|
+
// "no-new-native-nonconstructor"
|
|
98
242
|
|
|
99
|
-
|
|
243
|
+
// "no-new-symbol" is disabled due to conflicting with the TypeScript compiler:
|
|
244
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
100
245
|
|
|
101
|
-
|
|
246
|
+
// "no-obj-calls" is disabled due to conflicting with the TypeScript compiler:
|
|
247
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
102
248
|
|
|
103
|
-
|
|
249
|
+
// "no-promise-executor-return"
|
|
104
250
|
|
|
105
|
-
|
|
251
|
+
// "no-prototype-builtins"
|
|
106
252
|
|
|
107
|
-
|
|
253
|
+
// "no-self-assign"
|
|
108
254
|
|
|
109
|
-
|
|
255
|
+
// "no-self-compare"
|
|
110
256
|
|
|
111
|
-
|
|
112
|
-
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
257
|
+
// "no-setter-return"
|
|
113
258
|
|
|
114
|
-
|
|
115
|
-
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
259
|
+
// "no-sparse-arrays"
|
|
116
260
|
|
|
117
|
-
|
|
118
|
-
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
261
|
+
// "no-template-curly-in-string"
|
|
119
262
|
|
|
120
|
-
|
|
121
|
-
|
|
263
|
+
// "no-redeclare" is disabled due to conflicting with the TypeScript compiler:
|
|
264
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
122
265
|
|
|
123
|
-
|
|
124
|
-
|
|
266
|
+
// "no-setter-return" is disabled due to conflicting with the TypeScript compiler:
|
|
267
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
125
268
|
|
|
126
|
-
|
|
127
|
-
|
|
269
|
+
// "no-this-before-super" is disabled due to conflicting with the TypeScript compiler:
|
|
270
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
128
271
|
|
|
129
|
-
|
|
130
|
-
|
|
272
|
+
// "no-undef" is disabled due to conflicting with the TypeScript compiler:
|
|
273
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
274
|
+
|
|
275
|
+
// "no-unreachable" is disabled due to conflicting with the TypeScript compiler:
|
|
276
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
277
|
+
|
|
278
|
+
// "no-unsafe-negation" is disabled due to conflicting with the TypeScript compiler:
|
|
279
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
280
|
+
|
|
281
|
+
// "valid-typeof" is disabled due to conflicting with the TypeScript compiler:
|
|
282
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
283
|
+
},
|
|
131
284
|
};
|
|
@@ -0,0 +1,221 @@
|
|
|
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 "@typescript-eslint"
|
|
4
|
+
// plugin.
|
|
5
|
+
module.exports = {
|
|
6
|
+
rules: {
|
|
7
|
+
/**
|
|
8
|
+
* Documentation:
|
|
9
|
+
* https://typescript-eslint.io/rules/array-type
|
|
10
|
+
*
|
|
11
|
+
* Not defined in the parent configs.
|
|
12
|
+
*
|
|
13
|
+
* Prefer the "string[]" syntax over "Array<string>".
|
|
14
|
+
*/
|
|
15
|
+
"@typescript-eslint/array-type": [
|
|
16
|
+
"warn",
|
|
17
|
+
{
|
|
18
|
+
default: "array-simple",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Documentation:
|
|
24
|
+
* https://typescript-eslint.io/rules/explicit-module-boundary-types
|
|
25
|
+
*
|
|
26
|
+
* Not defined in the parent configs.
|
|
27
|
+
*
|
|
28
|
+
* Specifying explicit return types can help prevent bugs, but only require it on exported
|
|
29
|
+
* functions.
|
|
30
|
+
*/
|
|
31
|
+
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Documentation:
|
|
35
|
+
* https://typescript-eslint.io/rules/lines-between-class-members
|
|
36
|
+
*
|
|
37
|
+
* Defined at:
|
|
38
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
39
|
+
*
|
|
40
|
+
* Airbnb has "exceptAfterSingleLine" turned off by default. A list of single-line variable
|
|
41
|
+
* declarations at the top of a class is common in TypeScript.
|
|
42
|
+
*/
|
|
43
|
+
"@typescript-eslint/lines-between-class-members": [
|
|
44
|
+
"warn",
|
|
45
|
+
"always",
|
|
46
|
+
{
|
|
47
|
+
exceptAfterSingleLine: true,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Documentation:
|
|
53
|
+
* https://typescript-eslint.io/rules/naming-convention
|
|
54
|
+
*
|
|
55
|
+
* Defined at:
|
|
56
|
+
* https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
57
|
+
*
|
|
58
|
+
* Modify the Airbnb config to allow for a leading underscore, which signifies that it is
|
|
59
|
+
* temporarily not being used.
|
|
60
|
+
*/
|
|
61
|
+
"@typescript-eslint/naming-convention": [
|
|
62
|
+
"warn",
|
|
63
|
+
// Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables
|
|
64
|
+
// (23.10).
|
|
65
|
+
{
|
|
66
|
+
selector: "variable",
|
|
67
|
+
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
68
|
+
leadingUnderscore: "allow",
|
|
69
|
+
},
|
|
70
|
+
// Allow camelCase functions (23.2), and PascalCase functions (23.8).
|
|
71
|
+
{
|
|
72
|
+
selector: "function",
|
|
73
|
+
format: ["camelCase", "PascalCase"],
|
|
74
|
+
leadingUnderscore: "allow",
|
|
75
|
+
},
|
|
76
|
+
// Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make
|
|
77
|
+
// TypeScript recommendations, we are assuming this rule would similarly apply to anything
|
|
78
|
+
// "type like", including interfaces, type aliases, and enums.
|
|
79
|
+
{
|
|
80
|
+
selector: "typeLike",
|
|
81
|
+
format: ["PascalCase"],
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Documentation:
|
|
87
|
+
* https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
|
|
88
|
+
*
|
|
89
|
+
* Not defined in the parent configs.
|
|
90
|
+
*
|
|
91
|
+
* This prevents useless code after refactoring variables to pure booleans.
|
|
92
|
+
*/
|
|
93
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Documentation:
|
|
97
|
+
* https://typescript-eslint.io/rules/no-unused-vars
|
|
98
|
+
*
|
|
99
|
+
* Defined at:
|
|
100
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js
|
|
101
|
+
*
|
|
102
|
+
* We want to lint unused arguments (the default is "after-used"). We also want to ignore
|
|
103
|
+
* arguments/variables that start with an underscore. This matches the behavior of the
|
|
104
|
+
* TypeScript compiler flag "--noUnusedLocals".
|
|
105
|
+
*/
|
|
106
|
+
"@typescript-eslint/no-unused-vars": [
|
|
107
|
+
"warn",
|
|
108
|
+
{
|
|
109
|
+
args: "all",
|
|
110
|
+
argsIgnorePattern: "^_",
|
|
111
|
+
varsIgnorePattern: "^_",
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Documentation:
|
|
117
|
+
* https://typescript-eslint.io/rules/no-use-before-define
|
|
118
|
+
*
|
|
119
|
+
* Defined at:
|
|
120
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js
|
|
121
|
+
*
|
|
122
|
+
* This allows code to be structured in a more logical order.
|
|
123
|
+
*/
|
|
124
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Documentation:
|
|
128
|
+
* https://typescript-eslint.io/rules/prefer-optional-chain
|
|
129
|
+
*
|
|
130
|
+
* Defined at:
|
|
131
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
|
|
132
|
+
*
|
|
133
|
+
* This can modify the type of boolean declarations to "boolean | undefined", which is undesired
|
|
134
|
+
* in some circumstances:
|
|
135
|
+
* https://github.com/typescript-eslint/typescript-eslint/issues/5269
|
|
136
|
+
*/
|
|
137
|
+
"@typescript-eslint/prefer-optional-chain": "off",
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Documentation:
|
|
141
|
+
* https://typescript-eslint.io/rules/quotes
|
|
142
|
+
*
|
|
143
|
+
* Defined at:
|
|
144
|
+
* https://github.com/prettier/eslint-config-prettier/blob/main/%40typescript-eslint.js
|
|
145
|
+
*
|
|
146
|
+
* In order to forbid unnecessary backticks, we must re-enable the "@typescript-eslint/quotes"
|
|
147
|
+
* rule as specified in the eslint-config-prettier documentation:
|
|
148
|
+
* https://github.com/prettier/eslint-config-prettier#enforce-backticks
|
|
149
|
+
*/
|
|
150
|
+
"@typescript-eslint/quotes": [
|
|
151
|
+
"warn",
|
|
152
|
+
"double",
|
|
153
|
+
{
|
|
154
|
+
avoidEscape: true,
|
|
155
|
+
allowTemplateLiterals: false,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Documentation:
|
|
161
|
+
* https://typescript-eslint.io/rules/restrict-template-expressions
|
|
162
|
+
*
|
|
163
|
+
* Defined at:
|
|
164
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts
|
|
165
|
+
*
|
|
166
|
+
* This rule disallows booleans and nulls in template expressions. However, a common use-case of
|
|
167
|
+
* template strings is to coerce everything to a string.
|
|
168
|
+
*/
|
|
169
|
+
"@typescript-eslint/restrict-template-expressions": "off",
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Documentation:
|
|
173
|
+
* https://typescript-eslint.io/rules/strict-boolean-expressions
|
|
174
|
+
*
|
|
175
|
+
* Not defined in the parent configs.
|
|
176
|
+
*
|
|
177
|
+
* This rule prevents bugs when refactoring a boolean to a number.
|
|
178
|
+
*/
|
|
179
|
+
"@typescript-eslint/strict-boolean-expressions": [
|
|
180
|
+
"warn",
|
|
181
|
+
{
|
|
182
|
+
allowString: false,
|
|
183
|
+
allowNumber: false,
|
|
184
|
+
allowNullableObject: false,
|
|
185
|
+
allowNullableBoolean: false,
|
|
186
|
+
allowNullableString: false,
|
|
187
|
+
allowNullableNumber: false,
|
|
188
|
+
allowAny: false,
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Documentation:
|
|
194
|
+
* https://typescript-eslint.io/rules/switch-exhaustiveness-check/
|
|
195
|
+
*
|
|
196
|
+
* Not defined in the parent configs.
|
|
197
|
+
*
|
|
198
|
+
* This rule ensures type-safety with switch statements, which can be especially helpful when
|
|
199
|
+
* values are added or removed from an enum.
|
|
200
|
+
*/
|
|
201
|
+
"@typescript-eslint/switch-exhaustiveness-check": "warn",
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
overrides: [
|
|
205
|
+
// Disable some TypeScript-specific rules in JavaScript files.
|
|
206
|
+
{
|
|
207
|
+
files: ["*.js", "*.cjs", "*.mjs", "*.jsx"],
|
|
208
|
+
rules: {
|
|
209
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
210
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
211
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
212
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
213
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
214
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
215
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
216
|
+
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
217
|
+
"isaacscript/no-object-any": "off",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
};
|
package/base.js
CHANGED
|
@@ -44,10 +44,15 @@ module.exports = {
|
|
|
44
44
|
*/
|
|
45
45
|
"plugin:eslint-comments/recommended",
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Lint Node-specific things:
|
|
49
|
+
* https://github.com/eslint-community/eslint-plugin-n
|
|
50
|
+
*/
|
|
51
|
+
"plugin:n/recommended",
|
|
52
|
+
|
|
47
53
|
/** Rule modifications are split out into different files for better organization. */
|
|
48
54
|
"./base-eslint",
|
|
49
|
-
|
|
50
|
-
/** Lint JSDoc comments. */
|
|
55
|
+
"./base-typescript-eslint",
|
|
51
56
|
"./base-jsdoc",
|
|
52
57
|
|
|
53
58
|
/**
|
|
@@ -59,9 +64,16 @@ module.exports = {
|
|
|
59
64
|
],
|
|
60
65
|
|
|
61
66
|
plugins: [
|
|
67
|
+
/**
|
|
68
|
+
* Activate the "no-autofix" plugin, which allows the fixer for specific rules to be turned off:
|
|
69
|
+
* https://github.com/aladdin-add/eslint-plugin/tree/master/packages/no-autofix
|
|
70
|
+
*/
|
|
71
|
+
"no-autofix",
|
|
72
|
+
|
|
62
73
|
/**
|
|
63
74
|
* Activate the "no-type-assertion" plugin, which allows the "no-type-assertion" rule to be
|
|
64
|
-
* optionally enabled on a per-project basis
|
|
75
|
+
* optionally enabled on a per-project basis:
|
|
76
|
+
* https://github.com/Dremora/eslint-plugin-no-type-assertion
|
|
65
77
|
*/
|
|
66
78
|
"no-type-assertion",
|
|
67
79
|
|
|
@@ -76,450 +88,246 @@ module.exports = {
|
|
|
76
88
|
|
|
77
89
|
/**
|
|
78
90
|
* Activate the "sort-exports" plugin, which allows the "sort-exports" rule to be optionally
|
|
79
|
-
* enabled on a per-project basis
|
|
91
|
+
* enabled on a per-project basis:
|
|
92
|
+
* https://github.com/jrdrg/eslint-plugin-sort-exports
|
|
80
93
|
*/
|
|
81
94
|
"sort-exports",
|
|
82
|
-
],
|
|
83
|
-
|
|
84
|
-
rules: {
|
|
85
|
-
/**
|
|
86
|
-
* Documentation:
|
|
87
|
-
* https://typescript-eslint.io/rules/array-type
|
|
88
|
-
*
|
|
89
|
-
* Not defined in the parent configs.
|
|
90
|
-
*
|
|
91
|
-
* Prefer the "string[]" syntax over "Array<string>".
|
|
92
|
-
*/
|
|
93
|
-
"@typescript-eslint/array-type": [
|
|
94
|
-
"warn",
|
|
95
|
-
{
|
|
96
|
-
default: "array-simple",
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
95
|
|
|
100
96
|
/**
|
|
101
|
-
*
|
|
102
|
-
* https://
|
|
103
|
-
*
|
|
104
|
-
* Not defined in the parent configs.
|
|
105
|
-
*
|
|
106
|
-
* Specifying explicit return types can help prevent bugs, but only require it on exported
|
|
107
|
-
* functions.
|
|
97
|
+
* Activate the "unicorn" plugin, which allows for various miscellaneous useful rules:
|
|
98
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
108
99
|
*/
|
|
109
|
-
"
|
|
100
|
+
"unicorn",
|
|
101
|
+
],
|
|
110
102
|
|
|
103
|
+
rules: {
|
|
111
104
|
/**
|
|
112
105
|
* Documentation:
|
|
113
|
-
* https://
|
|
106
|
+
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/docs/rules/disable-enable-pair.md
|
|
114
107
|
*
|
|
115
108
|
* Defined at:
|
|
116
|
-
* https://github.com/
|
|
109
|
+
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/lib/configs/recommended.js
|
|
117
110
|
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
111
|
+
* By default, it does not allow "eslint-disable" comments for a whole file, which is standard
|
|
112
|
+
* practice.
|
|
120
113
|
*/
|
|
121
|
-
"
|
|
114
|
+
"eslint-comments/disable-enable-pair": [
|
|
122
115
|
"warn",
|
|
123
|
-
"always",
|
|
124
116
|
{
|
|
125
|
-
|
|
117
|
+
allowWholeFile: true,
|
|
126
118
|
},
|
|
127
119
|
],
|
|
128
120
|
|
|
129
121
|
/**
|
|
130
122
|
* Documentation:
|
|
131
|
-
* https://
|
|
123
|
+
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/docs/rules/no-unlimited-disable.md
|
|
132
124
|
*
|
|
133
125
|
* Defined at:
|
|
134
|
-
* https://github.com/
|
|
126
|
+
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/lib/configs/recommended.js
|
|
135
127
|
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
128
|
+
* If a line breaks two or more ESLint rules, then it is useful to use a single "eslint-disable"
|
|
129
|
+
* comment.
|
|
138
130
|
*/
|
|
139
|
-
"
|
|
140
|
-
"warn",
|
|
141
|
-
// Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables
|
|
142
|
-
// (23.10).
|
|
143
|
-
{
|
|
144
|
-
selector: "variable",
|
|
145
|
-
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
146
|
-
leadingUnderscore: "allow",
|
|
147
|
-
},
|
|
148
|
-
// Allow camelCase functions (23.2), and PascalCase functions (23.8).
|
|
149
|
-
{
|
|
150
|
-
selector: "function",
|
|
151
|
-
format: ["camelCase", "PascalCase"],
|
|
152
|
-
leadingUnderscore: "allow",
|
|
153
|
-
},
|
|
154
|
-
// Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make
|
|
155
|
-
// TypeScript recommendations, we are assuming this rule would similarly apply to anything
|
|
156
|
-
// "type like", including interfaces, type aliases, and enums.
|
|
157
|
-
{
|
|
158
|
-
selector: "typeLike",
|
|
159
|
-
format: ["PascalCase"],
|
|
160
|
-
},
|
|
161
|
-
],
|
|
131
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
162
132
|
|
|
163
133
|
/**
|
|
164
134
|
* Documentation:
|
|
165
|
-
* https://
|
|
135
|
+
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/docs/rules/no-unused-disable.md
|
|
166
136
|
*
|
|
167
137
|
* Not defined in the parent configs.
|
|
168
138
|
*
|
|
169
|
-
* This
|
|
170
|
-
*/
|
|
171
|
-
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Documentation:
|
|
175
|
-
* https://typescript-eslint.io/rules/no-unused-vars
|
|
176
|
-
*
|
|
177
|
-
* Defined at:
|
|
178
|
-
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js
|
|
179
|
-
*
|
|
180
|
-
* We want to lint unused arguments (the default is "after-used"). We also want to ignore
|
|
181
|
-
* arguments/variables that start with an underscore. This matches the behavior of the
|
|
182
|
-
* TypeScript compiler flag "--noUnusedLocals".
|
|
139
|
+
* This can help clean up unnecessary comments.
|
|
183
140
|
*/
|
|
184
|
-
"
|
|
185
|
-
"warn",
|
|
186
|
-
{
|
|
187
|
-
args: "all",
|
|
188
|
-
argsIgnorePattern: "^_",
|
|
189
|
-
varsIgnorePattern: "^_",
|
|
190
|
-
},
|
|
191
|
-
],
|
|
141
|
+
"eslint-comments/no-unused-disable": "warn",
|
|
192
142
|
|
|
193
143
|
/**
|
|
194
144
|
* Documentation:
|
|
195
|
-
* https://
|
|
145
|
+
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/extensions.md
|
|
196
146
|
*
|
|
197
147
|
* Defined at:
|
|
198
|
-
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/
|
|
148
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js
|
|
149
|
+
* https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
199
150
|
*
|
|
200
|
-
* This
|
|
151
|
+
* This rule is useful in commonjs codebases that want to ban file extensions on imports.
|
|
152
|
+
* However, ESM is now the standard and file extensions should be used. Furthermore, in
|
|
153
|
+
* TypeScript codebases, the compiler will alert us to any errors on a file extension in an
|
|
154
|
+
* import statement.
|
|
201
155
|
*/
|
|
202
|
-
"
|
|
156
|
+
"import/extensions": "off",
|
|
203
157
|
|
|
204
158
|
/**
|
|
205
159
|
* Documentation:
|
|
206
|
-
* https://
|
|
160
|
+
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
|
|
207
161
|
*
|
|
208
|
-
*
|
|
209
|
-
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
|
|
162
|
+
* Not defined in the parent configs.
|
|
210
163
|
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* https://github.com/typescript-eslint/typescript-eslint/issues/5269
|
|
164
|
+
* The case against default exports is layed out here:
|
|
165
|
+
* https://basarat.gitbook.io/typescript/main-1/defaultisbad
|
|
214
166
|
*/
|
|
215
|
-
"
|
|
167
|
+
"import/no-default-export": "warn",
|
|
216
168
|
|
|
217
169
|
/**
|
|
218
170
|
* Documentation:
|
|
219
|
-
* https://
|
|
171
|
+
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md
|
|
220
172
|
*
|
|
221
173
|
* Defined at:
|
|
222
|
-
* https://github.com/
|
|
174
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js
|
|
223
175
|
*
|
|
224
|
-
*
|
|
225
|
-
* rule as specified in the eslint-config-prettier documentation:
|
|
226
|
-
* https://github.com/prettier/eslint-config-prettier#enforce-backticks
|
|
176
|
+
* It is a useful rule and it is turned off in the parent configs with no explanation.
|
|
227
177
|
*/
|
|
228
|
-
"
|
|
229
|
-
"warn",
|
|
230
|
-
"double",
|
|
231
|
-
{
|
|
232
|
-
avoidEscape: true,
|
|
233
|
-
allowTemplateLiterals: false,
|
|
234
|
-
},
|
|
235
|
-
],
|
|
178
|
+
"import/no-deprecated": "off",
|
|
236
179
|
|
|
237
180
|
/**
|
|
238
181
|
* Documentation:
|
|
239
|
-
* https://
|
|
182
|
+
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md
|
|
240
183
|
*
|
|
241
184
|
* Defined at:
|
|
242
|
-
* https://github.com/
|
|
243
|
-
*
|
|
244
|
-
* This rule disallows booleans and nulls in template expressions. However, a common use-case of
|
|
245
|
-
* template strings is to coerce everything to a string.
|
|
246
|
-
*/
|
|
247
|
-
"@typescript-eslint/restrict-template-expressions": "off",
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Documentation:
|
|
251
|
-
* https://typescript-eslint.io/rules/strict-boolean-expressions
|
|
252
|
-
*
|
|
253
|
-
* Not defined in the parent configs.
|
|
254
|
-
*
|
|
255
|
-
* This rule prevents bugs when refactoring a boolean to a number.
|
|
256
|
-
*/
|
|
257
|
-
"@typescript-eslint/strict-boolean-expressions": [
|
|
258
|
-
"warn",
|
|
259
|
-
{
|
|
260
|
-
allowString: false,
|
|
261
|
-
allowNumber: false,
|
|
262
|
-
allowNullableObject: false,
|
|
263
|
-
allowNullableBoolean: false,
|
|
264
|
-
allowNullableString: false,
|
|
265
|
-
allowNullableNumber: false,
|
|
266
|
-
allowAny: false,
|
|
267
|
-
},
|
|
268
|
-
],
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Documentation:
|
|
272
|
-
* https://typescript-eslint.io/rules/switch-exhaustiveness-check/
|
|
273
|
-
*
|
|
274
|
-
* Not defined in the parent configs.
|
|
185
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js
|
|
275
186
|
*
|
|
276
|
-
* This rule
|
|
277
|
-
*
|
|
187
|
+
* This rule is not necessary in TypeScript codebases, since the compiler would error if you had
|
|
188
|
+
* a typo in an import statement.
|
|
278
189
|
*/
|
|
279
|
-
"
|
|
190
|
+
"import/no-unresolved": "off",
|
|
280
191
|
|
|
281
192
|
/**
|
|
282
193
|
* Documentation:
|
|
283
|
-
* https://
|
|
194
|
+
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/prefer-default-export.md
|
|
284
195
|
*
|
|
285
196
|
* Defined at:
|
|
286
|
-
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/
|
|
197
|
+
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js
|
|
287
198
|
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
* https://github.com/typescript-eslint/typescript-eslint/issues/5254
|
|
199
|
+
* The case against default exports is layed out here:
|
|
200
|
+
* https://basarat.gitbook.io/typescript/main-1/defaultisbad
|
|
291
201
|
*/
|
|
292
|
-
"
|
|
202
|
+
"import/prefer-default-export": "off",
|
|
293
203
|
|
|
294
204
|
/**
|
|
295
205
|
* Documentation:
|
|
296
|
-
* https://
|
|
206
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-import.md
|
|
297
207
|
*
|
|
298
208
|
* Defined at:
|
|
299
|
-
* https://github.com/
|
|
300
|
-
*
|
|
301
|
-
* Always requiring curly braces can partially ward against Apple-style if statement bugs:
|
|
302
|
-
* https://www.imperialviolet.org/2014/02/22/applebug.html
|
|
209
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
303
210
|
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
* https://github.com/prettier/eslint-config-prettier#curly
|
|
211
|
+
* The TypeScript compiler will warn us if an import does not exist, so this rule is
|
|
212
|
+
* unnecessary.
|
|
307
213
|
*/
|
|
308
|
-
|
|
214
|
+
"n/no-extraneous-import": "off",
|
|
309
215
|
|
|
310
216
|
/**
|
|
311
217
|
* Documentation:
|
|
312
|
-
* https://
|
|
218
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-require.md
|
|
313
219
|
*
|
|
314
220
|
* Defined at:
|
|
315
|
-
* https://github.com/
|
|
221
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
316
222
|
*
|
|
317
|
-
*
|
|
318
|
-
* https://github.com/typescript-eslint/typescript-eslint/issues/5254
|
|
223
|
+
* Require statements are not used in TypeScript code.
|
|
319
224
|
*/
|
|
320
|
-
"
|
|
225
|
+
"n/no-extraneous-require": "off",
|
|
321
226
|
|
|
322
227
|
/**
|
|
323
228
|
* Documentation:
|
|
324
|
-
* https://github.com/
|
|
229
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-missing-import.md
|
|
325
230
|
*
|
|
326
231
|
* Defined at:
|
|
327
|
-
* https://github.com/
|
|
232
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
328
233
|
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
234
|
+
* The TypeScript compiler will warn us if an import does not exist, so this rule is
|
|
235
|
+
* unnecessary.
|
|
331
236
|
*/
|
|
332
|
-
"
|
|
333
|
-
"warn",
|
|
334
|
-
{
|
|
335
|
-
allowWholeFile: true,
|
|
336
|
-
},
|
|
337
|
-
],
|
|
237
|
+
"n/no-missing-import": "off",
|
|
338
238
|
|
|
339
239
|
/**
|
|
340
240
|
* Documentation:
|
|
341
|
-
* https://github.com/
|
|
241
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-exit.md
|
|
342
242
|
*
|
|
343
243
|
* Defined at:
|
|
344
|
-
* https://github.com/
|
|
244
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
345
245
|
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
246
|
+
* Using "process.exit" allows the ability to exit command-line applications without verbose
|
|
247
|
+
* output.
|
|
348
248
|
*/
|
|
349
|
-
"
|
|
249
|
+
"n/no-process-exit": "off",
|
|
350
250
|
|
|
351
251
|
/**
|
|
352
252
|
* Documentation:
|
|
353
|
-
* https://github.com/
|
|
354
|
-
*
|
|
355
|
-
* Not defined in the parent configs.
|
|
356
|
-
*
|
|
357
|
-
* This can help clean up unnecessary comments.
|
|
358
|
-
*/
|
|
359
|
-
"eslint-comments/no-unused-disable": "warn",
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Documentation:
|
|
363
|
-
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
|
|
364
|
-
*
|
|
365
|
-
* Not defined in the parent configs.
|
|
366
|
-
*
|
|
367
|
-
* The case against default exports is layed out here:
|
|
368
|
-
* https://basarat.gitbook.io/typescript/main-1/defaultisbad
|
|
369
|
-
*/
|
|
370
|
-
"import/no-default-export": "warn",
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Documentation:
|
|
374
|
-
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md
|
|
253
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-syntax.md
|
|
375
254
|
*
|
|
376
255
|
* Defined at:
|
|
377
|
-
* https://github.com/
|
|
256
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
378
257
|
*
|
|
379
|
-
*
|
|
258
|
+
* This rule requires adding `parserOptions.ecmaVersion` to every ESLint configuration file. The
|
|
259
|
+
* rule does not provide enough value to make that modification worth it.
|
|
380
260
|
*/
|
|
381
|
-
"
|
|
261
|
+
"n/no-unsupported-features/es-syntax": "off",
|
|
382
262
|
|
|
383
263
|
/**
|
|
384
264
|
* Documentation:
|
|
385
|
-
* https://github.com/
|
|
265
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-syntax.md
|
|
386
266
|
*
|
|
387
267
|
* Defined at:
|
|
388
|
-
* https://github.com/
|
|
268
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
389
269
|
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
270
|
+
* This rule requires adding `parserOptions.ecmaVersion` to every ESLint configuration file. The
|
|
271
|
+
* rule does not provide enough value to make that modification worth it.
|
|
392
272
|
*/
|
|
393
|
-
"
|
|
273
|
+
"n/no-unsupported-features/es-builtins": "off",
|
|
394
274
|
|
|
395
275
|
/**
|
|
396
276
|
* Documentation:
|
|
397
|
-
* https://
|
|
277
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/node-builtins.md
|
|
398
278
|
*
|
|
399
279
|
* Defined at:
|
|
400
|
-
* https://github.com/
|
|
401
|
-
*
|
|
402
|
-
* Command-line programs commonly write to standard out and standard error.
|
|
403
|
-
*/
|
|
404
|
-
"no-console": "off",
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Documentation:
|
|
408
|
-
* https://eslint.org/docs/latest/rules/no-constant-binary-expression
|
|
409
|
-
*
|
|
410
|
-
* Not defined in parent configs.
|
|
280
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
411
281
|
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
282
|
+
* The TypeScript compiler will prevent us from using Node modules that are not present in the
|
|
283
|
+
* corresponding specified Node output environment, so this rule is unnecessary.
|
|
414
284
|
*/
|
|
415
|
-
"no-
|
|
285
|
+
"n/no-unsupported-features/node-builtins": "off",
|
|
416
286
|
|
|
417
287
|
/**
|
|
418
288
|
* Documentation:
|
|
419
|
-
* https://
|
|
289
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/shebang.md
|
|
420
290
|
*
|
|
421
291
|
* Defined at:
|
|
422
|
-
* https://github.com/
|
|
292
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/configs/_commons.js
|
|
423
293
|
*
|
|
424
|
-
*
|
|
294
|
+
* We need to configure this rule to be Typescript-aware.
|
|
425
295
|
*/
|
|
426
|
-
"
|
|
296
|
+
"n/shebang": [
|
|
297
|
+
"error",
|
|
298
|
+
{
|
|
299
|
+
convertPath: {
|
|
300
|
+
"src/**/*.ts": ["^src/(.+?)\\.ts$", "dist/$1.js"],
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
],
|
|
427
304
|
|
|
428
305
|
/**
|
|
429
306
|
* Documentation:
|
|
430
|
-
* https://
|
|
431
|
-
*
|
|
432
|
-
* Defined at:
|
|
433
|
-
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
307
|
+
* https://github.com/aladdin-add/eslint-plugin/tree/master/packages/no-autofix
|
|
434
308
|
*
|
|
435
|
-
*
|
|
436
|
-
* it adds semi-colons everywhere, so we don't have to worry about this.
|
|
309
|
+
* We want to disable the autofix for this rule, since it is almost always unwanted.
|
|
437
310
|
*/
|
|
438
|
-
"no-
|
|
311
|
+
"no-useless-return": "off",
|
|
312
|
+
"no-autofix/no-useless-return": "warn",
|
|
439
313
|
|
|
440
314
|
/**
|
|
441
315
|
* Documentation:
|
|
442
|
-
* https://
|
|
443
|
-
*
|
|
444
|
-
* Defined at:
|
|
445
|
-
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
316
|
+
* https://github.com/aladdin-add/eslint-plugin/tree/master/packages/no-autofix
|
|
446
317
|
*
|
|
447
|
-
*
|
|
448
|
-
* - We add a selector for "empty" invocations of the "array.push()" method.
|
|
318
|
+
* We want to disable the autofix for this rule, since it is almost always unwanted.
|
|
449
319
|
*/
|
|
450
|
-
"
|
|
451
|
-
|
|
452
|
-
{
|
|
453
|
-
selector: "ForInStatement",
|
|
454
|
-
message:
|
|
455
|
-
"for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
selector: "LabeledStatement",
|
|
459
|
-
message:
|
|
460
|
-
"Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
selector: "WithStatement",
|
|
464
|
-
message:
|
|
465
|
-
"`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
selector:
|
|
469
|
-
"CallExpression[callee.property.name='push'][arguments.length=0]",
|
|
470
|
-
message: "push must always be called with at least one argument.",
|
|
471
|
-
},
|
|
472
|
-
],
|
|
320
|
+
"prefer-const": "off",
|
|
321
|
+
"no-autofix/prefer-const": "warn",
|
|
473
322
|
|
|
474
323
|
/**
|
|
475
324
|
* Documentation:
|
|
476
|
-
* https://
|
|
325
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
477
326
|
*
|
|
478
327
|
* Not defined in parent configs.
|
|
479
328
|
*
|
|
480
|
-
*
|
|
329
|
+
* Enforce the new "node:" prefix as an extra safety measure.
|
|
481
330
|
*/
|
|
482
|
-
"
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Documentation:
|
|
486
|
-
* https://eslint.org/docs/latest/rules/prefer-destructuring
|
|
487
|
-
*
|
|
488
|
-
* Defined at:
|
|
489
|
-
* https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/es6.js
|
|
490
|
-
*
|
|
491
|
-
* Array destructuring can result in non-intuitive code.
|
|
492
|
-
*/
|
|
493
|
-
"prefer-destructuring": [
|
|
494
|
-
"warn",
|
|
495
|
-
{
|
|
496
|
-
VariableDeclarator: {
|
|
497
|
-
array: false,
|
|
498
|
-
object: true,
|
|
499
|
-
},
|
|
500
|
-
AssignmentExpression: {
|
|
501
|
-
array: false,
|
|
502
|
-
object: false,
|
|
503
|
-
},
|
|
504
|
-
},
|
|
505
|
-
],
|
|
331
|
+
"unicorn/prefer-node-protocol": "warn",
|
|
506
332
|
},
|
|
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
|
-
],
|
|
525
333
|
};
|
package/monorepo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const path = require("path");
|
|
1
|
+
const path = require("node:path");
|
|
2
2
|
|
|
3
3
|
const REPO_ROOT = path.join(__dirname, "..", "..");
|
|
4
4
|
|
|
@@ -16,6 +16,7 @@ module.exports = {
|
|
|
16
16
|
tsconfigRootDir: REPO_ROOT,
|
|
17
17
|
},
|
|
18
18
|
|
|
19
|
+
// The ".prettierrc.cjs" file is ignored by default, so we have to un-ignore it.
|
|
19
20
|
ignorePatterns: ["!.prettierrc.cjs"],
|
|
20
21
|
|
|
21
22
|
rules: {
|