@newsteam/eslint-config 1.2.18 → 1.2.20
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/plugins/sort-react-dependency-arrays.d.ts.map +1 -1
- package/dist/plugins/sort-react-dependency-arrays.js +33 -32
- package/dist/rules/css-modules.js +4 -4
- package/dist/rules/eslint-comments.d.ts.map +1 -1
- package/dist/rules/eslint-comments.js +0 -6
- package/dist/rules/import-newlines.js +1 -1
- package/dist/rules/import-x.d.ts.map +1 -1
- package/dist/rules/import-x.js +8 -10
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/index.js +19 -14
- package/dist/rules/next.js +1 -1
- package/dist/rules/perfectionist.d.ts.map +1 -1
- package/dist/rules/perfectionist.js +2 -0
- package/dist/rules/react-19-upgrade.d.ts.map +1 -1
- package/dist/rules/react-19-upgrade.js +7 -0
- package/dist/rules/react-hooks.d.ts.map +1 -1
- package/dist/rules/react-hooks.js +9 -11
- package/dist/rules/react-performance.d.ts +3 -0
- package/dist/rules/react-performance.d.ts.map +1 -0
- package/dist/rules/{react-perf.js → react-performance.js} +1 -1
- package/dist/rules/react.d.ts.map +1 -1
- package/dist/rules/react.js +14 -12
- package/dist/rules/security.js +6 -6
- package/dist/rules/stylistic.d.ts.map +1 -1
- package/dist/rules/stylistic.js +96 -109
- package/dist/rules/typescript.d.ts.map +1 -1
- package/dist/rules/typescript.js +14 -1
- package/dist/rules/unicorn.d.ts.map +1 -1
- package/dist/rules/unicorn.js +1239 -80
- package/dist/settings.d.ts +2 -2
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +2 -2
- package/package.json +35 -33
- package/dist/rules/no-unsanitized.d.ts +0 -3
- package/dist/rules/no-unsanitized.d.ts.map +0 -1
- package/dist/rules/no-unsanitized.js +0 -38
- package/dist/rules/react-compiler.d.ts +0 -3
- package/dist/rules/react-compiler.d.ts.map +0 -1
- package/dist/rules/react-compiler.js +0 -14
- package/dist/rules/react-perf.d.ts +0 -3
- package/dist/rules/react-perf.d.ts.map +0 -1
package/dist/rules/unicorn.js
CHANGED
|
@@ -21,11 +21,11 @@ export const unicornPluginConfig = {
|
|
|
21
21
|
},
|
|
22
22
|
rules: {
|
|
23
23
|
/*
|
|
24
|
-
*
|
|
24
|
+
* Prefer more readable and robust DOM traversal APIs.
|
|
25
25
|
*
|
|
26
|
-
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-
|
|
26
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-dom-traversing.md
|
|
27
27
|
*/
|
|
28
|
-
"unicorn/better-
|
|
28
|
+
"unicorn/better-dom-traversing": "warn",
|
|
29
29
|
/*
|
|
30
30
|
* Enforce a specific parameter name in catch clauses.
|
|
31
31
|
*
|
|
@@ -37,12 +37,78 @@ export const unicornPluginConfig = {
|
|
|
37
37
|
name: "error",
|
|
38
38
|
},
|
|
39
39
|
],
|
|
40
|
+
/*
|
|
41
|
+
* Enforce consistent class references in static methods.
|
|
42
|
+
*
|
|
43
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/class-reference-in-static-methods.md
|
|
44
|
+
*/
|
|
45
|
+
"unicorn/class-reference-in-static-methods": "warn",
|
|
46
|
+
/*
|
|
47
|
+
* Enforce better comment content.
|
|
48
|
+
*
|
|
49
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/comment-content.md
|
|
50
|
+
*/
|
|
51
|
+
"unicorn/comment-content": "warn",
|
|
40
52
|
/*
|
|
41
53
|
* Enforce consistent assertion style with node:assert
|
|
42
54
|
*
|
|
43
55
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-assert.md
|
|
44
56
|
*/
|
|
45
57
|
"unicorn/consistent-assert": "warn",
|
|
58
|
+
/*
|
|
59
|
+
* Enforce consistent naming for boolean names.
|
|
60
|
+
*
|
|
61
|
+
* Off for now because it's lacking some features we need (that the docs say it should have).
|
|
62
|
+
*
|
|
63
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-boolean-name.md
|
|
64
|
+
*/
|
|
65
|
+
"unicorn/consistent-boolean-name": [
|
|
66
|
+
"off",
|
|
67
|
+
{
|
|
68
|
+
// This needs ignore: ["value"], but even though the docs say that exists, it doesn't yet
|
|
69
|
+
prefixes: {
|
|
70
|
+
allow: true,
|
|
71
|
+
enable: true,
|
|
72
|
+
includes: true,
|
|
73
|
+
use: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
/*
|
|
78
|
+
* Enforce consistent class member order.
|
|
79
|
+
*
|
|
80
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-class-member-order.md
|
|
81
|
+
*/
|
|
82
|
+
"unicorn/consistent-class-member-order": [
|
|
83
|
+
"warn",
|
|
84
|
+
{
|
|
85
|
+
order: [
|
|
86
|
+
"static-field",
|
|
87
|
+
"public-field",
|
|
88
|
+
"private-field",
|
|
89
|
+
"static-block",
|
|
90
|
+
"constructor",
|
|
91
|
+
"static-method",
|
|
92
|
+
"public-method",
|
|
93
|
+
"private-method",
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
/*
|
|
98
|
+
* Enforce consistent spelling of compound words in identifiers.
|
|
99
|
+
*
|
|
100
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-compound-words.md
|
|
101
|
+
*/
|
|
102
|
+
"unicorn/consistent-compound-words": "warn",
|
|
103
|
+
/*
|
|
104
|
+
* Enforce consistent conditional object spread style.
|
|
105
|
+
*
|
|
106
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-conditional-object-spread.md
|
|
107
|
+
*/
|
|
108
|
+
"unicorn/consistent-conditional-object-spread": [
|
|
109
|
+
"warn",
|
|
110
|
+
"ternary",
|
|
111
|
+
],
|
|
46
112
|
/*
|
|
47
113
|
* Prefer passing Date directly to the constructor when cloning
|
|
48
114
|
*
|
|
@@ -67,18 +133,78 @@ export const unicornPluginConfig = {
|
|
|
67
133
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-existence-index-check.md
|
|
68
134
|
*/
|
|
69
135
|
"unicorn/consistent-existence-index-check": "warn",
|
|
136
|
+
/*
|
|
137
|
+
* Enforce consistent decorator position on exported classes.
|
|
138
|
+
*
|
|
139
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-export-decorator-position.md
|
|
140
|
+
*/
|
|
141
|
+
"unicorn/consistent-export-decorator-position": "warn",
|
|
70
142
|
/*
|
|
71
143
|
* Move function definitions to the highest possible scope.
|
|
72
144
|
*
|
|
73
145
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-function-scoping.md
|
|
74
146
|
*/
|
|
75
147
|
"unicorn/consistent-function-scoping": "warn",
|
|
148
|
+
/*
|
|
149
|
+
* Enforce function syntax by role.
|
|
150
|
+
*
|
|
151
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-function-style.md
|
|
152
|
+
*/
|
|
153
|
+
"unicorn/consistent-function-style": [
|
|
154
|
+
"warn",
|
|
155
|
+
{
|
|
156
|
+
// FUCK YEAH ARROW FUNCTIONS
|
|
157
|
+
callbacks: "arrow-function",
|
|
158
|
+
default: "arrow-function",
|
|
159
|
+
namedExports: "arrow-function",
|
|
160
|
+
namedFunctions: "arrow-function",
|
|
161
|
+
objectProperties: "arrow-function",
|
|
162
|
+
reassignedVariables: "arrow-function",
|
|
163
|
+
typedVariables: "arrow-function",
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
/*
|
|
167
|
+
* Enforce consistent JSON file reads before `JSON.parse()`.
|
|
168
|
+
*
|
|
169
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-json-file-read.md
|
|
170
|
+
*/
|
|
171
|
+
"unicorn/consistent-json-file-read": "warn",
|
|
172
|
+
/*
|
|
173
|
+
* Enforce consistent optional chaining for same-base member access.
|
|
174
|
+
*
|
|
175
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-optional-chaining.md
|
|
176
|
+
*/
|
|
177
|
+
"unicorn/consistent-optional-chaining": "warn",
|
|
178
|
+
/*
|
|
179
|
+
* Enforce consistent style for escaping ${ in template literals.
|
|
180
|
+
*
|
|
181
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-template-literal-escape.md
|
|
182
|
+
*/
|
|
183
|
+
"unicorn/consistent-template-literal-escape": "warn",
|
|
184
|
+
/*
|
|
185
|
+
* Enforce consistent labels on tuple type elements.
|
|
186
|
+
*
|
|
187
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-tuple-labels.md
|
|
188
|
+
*/
|
|
189
|
+
"unicorn/consistent-tuple-labels": "warn",
|
|
76
190
|
/*
|
|
77
191
|
* Enforce correct Error subclassing. (fixable)
|
|
78
192
|
*
|
|
79
193
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/custom-error-definition.md
|
|
80
194
|
*/
|
|
81
195
|
"unicorn/custom-error-definition": "warn",
|
|
196
|
+
/*
|
|
197
|
+
* Enforce consistent default export declarations.
|
|
198
|
+
*
|
|
199
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/default-export-style.md
|
|
200
|
+
*/
|
|
201
|
+
"unicorn/default-export-style": "warn",
|
|
202
|
+
/*
|
|
203
|
+
* Enforce consistent style for DOM element dataset access.
|
|
204
|
+
*
|
|
205
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/dom-node-dataset.md
|
|
206
|
+
*/
|
|
207
|
+
"unicorn/dom-node-dataset": "warn",
|
|
82
208
|
/*
|
|
83
209
|
* Enforce no spaces between braces. (fixable)
|
|
84
210
|
*
|
|
@@ -109,6 +235,12 @@ export const unicornPluginConfig = {
|
|
|
109
235
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/explicit-length-check.md
|
|
110
236
|
*/
|
|
111
237
|
"unicorn/explicit-length-check": "warn",
|
|
238
|
+
/*
|
|
239
|
+
* Enforce or disallow explicit `delay` argument for `setTimeout()` and `setInterval()`.
|
|
240
|
+
*
|
|
241
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/explicit-timer-delay.md
|
|
242
|
+
*/
|
|
243
|
+
"unicorn/explicit-timer-delay": "warn",
|
|
112
244
|
/*
|
|
113
245
|
* Enforce a case style for filenames.
|
|
114
246
|
*
|
|
@@ -120,6 +252,14 @@ export const unicornPluginConfig = {
|
|
|
120
252
|
case: "kebabCase",
|
|
121
253
|
},
|
|
122
254
|
],
|
|
255
|
+
/*
|
|
256
|
+
* Require identifiers to match a specified regular expression.
|
|
257
|
+
*
|
|
258
|
+
* Wasn't on when it was handled by the ESLint config, turning it on isn't great.
|
|
259
|
+
*
|
|
260
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/id-match.md
|
|
261
|
+
*/
|
|
262
|
+
"unicorn/id-match": "off",
|
|
123
263
|
/*
|
|
124
264
|
* Enforce specific import styles per module
|
|
125
265
|
*
|
|
@@ -134,6 +274,82 @@ export const unicornPluginConfig = {
|
|
|
134
274
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/isolated-functions.md
|
|
135
275
|
*/
|
|
136
276
|
"unicorn/isolated-functions": "warn",
|
|
277
|
+
/*
|
|
278
|
+
* Require or disallow logical assignment operator shorthand
|
|
279
|
+
*
|
|
280
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/logical-assignment-operators.md
|
|
281
|
+
*/
|
|
282
|
+
"unicorn/logical-assignment-operators": [
|
|
283
|
+
"warn",
|
|
284
|
+
"always",
|
|
285
|
+
],
|
|
286
|
+
/*
|
|
287
|
+
* Limit the depth of nested calls.
|
|
288
|
+
*
|
|
289
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/max-nested-calls.md
|
|
290
|
+
*/
|
|
291
|
+
"unicorn/max-nested-calls": [
|
|
292
|
+
"warn",
|
|
293
|
+
{
|
|
294
|
+
max: 3,
|
|
295
|
+
},
|
|
296
|
+
],
|
|
297
|
+
/*
|
|
298
|
+
* Enforce replacements for variable, property, and filenames.
|
|
299
|
+
*
|
|
300
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/name-replacements.md
|
|
301
|
+
*/
|
|
302
|
+
"unicorn/name-replacements": [
|
|
303
|
+
"warn",
|
|
304
|
+
{
|
|
305
|
+
ignore: [
|
|
306
|
+
/^arg*/ui,
|
|
307
|
+
/^utils*/ui,
|
|
308
|
+
],
|
|
309
|
+
replacements: {
|
|
310
|
+
args: {
|
|
311
|
+
// This is a reserved keyword in some cases - don't replace into this
|
|
312
|
+
arguments: false,
|
|
313
|
+
},
|
|
314
|
+
deps: {
|
|
315
|
+
// Term isn't overloaded - allow abbreviation
|
|
316
|
+
dependencies: false,
|
|
317
|
+
},
|
|
318
|
+
dev: {
|
|
319
|
+
// Term isn't overloaded - allow abbreviation
|
|
320
|
+
development: false,
|
|
321
|
+
},
|
|
322
|
+
doc: {
|
|
323
|
+
// Term isn't overloaded - allow abbreviation
|
|
324
|
+
document: false,
|
|
325
|
+
},
|
|
326
|
+
docs: {
|
|
327
|
+
// Term isn't overloaded - allow abbreviation
|
|
328
|
+
documents: false,
|
|
329
|
+
},
|
|
330
|
+
env: {
|
|
331
|
+
// Term isn't overloaded - allow abbreviation
|
|
332
|
+
environment: false,
|
|
333
|
+
},
|
|
334
|
+
envs: {
|
|
335
|
+
// Term isn't overloaded - allow abbreviation
|
|
336
|
+
environments: false,
|
|
337
|
+
},
|
|
338
|
+
param: {
|
|
339
|
+
// This is used extremely frequently in react-router-dom and we don't want to change it
|
|
340
|
+
parameter: false,
|
|
341
|
+
},
|
|
342
|
+
params: {
|
|
343
|
+
// This is used extremely frequently in react-router-dom and we don't want to change it
|
|
344
|
+
parameters: false,
|
|
345
|
+
},
|
|
346
|
+
props: {
|
|
347
|
+
// This is used extremely frequently in react and we don't want to change it
|
|
348
|
+
properties: false,
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
],
|
|
137
353
|
/*
|
|
138
354
|
* Enforce the use of new for all builtins, except String, Number and Boolean. (fixable)
|
|
139
355
|
*
|
|
@@ -152,6 +368,12 @@ export const unicornPluginConfig = {
|
|
|
152
368
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-accessor-recursion.md
|
|
153
369
|
*/
|
|
154
370
|
"unicorn/no-accessor-recursion": "warn",
|
|
371
|
+
/*
|
|
372
|
+
* Disallow bitwise operators where a logical operator was likely intended.
|
|
373
|
+
*
|
|
374
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-accidental-bitwise-operator.md
|
|
375
|
+
*/
|
|
376
|
+
"unicorn/no-accidental-bitwise-operator": "warn",
|
|
155
377
|
/*
|
|
156
378
|
* Disallow anonymous functions and classes as the default export
|
|
157
379
|
*
|
|
@@ -164,6 +386,18 @@ export const unicornPluginConfig = {
|
|
|
164
386
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-callback-reference.md
|
|
165
387
|
*/
|
|
166
388
|
"unicorn/no-array-callback-reference": "warn",
|
|
389
|
+
/*
|
|
390
|
+
* Disallow array accumulation with `Array#concat()` in loops.
|
|
391
|
+
*
|
|
392
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-concat-in-loop.md
|
|
393
|
+
*/
|
|
394
|
+
"unicorn/no-array-concat-in-loop": "warn",
|
|
395
|
+
/*
|
|
396
|
+
* Disallow using reference values as `Array#fill()` values.
|
|
397
|
+
*
|
|
398
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-fill-with-reference-type.md
|
|
399
|
+
*/
|
|
400
|
+
"unicorn/no-array-fill-with-reference-type": "warn",
|
|
167
401
|
/*
|
|
168
402
|
* Prefer for...of over Array#forEach(...)
|
|
169
403
|
*
|
|
@@ -173,6 +407,18 @@ export const unicornPluginConfig = {
|
|
|
173
407
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-for-each.md
|
|
174
408
|
*/
|
|
175
409
|
"unicorn/no-array-for-each": "off",
|
|
410
|
+
/*
|
|
411
|
+
* Disallow `.fill()` after `Array.from({length: …})`.
|
|
412
|
+
*
|
|
413
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-from-fill.md
|
|
414
|
+
*/
|
|
415
|
+
"unicorn/no-array-from-fill": "warn",
|
|
416
|
+
/*
|
|
417
|
+
* Disallow front-of-array mutation.
|
|
418
|
+
*
|
|
419
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-front-mutation.md
|
|
420
|
+
*/
|
|
421
|
+
"unicorn/no-array-front-mutation": "warn",
|
|
176
422
|
/*
|
|
177
423
|
* Disallow using the this argument in array methods
|
|
178
424
|
*
|
|
@@ -197,6 +443,30 @@ export const unicornPluginConfig = {
|
|
|
197
443
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-sort.md
|
|
198
444
|
*/
|
|
199
445
|
"unicorn/no-array-sort": "warn",
|
|
446
|
+
/*
|
|
447
|
+
* Disallow sorting arrays to get the minimum or maximum value.
|
|
448
|
+
*
|
|
449
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-sort-for-min-max.md
|
|
450
|
+
*/
|
|
451
|
+
"unicorn/no-array-sort-for-min-max": "warn",
|
|
452
|
+
/*
|
|
453
|
+
* Prefer `Array#toSpliced()` over `Array#splice()`.
|
|
454
|
+
*
|
|
455
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-splice.md
|
|
456
|
+
*/
|
|
457
|
+
"unicorn/no-array-splice": "warn",
|
|
458
|
+
/*
|
|
459
|
+
* Disallow asterisk prefixes in documentation comments.
|
|
460
|
+
*
|
|
461
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-asterisk-prefix-in-documentation-comments.md
|
|
462
|
+
*/
|
|
463
|
+
"unicorn/no-asterisk-prefix-in-documentation-comments": "warn",
|
|
464
|
+
/*
|
|
465
|
+
* Disallow async functions as `Promise#finally()` callbacks.
|
|
466
|
+
*
|
|
467
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-async-promise-finally.md
|
|
468
|
+
*/
|
|
469
|
+
"unicorn/no-async-promise-finally": "warn",
|
|
200
470
|
/*
|
|
201
471
|
* Forbid member access from await expression
|
|
202
472
|
*
|
|
@@ -209,24 +479,142 @@ export const unicornPluginConfig = {
|
|
|
209
479
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-in-promise-methods.md
|
|
210
480
|
*/
|
|
211
481
|
"unicorn/no-await-in-promise-methods": "warn",
|
|
482
|
+
/*
|
|
483
|
+
* Disallow unnecessary `Blob` to `File` conversion.
|
|
484
|
+
*
|
|
485
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-blob-to-file.md
|
|
486
|
+
*/
|
|
487
|
+
"unicorn/no-blob-to-file": "warn",
|
|
488
|
+
/*
|
|
489
|
+
* Disallow boolean-returning sort comparators.
|
|
490
|
+
*
|
|
491
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-boolean-sort-comparator.md
|
|
492
|
+
*/
|
|
493
|
+
"unicorn/no-boolean-sort-comparator": "warn",
|
|
494
|
+
/*
|
|
495
|
+
* Disallow `break` and `continue` in nested loops and switches inside loops.
|
|
496
|
+
*
|
|
497
|
+
* Off for now because fixing it is a bit tough
|
|
498
|
+
*
|
|
499
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-break-in-nested-loop.md
|
|
500
|
+
*/
|
|
501
|
+
"unicorn/no-break-in-nested-loop": "off",
|
|
502
|
+
/*
|
|
503
|
+
* Prefer drawing canvases directly instead of converting them to images.
|
|
504
|
+
*
|
|
505
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-canvas-to-image.md
|
|
506
|
+
*/
|
|
507
|
+
"unicorn/no-canvas-to-image": "warn",
|
|
508
|
+
/*
|
|
509
|
+
* Disallow chained comparisons such as `a < b < c`.
|
|
510
|
+
*
|
|
511
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-chained-comparison.md
|
|
512
|
+
*/
|
|
513
|
+
"unicorn/no-chained-comparison": "warn",
|
|
514
|
+
/*
|
|
515
|
+
* Disallow accessing `Map`, `Set`, `WeakMap`, and `WeakSet` entries with bracket notation.
|
|
516
|
+
*
|
|
517
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-collection-bracket-access.md
|
|
518
|
+
*/
|
|
519
|
+
"unicorn/no-collection-bracket-access": "warn",
|
|
520
|
+
/*
|
|
521
|
+
* Disallow dynamic object property existence checks.
|
|
522
|
+
*
|
|
523
|
+
* Off for now - bit difficult to fix
|
|
524
|
+
*
|
|
525
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-computed-property-existence-check.md
|
|
526
|
+
*/
|
|
527
|
+
"unicorn/no-computed-property-existence-check": "off",
|
|
528
|
+
/*
|
|
529
|
+
* Disallow confusing uses of `Array#{splice,toSpliced}()`.
|
|
530
|
+
*
|
|
531
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-confusing-array-splice.md
|
|
532
|
+
*/
|
|
533
|
+
"unicorn/no-confusing-array-splice": "warn",
|
|
534
|
+
/*
|
|
535
|
+
* Disallow confusing uses of `Array#with()`.
|
|
536
|
+
*
|
|
537
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-confusing-array-with.md
|
|
538
|
+
*/
|
|
539
|
+
"unicorn/no-confusing-array-with": "warn",
|
|
212
540
|
/*
|
|
213
541
|
* Do not use leading/trailing space between console.log parameters. (fixable)
|
|
214
542
|
*
|
|
215
543
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-console-spaces.md
|
|
216
544
|
*/
|
|
217
545
|
"unicorn/no-console-spaces": "warn",
|
|
546
|
+
/*
|
|
547
|
+
* Disallow arithmetic and bitwise operations that always evaluate to `0`.
|
|
548
|
+
*
|
|
549
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-constant-zero-expression.md
|
|
550
|
+
*/
|
|
551
|
+
"unicorn/no-constant-zero-expression": "warn",
|
|
552
|
+
/*
|
|
553
|
+
* Disallow declarations before conditional early exits when they are only used after the exit.
|
|
554
|
+
*
|
|
555
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-declarations-before-early-exit.md
|
|
556
|
+
*/
|
|
557
|
+
"unicorn/no-declarations-before-early-exit": "warn",
|
|
218
558
|
/*
|
|
219
559
|
* Do not use document.cookie directly
|
|
220
560
|
*
|
|
221
561
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-document-cookie.md
|
|
222
562
|
*/
|
|
223
563
|
"unicorn/no-document-cookie": "warn",
|
|
564
|
+
/*
|
|
565
|
+
* Disallow two comparisons of the same operands that can be combined into one.
|
|
566
|
+
*
|
|
567
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-double-comparison.md
|
|
568
|
+
*/
|
|
569
|
+
"unicorn/no-double-comparison": "warn",
|
|
570
|
+
/*
|
|
571
|
+
* Disallow duplicate adjacent branches in if chains.
|
|
572
|
+
*
|
|
573
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-duplicate-if-branches.md
|
|
574
|
+
*/
|
|
575
|
+
"unicorn/no-duplicate-if-branches": "warn",
|
|
576
|
+
/*
|
|
577
|
+
* Disallow adjacent duplicate operands in logical expressions.
|
|
578
|
+
*
|
|
579
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-duplicate-logical-operands.md
|
|
580
|
+
*/
|
|
581
|
+
"unicorn/no-duplicate-logical-operands": "warn",
|
|
582
|
+
/*
|
|
583
|
+
* Disallow `.map()` and `.filter()` in `for…of` and `for await…of` loop headers.
|
|
584
|
+
*
|
|
585
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-duplicate-loops.md
|
|
586
|
+
*/
|
|
587
|
+
"unicorn/no-duplicate-loops": "warn",
|
|
588
|
+
/*
|
|
589
|
+
* Disallow duplicate values in `Set` constructor array literals.
|
|
590
|
+
*
|
|
591
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-duplicate-set-values.md
|
|
592
|
+
*/
|
|
593
|
+
"unicorn/no-duplicate-set-values": "warn",
|
|
224
594
|
/*
|
|
225
595
|
* Disallow empty files
|
|
226
596
|
*
|
|
227
597
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-empty-file.md
|
|
228
598
|
*/
|
|
229
599
|
"unicorn/no-empty-file": "warn",
|
|
600
|
+
/*
|
|
601
|
+
* Disallow assigning to built-in error properties.
|
|
602
|
+
*
|
|
603
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-error-property-assignment.md
|
|
604
|
+
*/
|
|
605
|
+
"unicorn/no-error-property-assignment": "warn",
|
|
606
|
+
/*
|
|
607
|
+
* Disallow exports in scripts.
|
|
608
|
+
*
|
|
609
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-exports-in-scripts.md
|
|
610
|
+
*/
|
|
611
|
+
"unicorn/no-exports-in-scripts": "warn",
|
|
612
|
+
/*
|
|
613
|
+
* Prefer `for…of` over the `forEach` method.
|
|
614
|
+
*
|
|
615
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-for-each.md
|
|
616
|
+
*/
|
|
617
|
+
"unicorn/no-for-each": "warn",
|
|
230
618
|
/*
|
|
231
619
|
* Do not use a for loop that can be replaced with a for-of loop
|
|
232
620
|
*
|
|
@@ -234,17 +622,35 @@ export const unicornPluginConfig = {
|
|
|
234
622
|
*/
|
|
235
623
|
"unicorn/no-for-loop": "warn",
|
|
236
624
|
/*
|
|
237
|
-
*
|
|
625
|
+
* Disallow assigning properties on the global object.
|
|
238
626
|
*
|
|
239
|
-
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-
|
|
627
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-global-object-property-assignment.md
|
|
240
628
|
*/
|
|
241
|
-
"unicorn/no-
|
|
629
|
+
"unicorn/no-global-object-property-assignment": "warn",
|
|
242
630
|
/*
|
|
243
631
|
* Disallow immediate mutation after variable assignment
|
|
244
632
|
*
|
|
245
633
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-immediate-mutation.md
|
|
246
634
|
*/
|
|
247
635
|
"unicorn/no-immediate-mutation": "warn",
|
|
636
|
+
/*
|
|
637
|
+
* Disallow impossible comparisons against `.length` or `.size`.
|
|
638
|
+
*
|
|
639
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-impossible-length-comparison.md
|
|
640
|
+
*/
|
|
641
|
+
"unicorn/no-impossible-length-comparison": "warn",
|
|
642
|
+
/*
|
|
643
|
+
* Disallow incorrect `querySelector()` and `querySelectorAll()` usage.
|
|
644
|
+
*
|
|
645
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-incorrect-query-selector.md
|
|
646
|
+
*/
|
|
647
|
+
"unicorn/no-incorrect-query-selector": "warn",
|
|
648
|
+
/*
|
|
649
|
+
* Disallow incorrect template literal interpolation syntax.
|
|
650
|
+
*
|
|
651
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-incorrect-template-string-interpolation.md
|
|
652
|
+
*/
|
|
653
|
+
"unicorn/no-incorrect-template-string-interpolation": "warn",
|
|
248
654
|
/*
|
|
249
655
|
* Require Array.isArray() instead of instanceof Array
|
|
250
656
|
*
|
|
@@ -256,42 +662,114 @@ export const unicornPluginConfig = {
|
|
|
256
662
|
strategy: "loose",
|
|
257
663
|
},
|
|
258
664
|
],
|
|
665
|
+
/*
|
|
666
|
+
* Disallow calling functions with an invalid number of arguments.
|
|
667
|
+
*
|
|
668
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-argument-count.md
|
|
669
|
+
*/
|
|
670
|
+
"unicorn/no-invalid-argument-count": "warn",
|
|
671
|
+
/*
|
|
672
|
+
* Disallow comparing a single character from a string to a multi-character string.
|
|
673
|
+
*
|
|
674
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-character-comparison.md
|
|
675
|
+
*/
|
|
676
|
+
"unicorn/no-invalid-character-comparison": "warn",
|
|
259
677
|
/*
|
|
260
678
|
* Disallow invalid options in fetch() and new Request()
|
|
261
679
|
*
|
|
262
680
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-fetch-options.md
|
|
263
681
|
*/
|
|
264
682
|
"unicorn/no-invalid-fetch-options": "warn",
|
|
683
|
+
/*
|
|
684
|
+
* Disallow invalid `accept` values on file inputs.
|
|
685
|
+
*
|
|
686
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-file-input-accept.md
|
|
687
|
+
*/
|
|
688
|
+
"unicorn/no-invalid-file-input-accept": "warn",
|
|
265
689
|
/*
|
|
266
690
|
* Prevent calling EventTarget#removeEventListener() with the result of an expression
|
|
267
691
|
*
|
|
268
692
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-remove-event-listener.md
|
|
269
693
|
*/
|
|
270
694
|
"unicorn/no-invalid-remove-event-listener": "warn",
|
|
695
|
+
/*
|
|
696
|
+
* Disallow invalid implementations of well-known symbol methods.
|
|
697
|
+
*
|
|
698
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-well-known-symbol-methods.md
|
|
699
|
+
*/
|
|
700
|
+
"unicorn/no-invalid-well-known-symbol-methods": "warn",
|
|
271
701
|
/*
|
|
272
702
|
* Disallow identifiers starting with new or class
|
|
273
703
|
*
|
|
274
704
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-keyword-prefix.md
|
|
275
705
|
*/
|
|
276
706
|
"unicorn/no-keyword-prefix": "off",
|
|
707
|
+
/*
|
|
708
|
+
* Disallow accessing `event.currentTarget` after the synchronous event dispatch has finished.
|
|
709
|
+
*
|
|
710
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-late-current-target-access.md
|
|
711
|
+
*/
|
|
712
|
+
"unicorn/no-late-current-target-access": "warn",
|
|
713
|
+
/*
|
|
714
|
+
* Disallow event-control method calls after the synchronous event dispatch has finished.
|
|
715
|
+
*
|
|
716
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-late-event-control.md
|
|
717
|
+
*/
|
|
718
|
+
"unicorn/no-late-event-control": "warn",
|
|
277
719
|
/*
|
|
278
720
|
* Disallow if statements as the only statement in if blocks without else
|
|
279
721
|
*
|
|
280
722
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-lonely-if.md
|
|
281
723
|
*/
|
|
282
724
|
"unicorn/no-lonely-if": "warn",
|
|
725
|
+
/*
|
|
726
|
+
* Disallow mutating a loop iterable during iteration.
|
|
727
|
+
*
|
|
728
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-loop-iterable-mutation.md
|
|
729
|
+
*/
|
|
730
|
+
"unicorn/no-loop-iterable-mutation": "warn",
|
|
283
731
|
/*
|
|
284
732
|
* Disallow a magic number as the depth argument in Array#flat(…).
|
|
285
733
|
*
|
|
286
734
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-magic-array-flat-depth.md
|
|
287
735
|
*/
|
|
288
736
|
"unicorn/no-magic-array-flat-depth": "warn",
|
|
737
|
+
/*
|
|
738
|
+
* Disallow manually wrapped comments.
|
|
739
|
+
*
|
|
740
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-manually-wrapped-comments.md
|
|
741
|
+
*/
|
|
742
|
+
"unicorn/no-manually-wrapped-comments": "warn",
|
|
743
|
+
/*
|
|
744
|
+
* Disallow checking a Map key before accessing a different key.
|
|
745
|
+
*
|
|
746
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-mismatched-map-key.md
|
|
747
|
+
*/
|
|
748
|
+
"unicorn/no-mismatched-map-key": "warn",
|
|
749
|
+
/*
|
|
750
|
+
* Disallow misrefactored compound assignments where the target is duplicated in the right-hand side.
|
|
751
|
+
*
|
|
752
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-misrefactored-assignment.md
|
|
753
|
+
*/
|
|
754
|
+
"unicorn/no-misrefactored-assignment": "warn",
|
|
289
755
|
/*
|
|
290
756
|
* Disallow named usage of default import and export
|
|
291
757
|
*
|
|
292
758
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-named-default.md
|
|
293
759
|
*/
|
|
294
760
|
"unicorn/no-named-default": "warn",
|
|
761
|
+
/*
|
|
762
|
+
* Disallow negated array predicate calls.
|
|
763
|
+
*
|
|
764
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negated-array-predicate.md
|
|
765
|
+
*/
|
|
766
|
+
"unicorn/no-negated-array-predicate": "warn",
|
|
767
|
+
/*
|
|
768
|
+
* Disallow negated comparisons.
|
|
769
|
+
*
|
|
770
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negated-comparison.md
|
|
771
|
+
*/
|
|
772
|
+
"unicorn/no-negated-comparison": "warn",
|
|
295
773
|
/*
|
|
296
774
|
* Disallow negated conditions
|
|
297
775
|
*
|
|
@@ -326,6 +804,18 @@ export const unicornPluginConfig = {
|
|
|
326
804
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-buffer.md
|
|
327
805
|
*/
|
|
328
806
|
"unicorn/no-new-buffer": "warn",
|
|
807
|
+
/*
|
|
808
|
+
* Disallow non-function values with function-style verb prefixes.
|
|
809
|
+
*
|
|
810
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-non-function-verb-prefix.md
|
|
811
|
+
*/
|
|
812
|
+
"unicorn/no-non-function-verb-prefix": "warn",
|
|
813
|
+
/*
|
|
814
|
+
* Disallow non-standard properties on built-in objects.
|
|
815
|
+
*
|
|
816
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-nonstandard-builtin-properties.md
|
|
817
|
+
*/
|
|
818
|
+
"unicorn/no-nonstandard-builtin-properties": "warn",
|
|
329
819
|
/*
|
|
330
820
|
* Disallow the use of the null literal, to encourage using undefined instead.
|
|
331
821
|
*
|
|
@@ -338,6 +828,18 @@ export const unicornPluginConfig = {
|
|
|
338
828
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-object-as-default-parameter.md
|
|
339
829
|
*/
|
|
340
830
|
"unicorn/no-object-as-default-parameter": "warn",
|
|
831
|
+
/*
|
|
832
|
+
* Disallow `Object` methods with `Map` or `Set`.
|
|
833
|
+
*
|
|
834
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-object-methods-with-collections.md
|
|
835
|
+
*/
|
|
836
|
+
"unicorn/no-object-methods-with-collections": "warn",
|
|
837
|
+
/*
|
|
838
|
+
* Disallow optional chaining on undeclared variables.
|
|
839
|
+
*
|
|
840
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-optional-chaining-on-undeclared-variable.md
|
|
841
|
+
*/
|
|
842
|
+
"unicorn/no-optional-chaining-on-undeclared-variable": "warn",
|
|
341
843
|
/*
|
|
342
844
|
* Disallow process.exit().
|
|
343
845
|
*
|
|
@@ -346,6 +848,24 @@ export const unicornPluginConfig = {
|
|
|
346
848
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-process-exit.md
|
|
347
849
|
*/
|
|
348
850
|
"unicorn/no-process-exit": "off",
|
|
851
|
+
/*
|
|
852
|
+
* Disallow comparisons made redundant by an equality check in the same logical AND.
|
|
853
|
+
*
|
|
854
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-redundant-comparison.md
|
|
855
|
+
*/
|
|
856
|
+
"unicorn/no-redundant-comparison": "warn",
|
|
857
|
+
/*
|
|
858
|
+
* Disallow returning the result of `Array#push()` with arguments.
|
|
859
|
+
*
|
|
860
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-return-array-push.md
|
|
861
|
+
*/
|
|
862
|
+
"unicorn/no-return-array-push": "warn",
|
|
863
|
+
/*
|
|
864
|
+
* Disallow selector syntax in DOM names.
|
|
865
|
+
*
|
|
866
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-selector-as-dom-name.md
|
|
867
|
+
*/
|
|
868
|
+
"unicorn/no-selector-as-dom-name": "warn",
|
|
349
869
|
/*
|
|
350
870
|
* Disallow passing single-element arrays to Promise methods
|
|
351
871
|
*
|
|
@@ -358,6 +878,12 @@ export const unicornPluginConfig = {
|
|
|
358
878
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-static-only-class.md
|
|
359
879
|
*/
|
|
360
880
|
"unicorn/no-static-only-class": "warn",
|
|
881
|
+
/*
|
|
882
|
+
* Prefer comparing values directly over subtracting and comparing to `0`.
|
|
883
|
+
*
|
|
884
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-subtraction-comparison.md
|
|
885
|
+
*/
|
|
886
|
+
"unicorn/no-subtraction-comparison": "warn",
|
|
361
887
|
/*
|
|
362
888
|
* Disallow then property
|
|
363
889
|
*
|
|
@@ -370,18 +896,54 @@ export const unicornPluginConfig = {
|
|
|
370
896
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-this-assignment.md
|
|
371
897
|
*/
|
|
372
898
|
"unicorn/no-this-assignment": "warn",
|
|
899
|
+
/*
|
|
900
|
+
* Disallow `this` outside of classes.
|
|
901
|
+
*
|
|
902
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-this-outside-of-class.md
|
|
903
|
+
*/
|
|
904
|
+
"unicorn/no-this-outside-of-class": "warn",
|
|
905
|
+
/*
|
|
906
|
+
* Disallow assigning to top-level variables from inside functions.
|
|
907
|
+
*
|
|
908
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-top-level-assignment-in-function.md
|
|
909
|
+
*/
|
|
910
|
+
"unicorn/no-top-level-assignment-in-function": "warn",
|
|
911
|
+
/*
|
|
912
|
+
* Disallow top-level side effects in exported modules.
|
|
913
|
+
*
|
|
914
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-top-level-side-effects.md
|
|
915
|
+
*/
|
|
916
|
+
"unicorn/no-top-level-side-effects": "warn",
|
|
373
917
|
/*
|
|
374
918
|
* Disallow comparing undefined using typeof
|
|
375
919
|
*
|
|
376
920
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-typeof-undefined.md
|
|
377
921
|
*/
|
|
378
922
|
"unicorn/no-typeof-undefined": "warn",
|
|
923
|
+
/*
|
|
924
|
+
* Disallow referencing methods without calling them.
|
|
925
|
+
*
|
|
926
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-uncalled-method.md
|
|
927
|
+
*/
|
|
928
|
+
"unicorn/no-uncalled-method": "warn",
|
|
929
|
+
/*
|
|
930
|
+
* Require class members to be declared.
|
|
931
|
+
*
|
|
932
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-undeclared-class-members.md
|
|
933
|
+
*/
|
|
934
|
+
"unicorn/no-undeclared-class-members": "warn",
|
|
379
935
|
/*
|
|
380
936
|
* Disallow using 1 as the depth argument of Array#flat()
|
|
381
937
|
*
|
|
382
938
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-flat-depth.md
|
|
383
939
|
*/
|
|
384
940
|
"unicorn/no-unnecessary-array-flat-depth": "warn",
|
|
941
|
+
/*
|
|
942
|
+
* Disallow `Array#flatMap()` callbacks that only wrap a single item.
|
|
943
|
+
*
|
|
944
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-flat-map.md
|
|
945
|
+
*/
|
|
946
|
+
"unicorn/no-unnecessary-array-flat-map": "warn",
|
|
385
947
|
/*
|
|
386
948
|
* Disallow using .length or Infinity as the deleteCount or skipCount argument of Array#{splice,toSpliced}()
|
|
387
949
|
*
|
|
@@ -394,6 +956,30 @@ export const unicornPluginConfig = {
|
|
|
394
956
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-await.md
|
|
395
957
|
*/
|
|
396
958
|
"unicorn/no-unnecessary-await": "warn",
|
|
959
|
+
/*
|
|
960
|
+
* Disallow unnecessary comparisons against boolean literals.
|
|
961
|
+
*
|
|
962
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-boolean-comparison.md
|
|
963
|
+
*/
|
|
964
|
+
"unicorn/no-unnecessary-boolean-comparison": "warn",
|
|
965
|
+
/*
|
|
966
|
+
* Disallow unnecessary options in `fetch()` and `new Request()`.
|
|
967
|
+
*
|
|
968
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-fetch-options.md
|
|
969
|
+
*/
|
|
970
|
+
"unicorn/no-unnecessary-fetch-options": "warn",
|
|
971
|
+
/*
|
|
972
|
+
* Disallow unnecessary `globalThis` references.
|
|
973
|
+
*
|
|
974
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-global-this.md
|
|
975
|
+
*/
|
|
976
|
+
"unicorn/no-unnecessary-global-this": "warn",
|
|
977
|
+
/*
|
|
978
|
+
* Disallow unnecessary nested ternary expressions.
|
|
979
|
+
*
|
|
980
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-nested-ternary.md
|
|
981
|
+
*/
|
|
982
|
+
"unicorn/no-unnecessary-nested-ternary": "warn",
|
|
397
983
|
/*
|
|
398
984
|
* Enforce the use of built-in methods instead of unnecessary polyfills
|
|
399
985
|
*
|
|
@@ -406,30 +992,132 @@ export const unicornPluginConfig = {
|
|
|
406
992
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-slice-end.md
|
|
407
993
|
*/
|
|
408
994
|
"unicorn/no-unnecessary-slice-end": "warn",
|
|
995
|
+
/*
|
|
996
|
+
* Disallow `Array#splice()` when simpler alternatives exist.
|
|
997
|
+
*
|
|
998
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-splice.md
|
|
999
|
+
*/
|
|
1000
|
+
"unicorn/no-unnecessary-splice": "warn",
|
|
409
1001
|
/*
|
|
410
1002
|
* Disallow unreadable array destructuring.
|
|
411
1003
|
*
|
|
412
1004
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-array-destructuring.md
|
|
413
1005
|
*/
|
|
414
1006
|
"unicorn/no-unreadable-array-destructuring": "warn",
|
|
1007
|
+
/*
|
|
1008
|
+
* Disallow unreadable iterable expressions in `for…of` and `for await…of` loop headers.
|
|
1009
|
+
*
|
|
1010
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-for-of-expression.md
|
|
1011
|
+
*/
|
|
1012
|
+
"unicorn/no-unreadable-for-of-expression": "warn",
|
|
415
1013
|
/*
|
|
416
1014
|
* Disallow unreadable IIFEs
|
|
417
1015
|
*
|
|
418
1016
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-iife.md
|
|
419
1017
|
*/
|
|
420
1018
|
"unicorn/no-unreadable-iife": "warn",
|
|
1019
|
+
/*
|
|
1020
|
+
* Disallow unreadable `new` expressions.
|
|
1021
|
+
*
|
|
1022
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-new-expression.md
|
|
1023
|
+
*/
|
|
1024
|
+
"unicorn/no-unreadable-new-expression": "warn",
|
|
1025
|
+
/*
|
|
1026
|
+
* Disallow unreadable object destructuring.
|
|
1027
|
+
*
|
|
1028
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-object-destructuring.md
|
|
1029
|
+
*/
|
|
1030
|
+
"unicorn/no-unreadable-object-destructuring": "warn",
|
|
1031
|
+
/*
|
|
1032
|
+
* Prevent unsafe use of ArrayBuffer view `.buffer`.
|
|
1033
|
+
*
|
|
1034
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-buffer-conversion.md
|
|
1035
|
+
*/
|
|
1036
|
+
"unicorn/no-unsafe-buffer-conversion": "warn",
|
|
1037
|
+
/*
|
|
1038
|
+
* Disallow unsafe DOM HTML APIs.
|
|
1039
|
+
*
|
|
1040
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-dom-html.md
|
|
1041
|
+
*/
|
|
1042
|
+
"unicorn/no-unsafe-dom-html": "warn",
|
|
1043
|
+
/*
|
|
1044
|
+
* Disallow reading `.value` from `Promise.allSettled()` results without a fulfilled status guard.
|
|
1045
|
+
*
|
|
1046
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-promise-all-settled-values.md
|
|
1047
|
+
*/
|
|
1048
|
+
"unicorn/no-unsafe-promise-all-settled-values": "warn",
|
|
1049
|
+
/*
|
|
1050
|
+
* Disallow unsafe values as property keys.
|
|
1051
|
+
*
|
|
1052
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-property-key.md
|
|
1053
|
+
*/
|
|
1054
|
+
"unicorn/no-unsafe-property-key": "warn",
|
|
1055
|
+
/*
|
|
1056
|
+
* Disallow non-literal replacement values in `String#replace()` and `String#replaceAll()`.
|
|
1057
|
+
*
|
|
1058
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-string-replacement.md
|
|
1059
|
+
*/
|
|
1060
|
+
"unicorn/no-unsafe-string-replacement": "warn",
|
|
1061
|
+
/*
|
|
1062
|
+
* Disallow ignoring the return value of selected array methods.
|
|
1063
|
+
*
|
|
1064
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unused-array-method-return.md
|
|
1065
|
+
*/
|
|
1066
|
+
"unicorn/no-unused-array-method-return": "warn",
|
|
421
1067
|
/*
|
|
422
1068
|
* Disallow unused object properties.
|
|
423
1069
|
*
|
|
424
1070
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unused-properties.md
|
|
425
1071
|
*/
|
|
426
1072
|
"unicorn/no-unused-properties": "warn",
|
|
1073
|
+
/*
|
|
1074
|
+
* Disallow unnecessary `Boolean()` casts in array predicate callbacks.
|
|
1075
|
+
*
|
|
1076
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-boolean-cast.md
|
|
1077
|
+
*/
|
|
1078
|
+
"unicorn/no-useless-boolean-cast": "warn",
|
|
1079
|
+
/*
|
|
1080
|
+
* Disallow useless type coercions of values that are already of the target type.
|
|
1081
|
+
*
|
|
1082
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-coercion.md
|
|
1083
|
+
*/
|
|
1084
|
+
"unicorn/no-useless-coercion": "warn",
|
|
427
1085
|
/*
|
|
428
1086
|
* Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`.
|
|
429
1087
|
*
|
|
430
1088
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-collection-argument.md
|
|
431
1089
|
*/
|
|
432
1090
|
"unicorn/no-useless-collection-argument": "warn",
|
|
1091
|
+
/*
|
|
1092
|
+
* Disallow useless compound assignments such as `x += 0`.
|
|
1093
|
+
*
|
|
1094
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-compound-assignment.md
|
|
1095
|
+
*/
|
|
1096
|
+
"unicorn/no-useless-compound-assignment": "warn",
|
|
1097
|
+
/*
|
|
1098
|
+
* Disallow useless concatenation of literals.
|
|
1099
|
+
*
|
|
1100
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-concat.md
|
|
1101
|
+
*/
|
|
1102
|
+
"unicorn/no-useless-concat": "warn",
|
|
1103
|
+
/*
|
|
1104
|
+
* Disallow useless `continue` statements.
|
|
1105
|
+
*
|
|
1106
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-continue.md
|
|
1107
|
+
*/
|
|
1108
|
+
"unicorn/no-useless-continue": "warn",
|
|
1109
|
+
/*
|
|
1110
|
+
* Disallow unnecessary existence checks before deletion.
|
|
1111
|
+
*
|
|
1112
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-delete-check.md
|
|
1113
|
+
*/
|
|
1114
|
+
"unicorn/no-useless-delete-check": "warn",
|
|
1115
|
+
/*
|
|
1116
|
+
* Disallow `else` after a statement that exits.
|
|
1117
|
+
*
|
|
1118
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-else.md
|
|
1119
|
+
*/
|
|
1120
|
+
"unicorn/no-useless-else": "warn",
|
|
433
1121
|
/*
|
|
434
1122
|
* Disallow unnecessary Error.captureStackTrace(…)
|
|
435
1123
|
*
|
|
@@ -442,18 +1130,42 @@ export const unicornPluginConfig = {
|
|
|
442
1130
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-fallback-in-spread.md
|
|
443
1131
|
*/
|
|
444
1132
|
"unicorn/no-useless-fallback-in-spread": "warn",
|
|
1133
|
+
/*
|
|
1134
|
+
* Disallow unnecessary .toArray() on iterators.
|
|
1135
|
+
*
|
|
1136
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-iterator-to-array.md
|
|
1137
|
+
*/
|
|
1138
|
+
"unicorn/no-useless-iterator-to-array": "warn",
|
|
445
1139
|
/*
|
|
446
1140
|
* Disallow useless array length check
|
|
447
1141
|
*
|
|
448
1142
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-length-check.md
|
|
449
1143
|
*/
|
|
450
1144
|
"unicorn/no-useless-length-check": "warn",
|
|
1145
|
+
/*
|
|
1146
|
+
* Disallow unnecessary operands in logical expressions involving boolean literals.
|
|
1147
|
+
*
|
|
1148
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-logical-operand.md
|
|
1149
|
+
*/
|
|
1150
|
+
"unicorn/no-useless-logical-operand": "warn",
|
|
1151
|
+
/*
|
|
1152
|
+
* Disallow useless overrides of class methods.
|
|
1153
|
+
*
|
|
1154
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-override.md
|
|
1155
|
+
*/
|
|
1156
|
+
"unicorn/no-useless-override": "warn",
|
|
451
1157
|
/*
|
|
452
1158
|
* Disallow returning/yielding Promise.resolve/reject() in async functions or promise callbacks
|
|
453
1159
|
*
|
|
454
1160
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-promise-resolve-reject.md
|
|
455
1161
|
*/
|
|
456
1162
|
"unicorn/no-useless-promise-resolve-reject": "warn",
|
|
1163
|
+
/*
|
|
1164
|
+
* Disallow simple recursive function calls that can be replaced with a loop.
|
|
1165
|
+
*
|
|
1166
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-recursion.md
|
|
1167
|
+
*/
|
|
1168
|
+
"unicorn/no-useless-recursion": "warn",
|
|
457
1169
|
/*
|
|
458
1170
|
* Disallow useless spread
|
|
459
1171
|
*
|
|
@@ -466,6 +1178,12 @@ export const unicornPluginConfig = {
|
|
|
466
1178
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-switch-case.md
|
|
467
1179
|
*/
|
|
468
1180
|
"unicorn/no-useless-switch-case": "warn",
|
|
1181
|
+
/*
|
|
1182
|
+
* Disallow useless template literal expressions.
|
|
1183
|
+
*
|
|
1184
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-template-literals.md
|
|
1185
|
+
*/
|
|
1186
|
+
"unicorn/no-useless-template-literals": "warn",
|
|
469
1187
|
/*
|
|
470
1188
|
* Disallow useless undefined
|
|
471
1189
|
*
|
|
@@ -474,6 +1192,12 @@ export const unicornPluginConfig = {
|
|
|
474
1192
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-undefined.md
|
|
475
1193
|
*/
|
|
476
1194
|
"unicorn/no-useless-undefined": "off",
|
|
1195
|
+
/*
|
|
1196
|
+
* Disallow the bitwise XOR operator where exponentiation was likely intended.
|
|
1197
|
+
*
|
|
1198
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-xor-as-exponentiation.md
|
|
1199
|
+
*/
|
|
1200
|
+
"unicorn/no-xor-as-exponentiation": "warn",
|
|
477
1201
|
/*
|
|
478
1202
|
* Disallow number literals with zero fractions or dangling dots
|
|
479
1203
|
*
|
|
@@ -492,12 +1216,42 @@ export const unicornPluginConfig = {
|
|
|
492
1216
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
|
|
493
1217
|
*/
|
|
494
1218
|
"unicorn/numeric-separators-style": "warn",
|
|
1219
|
+
/*
|
|
1220
|
+
* Require assignment operator shorthand where possible.
|
|
1221
|
+
*
|
|
1222
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/operator-assignment.md
|
|
1223
|
+
*/
|
|
1224
|
+
"unicorn/operator-assignment": "warn",
|
|
1225
|
+
/*
|
|
1226
|
+
* Prefer `AbortSignal.any()` over manually forwarding abort events between signals.
|
|
1227
|
+
*
|
|
1228
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-abort-signal-any.md
|
|
1229
|
+
*/
|
|
1230
|
+
"unicorn/prefer-abort-signal-any": "warn",
|
|
1231
|
+
/*
|
|
1232
|
+
* Prefer `AbortSignal.timeout()` over manually aborting an `AbortController` with `setTimeout()`.
|
|
1233
|
+
*
|
|
1234
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-abort-signal-timeout.md
|
|
1235
|
+
*/
|
|
1236
|
+
"unicorn/prefer-abort-signal-timeout": "warn",
|
|
495
1237
|
/*
|
|
496
1238
|
* Prefer addEventListener over on-functions. (fixable)
|
|
497
1239
|
*
|
|
498
1240
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-add-event-listener.md
|
|
499
1241
|
*/
|
|
500
1242
|
"unicorn/prefer-add-event-listener": "warn",
|
|
1243
|
+
/*
|
|
1244
|
+
* Prefer an options object over a boolean in `.addEventListener()`.
|
|
1245
|
+
*
|
|
1246
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-add-event-listener-options.md
|
|
1247
|
+
*/
|
|
1248
|
+
"unicorn/prefer-add-event-listener-options": "warn",
|
|
1249
|
+
/*
|
|
1250
|
+
* Prefer `AggregateError` when throwing collected errors.
|
|
1251
|
+
*
|
|
1252
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-aggregate-error.md
|
|
1253
|
+
*/
|
|
1254
|
+
"unicorn/prefer-aggregate-error": "warn",
|
|
501
1255
|
/*
|
|
502
1256
|
* Prefer .find(...) over the first element from .filter(...)
|
|
503
1257
|
*
|
|
@@ -516,12 +1270,48 @@ export const unicornPluginConfig = {
|
|
|
516
1270
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat-map.md
|
|
517
1271
|
*/
|
|
518
1272
|
"unicorn/prefer-array-flat-map": "warn",
|
|
1273
|
+
/*
|
|
1274
|
+
* Prefer `Array.fromAsync()` over `for await…of` array accumulation.
|
|
1275
|
+
*
|
|
1276
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-from-async.md
|
|
1277
|
+
*/
|
|
1278
|
+
"unicorn/prefer-array-from-async": "warn",
|
|
1279
|
+
/*
|
|
1280
|
+
* Prefer using the `Array.from()` mapping function argument.
|
|
1281
|
+
*
|
|
1282
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-from-map.md
|
|
1283
|
+
*/
|
|
1284
|
+
"unicorn/prefer-array-from-map": "warn",
|
|
1285
|
+
/*
|
|
1286
|
+
* Prefer `Array.from({length}, …)` when creating range arrays.
|
|
1287
|
+
*
|
|
1288
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-from-range.md
|
|
1289
|
+
*/
|
|
1290
|
+
"unicorn/prefer-array-from-range": "warn",
|
|
519
1291
|
/*
|
|
520
1292
|
* Prefer Array#indexOf() over Array#findIndex() when looking for the index of an item
|
|
521
1293
|
*
|
|
522
1294
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-index-of.md
|
|
523
1295
|
*/
|
|
524
1296
|
"unicorn/prefer-array-index-of": "warn",
|
|
1297
|
+
/*
|
|
1298
|
+
* Prefer iterating an array directly or with `Array#keys()` over `Array#entries()` when the index or value is unused.
|
|
1299
|
+
*
|
|
1300
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-iterable-methods.md
|
|
1301
|
+
*/
|
|
1302
|
+
"unicorn/prefer-array-iterable-methods": "warn",
|
|
1303
|
+
/*
|
|
1304
|
+
* Prefer last-oriented array methods over `Array#reverse()` or `Array#toReversed()` followed by a method.
|
|
1305
|
+
*
|
|
1306
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-last-methods.md
|
|
1307
|
+
*/
|
|
1308
|
+
"unicorn/prefer-array-last-methods": "warn",
|
|
1309
|
+
/*
|
|
1310
|
+
* Prefer `Array#slice()` over `Array#splice()` when reading from the returned array.
|
|
1311
|
+
*
|
|
1312
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-slice.md
|
|
1313
|
+
*/
|
|
1314
|
+
"unicorn/prefer-array-slice": "warn",
|
|
525
1315
|
/*
|
|
526
1316
|
* Prefer .some(...) over .find(...).
|
|
527
1317
|
*
|
|
@@ -531,23 +1321,41 @@ export const unicornPluginConfig = {
|
|
|
531
1321
|
/*
|
|
532
1322
|
* Prefer .at() method for index access and String#charAt()
|
|
533
1323
|
*
|
|
534
|
-
* This breaks
|
|
1324
|
+
* This breaks TypeScript array typings at the moment
|
|
535
1325
|
*
|
|
536
1326
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-at.md
|
|
537
1327
|
*/
|
|
538
1328
|
"unicorn/prefer-at": "off",
|
|
1329
|
+
/*
|
|
1330
|
+
* Prefer `await` over promise chaining.
|
|
1331
|
+
*
|
|
1332
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-await.md
|
|
1333
|
+
*/
|
|
1334
|
+
"unicorn/prefer-await": "warn",
|
|
539
1335
|
/*
|
|
540
1336
|
* Prefer BigInt literals over the constructor
|
|
541
1337
|
*
|
|
542
|
-
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-bigint-literals.md
|
|
1338
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-bigint-literals.md
|
|
1339
|
+
*/
|
|
1340
|
+
"unicorn/prefer-bigint-literals": "warn",
|
|
1341
|
+
/*
|
|
1342
|
+
* Prefer .at() method for index access and String#charAt()
|
|
1343
|
+
*
|
|
1344
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-blob-reading-methods.md
|
|
1345
|
+
*/
|
|
1346
|
+
"unicorn/prefer-blob-reading-methods": "warn",
|
|
1347
|
+
/*
|
|
1348
|
+
* Prefer block statements over IIFEs used only for scoping.
|
|
1349
|
+
*
|
|
1350
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-block-statement-over-iife.md
|
|
543
1351
|
*/
|
|
544
|
-
"unicorn/prefer-
|
|
1352
|
+
"unicorn/prefer-block-statement-over-iife": "warn",
|
|
545
1353
|
/*
|
|
546
|
-
* Prefer
|
|
1354
|
+
* Prefer directly returning boolean expressions over `if` statements.
|
|
547
1355
|
*
|
|
548
|
-
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-
|
|
1356
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-boolean-return.md
|
|
549
1357
|
*/
|
|
550
|
-
"unicorn/prefer-
|
|
1358
|
+
"unicorn/prefer-boolean-return": "warn",
|
|
551
1359
|
/*
|
|
552
1360
|
* Prefer class field declarations over this assignments in constructors
|
|
553
1361
|
*
|
|
@@ -566,6 +1374,12 @@ export const unicornPluginConfig = {
|
|
|
566
1374
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-code-point.md
|
|
567
1375
|
*/
|
|
568
1376
|
"unicorn/prefer-code-point": "warn",
|
|
1377
|
+
/*
|
|
1378
|
+
* Prefer early continues over whole-loop conditional wrapping.
|
|
1379
|
+
*
|
|
1380
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-continue.md
|
|
1381
|
+
*/
|
|
1382
|
+
"unicorn/prefer-continue": "warn",
|
|
569
1383
|
/*
|
|
570
1384
|
* Prefer Date.now() to get the number of milliseconds since the Unix Epoch
|
|
571
1385
|
*
|
|
@@ -578,6 +1392,18 @@ export const unicornPluginConfig = {
|
|
|
578
1392
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-default-parameters.md
|
|
579
1393
|
*/
|
|
580
1394
|
"unicorn/prefer-default-parameters": "warn",
|
|
1395
|
+
/*
|
|
1396
|
+
* Prefer direct iteration over default iterator method calls.
|
|
1397
|
+
*
|
|
1398
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-direct-iteration.md
|
|
1399
|
+
*/
|
|
1400
|
+
"unicorn/prefer-direct-iteration": "warn",
|
|
1401
|
+
/*
|
|
1402
|
+
* Prefer using `using`/`await using` over manual `try`/`finally` resource disposal.
|
|
1403
|
+
*
|
|
1404
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dispose.md
|
|
1405
|
+
*/
|
|
1406
|
+
"unicorn/prefer-dispose": "warn",
|
|
581
1407
|
/*
|
|
582
1408
|
* Prefer Node#append() over Node#appendChild()
|
|
583
1409
|
*
|
|
@@ -585,23 +1411,49 @@ export const unicornPluginConfig = {
|
|
|
585
1411
|
*/
|
|
586
1412
|
"unicorn/prefer-dom-node-append": "warn",
|
|
587
1413
|
/*
|
|
588
|
-
* Prefer
|
|
1414
|
+
* Prefer `.getHTML()` and `.setHTML()` over `.innerHTML`.
|
|
589
1415
|
*
|
|
590
|
-
*
|
|
1416
|
+
* This is off because Safari doesn't support these yet.
|
|
1417
|
+
*
|
|
1418
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-html-methods.md
|
|
591
1419
|
*/
|
|
592
|
-
"unicorn/prefer-dom-node-
|
|
1420
|
+
"unicorn/prefer-dom-node-html-methods": "off",
|
|
593
1421
|
/*
|
|
594
1422
|
* Prefer childNode.remove() over parentNode.removeChild(childNode)
|
|
595
1423
|
*
|
|
596
1424
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-remove.md
|
|
597
1425
|
*/
|
|
598
1426
|
"unicorn/prefer-dom-node-remove": "warn",
|
|
1427
|
+
/*
|
|
1428
|
+
* Prefer `.replaceChildren()` when emptying DOM children.
|
|
1429
|
+
*
|
|
1430
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-replace-children.md
|
|
1431
|
+
*/
|
|
1432
|
+
"unicorn/prefer-dom-node-replace-children": "warn",
|
|
599
1433
|
/*
|
|
600
1434
|
* Prefer .textContent over .innerText
|
|
601
1435
|
*
|
|
602
1436
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-text-content.md
|
|
603
1437
|
*/
|
|
604
1438
|
"unicorn/prefer-dom-node-text-content": "warn",
|
|
1439
|
+
/*
|
|
1440
|
+
* Prefer early returns over full-function conditional wrapping.
|
|
1441
|
+
*
|
|
1442
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-early-return.md
|
|
1443
|
+
*/
|
|
1444
|
+
"unicorn/prefer-early-return": "warn",
|
|
1445
|
+
/*
|
|
1446
|
+
* Prefer `else if` over adjacent `if` statements with related conditions.
|
|
1447
|
+
*
|
|
1448
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-else-if.md
|
|
1449
|
+
*/
|
|
1450
|
+
"unicorn/prefer-else-if": "warn",
|
|
1451
|
+
/*
|
|
1452
|
+
* Prefer `Error.isError()` when checking for errors.
|
|
1453
|
+
*
|
|
1454
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-error-is-error.md
|
|
1455
|
+
*/
|
|
1456
|
+
"unicorn/prefer-error-is-error": "warn",
|
|
605
1457
|
/*
|
|
606
1458
|
* While EventEmitter is only available in Node.js, EventTarget is also available in Deno and browsers.
|
|
607
1459
|
*
|
|
@@ -616,12 +1468,60 @@ export const unicornPluginConfig = {
|
|
|
616
1468
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-export-from.md
|
|
617
1469
|
*/
|
|
618
1470
|
"unicorn/prefer-export-from": "warn",
|
|
1471
|
+
/*
|
|
1472
|
+
* Prefer flat `Math.min()` and `Math.max()` calls over nested calls.
|
|
1473
|
+
*
|
|
1474
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-flat-math-min-max.md
|
|
1475
|
+
*/
|
|
1476
|
+
"unicorn/prefer-flat-math-min-max": "warn",
|
|
1477
|
+
/*
|
|
1478
|
+
* Prefer `.getOrInsertComputed()` when the default value has side effects.
|
|
1479
|
+
*
|
|
1480
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-get-or-insert-computed.md
|
|
1481
|
+
*/
|
|
1482
|
+
"unicorn/prefer-get-or-insert-computed": "warn",
|
|
1483
|
+
/*
|
|
1484
|
+
* Prefer global numeric constants over `Number` static properties.
|
|
1485
|
+
*
|
|
1486
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-global-number-constants.md
|
|
1487
|
+
*/
|
|
1488
|
+
"unicorn/prefer-global-number-constants": "warn",
|
|
619
1489
|
/*
|
|
620
1490
|
* Prefer `globalThis` over `window`, `self`, and `global`.
|
|
621
1491
|
*
|
|
622
1492
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-global-this.md
|
|
623
1493
|
*/
|
|
624
1494
|
"unicorn/prefer-global-this": "warn",
|
|
1495
|
+
/*
|
|
1496
|
+
* Prefer `Object.groupBy()` or `Map.groupBy()` over reduce-based grouping.
|
|
1497
|
+
*
|
|
1498
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-group-by.md
|
|
1499
|
+
*/
|
|
1500
|
+
"unicorn/prefer-group-by": "warn",
|
|
1501
|
+
/*
|
|
1502
|
+
* Prefer `.has()` when checking existence.
|
|
1503
|
+
*
|
|
1504
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-has-check.md
|
|
1505
|
+
*/
|
|
1506
|
+
"unicorn/prefer-has-check": "warn",
|
|
1507
|
+
/*
|
|
1508
|
+
* Prefer moving code shared by all branches of an `if` statement out of the branches.
|
|
1509
|
+
*
|
|
1510
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-hoisting-branch-code.md
|
|
1511
|
+
*/
|
|
1512
|
+
"unicorn/prefer-hoisting-branch-code": "warn",
|
|
1513
|
+
/*
|
|
1514
|
+
* Prefer HTTPS over HTTP.
|
|
1515
|
+
*
|
|
1516
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-https.md
|
|
1517
|
+
*/
|
|
1518
|
+
"unicorn/prefer-https": "warn",
|
|
1519
|
+
/*
|
|
1520
|
+
* Prefer identifiers over string literals in import and export specifiers.
|
|
1521
|
+
*
|
|
1522
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-identifier-import-export-specifiers.md
|
|
1523
|
+
*/
|
|
1524
|
+
"unicorn/prefer-identifier-import-export-specifiers": "warn",
|
|
625
1525
|
/*
|
|
626
1526
|
* Prefer `import.meta.{dirname,filename}` over legacy techniques for getting file paths
|
|
627
1527
|
*
|
|
@@ -635,23 +1535,79 @@ export const unicornPluginConfig = {
|
|
|
635
1535
|
*/
|
|
636
1536
|
"unicorn/prefer-includes": "warn",
|
|
637
1537
|
/*
|
|
638
|
-
* Prefer
|
|
1538
|
+
* Prefer `.includes()` over repeated equality comparisons.
|
|
1539
|
+
*
|
|
1540
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes-over-repeated-comparisons.md
|
|
1541
|
+
*/
|
|
1542
|
+
"unicorn/prefer-includes-over-repeated-comparisons": "warn",
|
|
1543
|
+
/*
|
|
1544
|
+
* Prefer passing iterables directly to constructors instead of filling empty collections.
|
|
1545
|
+
*
|
|
1546
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-iterable-in-constructor.md
|
|
1547
|
+
*/
|
|
1548
|
+
"unicorn/prefer-iterable-in-constructor": "warn",
|
|
1549
|
+
/*
|
|
1550
|
+
* Prefer `Iterator.concat(…)` over temporary spread arrays.
|
|
1551
|
+
*
|
|
1552
|
+
* Off for now because I can't get TypeScript to enable this
|
|
1553
|
+
*
|
|
1554
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-iterator-concat.md
|
|
1555
|
+
*/
|
|
1556
|
+
"unicorn/prefer-iterator-concat": "off",
|
|
1557
|
+
/*
|
|
1558
|
+
* Prefer iterator helpers over temporary arrays from iterators.
|
|
1559
|
+
*
|
|
1560
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-iterator-helpers.md
|
|
1561
|
+
*/
|
|
1562
|
+
"unicorn/prefer-iterator-helpers": "warn",
|
|
1563
|
+
/*
|
|
1564
|
+
* Prefer `Iterator#toArray()` over temporary arrays from iterator spreads.
|
|
639
1565
|
*
|
|
640
|
-
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-
|
|
1566
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-iterator-to-array.md
|
|
641
1567
|
*/
|
|
642
|
-
"unicorn/prefer-
|
|
1568
|
+
"unicorn/prefer-iterator-to-array": "warn",
|
|
1569
|
+
/*
|
|
1570
|
+
* Prefer moving `.toArray()` to the end of iterator helper chains.
|
|
1571
|
+
*
|
|
1572
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-iterator-to-array-at-end.md
|
|
1573
|
+
*/
|
|
1574
|
+
"unicorn/prefer-iterator-to-array-at-end": "warn",
|
|
643
1575
|
/*
|
|
644
1576
|
* Prefer KeyboardEvent#key over KeyboardEvent#keyCode
|
|
645
1577
|
*
|
|
646
1578
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-keyboard-event-key.md
|
|
647
1579
|
*/
|
|
648
1580
|
"unicorn/prefer-keyboard-event-key": "warn",
|
|
1581
|
+
/*
|
|
1582
|
+
* Prefer `location.assign()` over assigning to `location.href`.
|
|
1583
|
+
*
|
|
1584
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-location-assign.md
|
|
1585
|
+
*/
|
|
1586
|
+
"unicorn/prefer-location-assign": "warn",
|
|
649
1587
|
/*
|
|
650
1588
|
* Prefer using a logical operator over a ternary
|
|
651
1589
|
*
|
|
652
1590
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-logical-operator-over-ternary.md
|
|
653
1591
|
*/
|
|
654
1592
|
"unicorn/prefer-logical-operator-over-ternary": "warn",
|
|
1593
|
+
/*
|
|
1594
|
+
* Prefer `new Map()` over `Object.fromEntries()` when using the result as a map.
|
|
1595
|
+
*
|
|
1596
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-map-from-entries.md
|
|
1597
|
+
*/
|
|
1598
|
+
"unicorn/prefer-map-from-entries": "warn",
|
|
1599
|
+
/*
|
|
1600
|
+
* Prefer `Math.abs()` over manual absolute value expressions and symmetric range checks.
|
|
1601
|
+
*
|
|
1602
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-math-abs.md
|
|
1603
|
+
*/
|
|
1604
|
+
"unicorn/prefer-math-abs": "warn",
|
|
1605
|
+
/*
|
|
1606
|
+
* Prefer `Math` constants over their approximate numeric values.
|
|
1607
|
+
*
|
|
1608
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-math-constants.md
|
|
1609
|
+
*/
|
|
1610
|
+
"unicorn/prefer-math-constants": "warn",
|
|
655
1611
|
/*
|
|
656
1612
|
* Prefer Math.min() and Math.max() over ternaries for simple comparisons
|
|
657
1613
|
*
|
|
@@ -664,6 +1620,12 @@ export const unicornPluginConfig = {
|
|
|
664
1620
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-math-trunc.md
|
|
665
1621
|
*/
|
|
666
1622
|
"unicorn/prefer-math-trunc": "warn",
|
|
1623
|
+
/*
|
|
1624
|
+
* Prefer moving ternaries into the minimal varying part of an expression.
|
|
1625
|
+
*
|
|
1626
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-minimal-ternary.md
|
|
1627
|
+
*/
|
|
1628
|
+
"unicorn/prefer-minimal-ternary": "warn",
|
|
667
1629
|
/*
|
|
668
1630
|
* Prefer modern DOM APIs
|
|
669
1631
|
*
|
|
@@ -699,29 +1661,87 @@ export const unicornPluginConfig = {
|
|
|
699
1661
|
/*
|
|
700
1662
|
* Prefer using the node: protocol when importing Node.js builtin modules
|
|
701
1663
|
*
|
|
702
|
-
* Off for now since this isn't supported in node < 16 in require() and we compile down to require()
|
|
703
|
-
*
|
|
704
1664
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
705
1665
|
*/
|
|
706
|
-
"unicorn/prefer-node-protocol": "
|
|
1666
|
+
"unicorn/prefer-node-protocol": "warn",
|
|
1667
|
+
/*
|
|
1668
|
+
* Prefer `Number()` over `parseFloat()` and base-10 `parseInt()`.
|
|
1669
|
+
*
|
|
1670
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-coercion.md
|
|
1671
|
+
*/
|
|
1672
|
+
"unicorn/prefer-number-coercion": "warn",
|
|
1673
|
+
/*
|
|
1674
|
+
* Prefer `Number.isSafeInteger()` over integer checks.
|
|
1675
|
+
*
|
|
1676
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-is-safe-integer.md
|
|
1677
|
+
*/
|
|
1678
|
+
"unicorn/prefer-number-is-safe-integer": "warn",
|
|
707
1679
|
/*
|
|
708
1680
|
* Prefer Number static properties over global ones.
|
|
709
1681
|
*
|
|
710
1682
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md
|
|
711
1683
|
*/
|
|
712
1684
|
"unicorn/prefer-number-properties": "warn",
|
|
1685
|
+
/*
|
|
1686
|
+
* Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls.
|
|
1687
|
+
*
|
|
1688
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-define-properties.md
|
|
1689
|
+
*/
|
|
1690
|
+
"unicorn/prefer-object-define-properties": "warn",
|
|
1691
|
+
/*
|
|
1692
|
+
* Prefer object destructuring defaults over default object literals with spread.
|
|
1693
|
+
*
|
|
1694
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-destructuring-defaults.md
|
|
1695
|
+
*/
|
|
1696
|
+
"unicorn/prefer-object-destructuring-defaults": "warn",
|
|
713
1697
|
/*
|
|
714
1698
|
* Prefer using Object.fromEntries(...) to transform a list of key-value pairs into an object
|
|
715
1699
|
*
|
|
716
1700
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-from-entries.md
|
|
717
1701
|
*/
|
|
718
1702
|
"unicorn/prefer-object-from-entries": "warn",
|
|
1703
|
+
/*
|
|
1704
|
+
* Prefer the most specific `Object` iterable method.
|
|
1705
|
+
*
|
|
1706
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-iterable-methods.md
|
|
1707
|
+
*/
|
|
1708
|
+
"unicorn/prefer-object-iterable-methods": "warn",
|
|
1709
|
+
/*
|
|
1710
|
+
* Prefer observer APIs over resize and scroll listeners with layout reads.
|
|
1711
|
+
*
|
|
1712
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-observer-apis.md
|
|
1713
|
+
*/
|
|
1714
|
+
"unicorn/prefer-observer-apis": "warn",
|
|
719
1715
|
/*
|
|
720
1716
|
* Prefer omitting the catch binding parameter
|
|
721
1717
|
*
|
|
722
1718
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-optional-catch-binding.md
|
|
723
1719
|
*/
|
|
724
1720
|
"unicorn/prefer-optional-catch-binding": "warn",
|
|
1721
|
+
/*
|
|
1722
|
+
* Prefer `Path2D` for repeatedly drawn canvas paths.
|
|
1723
|
+
*
|
|
1724
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-path2d.md
|
|
1725
|
+
*/
|
|
1726
|
+
"unicorn/prefer-path2d": "warn",
|
|
1727
|
+
/*
|
|
1728
|
+
* Prefer private class fields over the underscore-prefix convention.
|
|
1729
|
+
*
|
|
1730
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-private-class-fields.md
|
|
1731
|
+
*/
|
|
1732
|
+
"unicorn/prefer-private-class-fields": "warn",
|
|
1733
|
+
/*
|
|
1734
|
+
* Prefer `Promise.try()` over promise-wrapping boilerplate.
|
|
1735
|
+
*
|
|
1736
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-promise-try.md
|
|
1737
|
+
*/
|
|
1738
|
+
"unicorn/prefer-promise-try": "warn",
|
|
1739
|
+
/*
|
|
1740
|
+
* Prefer `Promise.withResolvers()` when extracting resolver functions from `new Promise()`.
|
|
1741
|
+
*
|
|
1742
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-promise-with-resolvers.md
|
|
1743
|
+
*/
|
|
1744
|
+
"unicorn/prefer-promise-with-resolvers": "warn",
|
|
725
1745
|
/*
|
|
726
1746
|
* Prefer borrowing methods from the prototype instead of methods from an instance
|
|
727
1747
|
*
|
|
@@ -734,12 +1754,24 @@ export const unicornPluginConfig = {
|
|
|
734
1754
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-replace-all.md
|
|
735
1755
|
*/
|
|
736
1756
|
"unicorn/prefer-query-selector": "warn",
|
|
1757
|
+
/*
|
|
1758
|
+
* Prefer `queueMicrotask()` over `process.nextTick()`, `setImmediate()`, and `setTimeout(…, 0)`.
|
|
1759
|
+
*
|
|
1760
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-queue-microtask.md
|
|
1761
|
+
*/
|
|
1762
|
+
"unicorn/prefer-queue-microtask": "warn",
|
|
737
1763
|
/*
|
|
738
1764
|
* Prefer querySelector over getElementById, querySelectorAll over getElementsByClassName and getElementsByTagName. (partly fixable)
|
|
739
1765
|
*
|
|
740
1766
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-query-selector.md
|
|
741
1767
|
*/
|
|
742
1768
|
"unicorn/prefer-reflect-apply": "warn",
|
|
1769
|
+
/*
|
|
1770
|
+
* Prefer `RegExp.escape()` for escaping strings to use in regular expressions.
|
|
1771
|
+
*
|
|
1772
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-regexp-escape.md
|
|
1773
|
+
*/
|
|
1774
|
+
"unicorn/prefer-regexp-escape": "warn",
|
|
743
1775
|
/*
|
|
744
1776
|
* Prefer RegExp#test() over String#match() and RegExp#exec()
|
|
745
1777
|
*
|
|
@@ -752,6 +1784,12 @@ export const unicornPluginConfig = {
|
|
|
752
1784
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-response-static-json.md
|
|
753
1785
|
*/
|
|
754
1786
|
"unicorn/prefer-response-static-json": "warn",
|
|
1787
|
+
/*
|
|
1788
|
+
* Prefer `:scope` when using element query selector methods.
|
|
1789
|
+
*
|
|
1790
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-scoped-selector.md
|
|
1791
|
+
*/
|
|
1792
|
+
"unicorn/prefer-scoped-selector": "warn",
|
|
755
1793
|
/*
|
|
756
1794
|
* Prefer Set#has() over Array#includes() when checking for existence or non-existenc (fixable)
|
|
757
1795
|
*
|
|
@@ -760,30 +1798,108 @@ export const unicornPluginConfig = {
|
|
|
760
1798
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-has.md
|
|
761
1799
|
*/
|
|
762
1800
|
"unicorn/prefer-set-has": "off",
|
|
1801
|
+
/*
|
|
1802
|
+
* Prefer `Set` methods for Set operations.
|
|
1803
|
+
*
|
|
1804
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-methods.md
|
|
1805
|
+
*/
|
|
1806
|
+
"unicorn/prefer-set-methods": "warn",
|
|
763
1807
|
/*
|
|
764
1808
|
* Prefer using Set#size instead of Array#length
|
|
765
1809
|
*
|
|
766
1810
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-size.md
|
|
767
1811
|
*/
|
|
768
1812
|
"unicorn/prefer-set-size": "warn",
|
|
1813
|
+
/*
|
|
1814
|
+
* Prefer arrow function properties over methods with a single return.
|
|
1815
|
+
*
|
|
1816
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-short-arrow-method.md
|
|
1817
|
+
*/
|
|
1818
|
+
"unicorn/prefer-short-arrow-method": "warn",
|
|
1819
|
+
/*
|
|
1820
|
+
* Prefer simple conditions first in logical expressions.
|
|
1821
|
+
*
|
|
1822
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-simple-condition-first.md
|
|
1823
|
+
*/
|
|
1824
|
+
"unicorn/prefer-simple-condition-first": "warn",
|
|
1825
|
+
/*
|
|
1826
|
+
* Prefer a simple comparison function for `Array#sort()`.
|
|
1827
|
+
*
|
|
1828
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-simple-sort-comparator.md
|
|
1829
|
+
*/
|
|
1830
|
+
"unicorn/prefer-simple-sort-comparator": "warn",
|
|
1831
|
+
/*
|
|
1832
|
+
* Prefer simplified conditions.
|
|
1833
|
+
*
|
|
1834
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-simplified-conditions.md
|
|
1835
|
+
*/
|
|
1836
|
+
"unicorn/prefer-simplified-conditions": "warn",
|
|
1837
|
+
/*
|
|
1838
|
+
* Prefer a single `Array#some()` or `Array#every()` with a combined predicate.
|
|
1839
|
+
*
|
|
1840
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-single-array-predicate.md
|
|
1841
|
+
*/
|
|
1842
|
+
"unicorn/prefer-single-array-predicate": "warn",
|
|
769
1843
|
/*
|
|
770
1844
|
* Prefer using Set#size instead of Array#length
|
|
771
1845
|
*
|
|
772
1846
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-single-call.md
|
|
773
1847
|
*/
|
|
774
1848
|
"unicorn/prefer-single-call": "warn",
|
|
1849
|
+
/*
|
|
1850
|
+
* Prefer a single object destructuring declaration per local const source.
|
|
1851
|
+
*
|
|
1852
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-single-object-destructuring.md
|
|
1853
|
+
*/
|
|
1854
|
+
"unicorn/prefer-single-object-destructuring": "warn",
|
|
1855
|
+
/*
|
|
1856
|
+
* Enforce combining multiple single-character replacements into a single `String#replaceAll()` with a regular expression.
|
|
1857
|
+
*
|
|
1858
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-single-replace.md
|
|
1859
|
+
*/
|
|
1860
|
+
"unicorn/prefer-single-replace": "warn",
|
|
1861
|
+
/*
|
|
1862
|
+
* Prefer declaring variables in the smallest possible scope.
|
|
1863
|
+
*
|
|
1864
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-smaller-scope.md
|
|
1865
|
+
*/
|
|
1866
|
+
"unicorn/prefer-smaller-scope": "warn",
|
|
1867
|
+
/*
|
|
1868
|
+
* Prefer `String#split()` with a limit.
|
|
1869
|
+
*
|
|
1870
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-split-limit.md
|
|
1871
|
+
*/
|
|
1872
|
+
"unicorn/prefer-split-limit": "warn",
|
|
775
1873
|
/*
|
|
776
1874
|
* Prefer the spread operator over Array.from(). (fixable)
|
|
777
1875
|
*
|
|
778
1876
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-spread.md
|
|
779
1877
|
*/
|
|
780
1878
|
"unicorn/prefer-spread": "warn",
|
|
1879
|
+
/*
|
|
1880
|
+
* Prefer `String#matchAll()` over `RegExp#exec()` loops.
|
|
1881
|
+
*
|
|
1882
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-match-all.md
|
|
1883
|
+
*/
|
|
1884
|
+
"unicorn/prefer-string-match-all": "warn",
|
|
1885
|
+
/*
|
|
1886
|
+
* Prefer `String#padStart()` and `String#padEnd()` over manual string padding.
|
|
1887
|
+
*
|
|
1888
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-pad-start-end.md
|
|
1889
|
+
*/
|
|
1890
|
+
"unicorn/prefer-string-pad-start-end": "warn",
|
|
781
1891
|
/*
|
|
782
1892
|
* Prefer using the String.raw tag to avoid escaping \
|
|
783
1893
|
*
|
|
784
1894
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-raw.md
|
|
785
1895
|
*/
|
|
786
1896
|
"unicorn/prefer-string-raw": "warn",
|
|
1897
|
+
/*
|
|
1898
|
+
* Prefer `String#repeat()` for repeated whitespace.
|
|
1899
|
+
*
|
|
1900
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-repeat.md
|
|
1901
|
+
*/
|
|
1902
|
+
"unicorn/prefer-string-repeat": "warn",
|
|
787
1903
|
/*
|
|
788
1904
|
* Prefer String#replaceAll() over regex searches with the global flag
|
|
789
1905
|
*
|
|
@@ -834,6 +1950,14 @@ export const unicornPluginConfig = {
|
|
|
834
1950
|
minimumCases: 3,
|
|
835
1951
|
},
|
|
836
1952
|
],
|
|
1953
|
+
/*
|
|
1954
|
+
* Prefer `Temporal` over `Date`.
|
|
1955
|
+
*
|
|
1956
|
+
* Off for now - need to know more before it's safe
|
|
1957
|
+
*
|
|
1958
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-temporal.md
|
|
1959
|
+
*/
|
|
1960
|
+
"unicorn/prefer-temporal": "off",
|
|
837
1961
|
/*
|
|
838
1962
|
* Prefer ternary expressions over simple if-else statements
|
|
839
1963
|
*
|
|
@@ -842,6 +1966,12 @@ export const unicornPluginConfig = {
|
|
|
842
1966
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-ternary.md
|
|
843
1967
|
*/
|
|
844
1968
|
"unicorn/prefer-ternary": "off",
|
|
1969
|
+
/*
|
|
1970
|
+
* Prefer using `Element#toggleAttribute()` to toggle attributes.
|
|
1971
|
+
*
|
|
1972
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-toggle-attribute.md
|
|
1973
|
+
*/
|
|
1974
|
+
"unicorn/prefer-toggle-attribute": "warn",
|
|
845
1975
|
/*
|
|
846
1976
|
* Prefer top-level await over top-level promises and async function calls
|
|
847
1977
|
*
|
|
@@ -857,65 +1987,57 @@ export const unicornPluginConfig = {
|
|
|
857
1987
|
*/
|
|
858
1988
|
"unicorn/prefer-type-error": "warn",
|
|
859
1989
|
/*
|
|
860
|
-
*
|
|
1990
|
+
* Require type literals to be last in union and intersection types.
|
|
861
1991
|
*
|
|
862
|
-
*
|
|
863
|
-
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/rules/prevent-abbreviations.js#L13
|
|
1992
|
+
* Perfectionist is handling this, turning it on causes recursive fixes
|
|
864
1993
|
*
|
|
865
|
-
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/
|
|
1994
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-type-literal-last.md
|
|
866
1995
|
*/
|
|
867
|
-
"unicorn/
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
props: {
|
|
913
|
-
// This is used extremely frequently in react and we don't want to change it
|
|
914
|
-
properties: false,
|
|
915
|
-
},
|
|
916
|
-
},
|
|
917
|
-
},
|
|
918
|
-
],
|
|
1996
|
+
"unicorn/prefer-type-literal-last": "off",
|
|
1997
|
+
/*
|
|
1998
|
+
* Prefer `Uint8Array#toBase64()` and `Uint8Array.fromBase64()` over `atob()`, `btoa()`, and `Buffer` base64 conversions.
|
|
1999
|
+
*
|
|
2000
|
+
* Need to find out more before we can consider this safe
|
|
2001
|
+
*
|
|
2002
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-uint8array-base64.md
|
|
2003
|
+
*/
|
|
2004
|
+
"unicorn/prefer-uint8array-base64": "off",
|
|
2005
|
+
/*
|
|
2006
|
+
* Prefer the unary minus operator over multiplying or dividing by `-1`.
|
|
2007
|
+
*
|
|
2008
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-unary-minus.md
|
|
2009
|
+
*/
|
|
2010
|
+
"unicorn/prefer-unary-minus": "warn",
|
|
2011
|
+
/*
|
|
2012
|
+
* Prefer Unicode code point escapes over legacy escape sequences.
|
|
2013
|
+
*
|
|
2014
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-unicode-code-point-escapes.md
|
|
2015
|
+
*/
|
|
2016
|
+
"unicorn/prefer-unicode-code-point-escapes": "warn",
|
|
2017
|
+
/*
|
|
2018
|
+
* Prefer `URL.canParse()` over constructing a `URL` in a try/catch for validation.
|
|
2019
|
+
*
|
|
2020
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-url-can-parse.md
|
|
2021
|
+
*/
|
|
2022
|
+
"unicorn/prefer-url-can-parse": "warn",
|
|
2023
|
+
/*
|
|
2024
|
+
* Prefer `URL#href` over stringifying a `URL`.
|
|
2025
|
+
*
|
|
2026
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-url-href.md
|
|
2027
|
+
*/
|
|
2028
|
+
"unicorn/prefer-url-href": "warn",
|
|
2029
|
+
/*
|
|
2030
|
+
* Prefer `URLSearchParams` over manually splitting query strings.
|
|
2031
|
+
*
|
|
2032
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-url-search-parameters.md
|
|
2033
|
+
*/
|
|
2034
|
+
"unicorn/prefer-url-search-parameters": "warn",
|
|
2035
|
+
/*
|
|
2036
|
+
* Prefer putting the condition in the while statement.
|
|
2037
|
+
*
|
|
2038
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-while-loop-condition.md
|
|
2039
|
+
*/
|
|
2040
|
+
"unicorn/prefer-while-loop-condition": "warn",
|
|
919
2041
|
/*
|
|
920
2042
|
* Enforce consistent relative URL style
|
|
921
2043
|
*
|
|
@@ -931,6 +2053,21 @@ export const unicornPluginConfig = {
|
|
|
931
2053
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-join-separator.md
|
|
932
2054
|
*/
|
|
933
2055
|
"unicorn/require-array-join-separator": "warn",
|
|
2056
|
+
/*
|
|
2057
|
+
* Require a compare function when calling `Array#sort()` or `Array#toSorted()`.
|
|
2058
|
+
*
|
|
2059
|
+
* Off because @typescript-eslint/require-array-sort-compare handles this better as it's type aware and doesn't
|
|
2060
|
+
* flag string arrays.
|
|
2061
|
+
*
|
|
2062
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-sort-compare.md
|
|
2063
|
+
*/
|
|
2064
|
+
"unicorn/require-array-sort-compare": "off",
|
|
2065
|
+
/*
|
|
2066
|
+
* Require `CSS.escape()` for interpolated values in CSS selectors.
|
|
2067
|
+
*
|
|
2068
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-css-escape.md
|
|
2069
|
+
*/
|
|
2070
|
+
"unicorn/require-css-escape": "warn",
|
|
934
2071
|
/*
|
|
935
2072
|
* Require non-empty module attributes for imports and exports
|
|
936
2073
|
*
|
|
@@ -949,12 +2086,24 @@ export const unicornPluginConfig = {
|
|
|
949
2086
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-number-to-fixed-digits-argument.md
|
|
950
2087
|
*/
|
|
951
2088
|
"unicorn/require-number-to-fixed-digits-argument": "warn",
|
|
2089
|
+
/*
|
|
2090
|
+
* Require passive event listeners for high-frequency events.
|
|
2091
|
+
*
|
|
2092
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-passive-events.md
|
|
2093
|
+
*/
|
|
2094
|
+
"unicorn/require-passive-events": "warn",
|
|
952
2095
|
/*
|
|
953
2096
|
* Enforce using the targetOrigin argument with window.postMessage()
|
|
954
2097
|
*
|
|
955
2098
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-post-message-target-origin.md
|
|
956
2099
|
*/
|
|
957
2100
|
"unicorn/require-post-message-target-origin": "warn",
|
|
2101
|
+
/*
|
|
2102
|
+
* Require boolean-returning Proxy traps to return booleans.
|
|
2103
|
+
*
|
|
2104
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-proxy-trap-boolean-return.md
|
|
2105
|
+
*/
|
|
2106
|
+
"unicorn/require-proxy-trap-boolean-return": "warn",
|
|
958
2107
|
/*
|
|
959
2108
|
* Enforce certain things about the contents of strings. For example, you
|
|
960
2109
|
* can enforce using ’ instead of ' to avoid escaping. Or you could block
|
|
@@ -975,13 +2124,17 @@ export const unicornPluginConfig = {
|
|
|
975
2124
|
"always",
|
|
976
2125
|
],
|
|
977
2126
|
/*
|
|
978
|
-
*
|
|
2127
|
+
* Enforce consistent break/return/continue/throw position in case clauses.
|
|
979
2128
|
*
|
|
980
|
-
*
|
|
2129
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/switch-case-break-position.md
|
|
2130
|
+
*/
|
|
2131
|
+
"unicorn/switch-case-break-position": "warn",
|
|
2132
|
+
/*
|
|
2133
|
+
* Fix whitespace-insensitive template indentation
|
|
981
2134
|
*
|
|
982
2135
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/template-indent.md
|
|
983
2136
|
*/
|
|
984
|
-
"unicorn/template-indent": "
|
|
2137
|
+
"unicorn/template-indent": "warn",
|
|
985
2138
|
/*
|
|
986
2139
|
* Enforce consistent case for text encoding identifiers
|
|
987
2140
|
*
|
|
@@ -994,5 +2147,11 @@ export const unicornPluginConfig = {
|
|
|
994
2147
|
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md
|
|
995
2148
|
*/
|
|
996
2149
|
"unicorn/throw-new-error": "warn",
|
|
2150
|
+
/*
|
|
2151
|
+
* Limit the complexity of `try` blocks.
|
|
2152
|
+
*
|
|
2153
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/try-complexity.md
|
|
2154
|
+
*/
|
|
2155
|
+
"unicorn/try-complexity": "warn",
|
|
997
2156
|
},
|
|
998
2157
|
};
|