@haltcase/style 6.2.1-canary.1 → 7.0.0-canary.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/eslint/configs/browser.js +19 -0
- package/eslint/configs/cjs.js +1 -0
- package/eslint/configs/internal/base.js +180 -0
- package/eslint/configs/internal/commonjs.js +22 -0
- package/eslint/{rules → configs/internal}/es2015.js +14 -16
- package/eslint/configs/internal/simple-import-sort.js +24 -0
- package/eslint/configs/internal/tsdoc.js +17 -0
- package/eslint/{rules → configs/internal}/unicorn.js +116 -121
- package/eslint/configs/next.js +36 -0
- package/eslint/configs/node.js +19 -0
- package/eslint/configs/playwright-test.js +17 -0
- package/eslint/configs/react.js +54 -0
- package/eslint/configs/typescript.js +84 -0
- package/eslint/constants.js +12 -28
- package/eslint/index.js +27 -0
- package/eslint/rules/best-practice.js +250 -245
- package/eslint/rules/imports.js +94 -0
- package/eslint/rules/jsx-a11y.js +11 -10
- package/eslint/rules/playwright-test.js +25 -26
- package/eslint/rules/possible-errors.js +38 -45
- package/eslint/rules/react.js +105 -104
- package/eslint/rules/stylistic.js +83 -84
- package/eslint/rules/typescript/extension.js +55 -39
- package/eslint/rules/typescript/import.js +16 -15
- package/eslint/rules/typescript/index.js +109 -121
- package/eslint/rules/typescript/naming-convention.js +71 -0
- package/eslint/rules/variables.js +34 -34
- package/eslint/withFiles.js +15 -0
- package/package.json +58 -56
- package/prettier/index.js +4 -11
- package/readme.md +181 -98
- package/stylelint/_base.js +2 -4
- package/stylelint/index.js +6 -7
- package/stylelint/modules.js +7 -8
- package/stylelint/standard.js +2 -5
- package/typescript/tsconfig.base.json +2 -1
- package/typescript/tsconfig.bundler.json +7 -3
- package/typescript/tsconfig.next.json +14 -6
- package/typescript/tsconfig.node.json +1 -1
- package/typescript/tsconfig.node18.json +4 -7
- package/typescript/tsconfig.node20.json +4 -7
- package/typescript/tsconfig.node22.json +10 -0
- package/typescript/tsconfig.web.json +1 -1
- package/eslint/_base.js +0 -82
- package/eslint/astro.js +0 -40
- package/eslint/browser.js +0 -8
- package/eslint/cjs.js +0 -12
- package/eslint/jest.js +0 -28
- package/eslint/next.js +0 -38
- package/eslint/node.js +0 -8
- package/eslint/playwright-test.js +0 -8
- package/eslint/react.js +0 -18
- package/eslint/rules/import.js +0 -92
- package/eslint/rules/jest.js +0 -28
- package/eslint/rules/simple-import-sort.js +0 -23
- package/eslint/rules/tsdoc.js +0 -17
- package/eslint/rules/typescript/strict.js +0 -18
- package/eslint/typescript.js +0 -26
- package/eslint/utils/require-package.js +0 -44
|
@@ -1,72 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
2
|
+
import { config } from "typescript-eslint";
|
|
2
3
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
} = require("../constants");
|
|
4
|
+
export const eslintUnicornConfig = config({
|
|
5
|
+
name: "@haltcase/internal/Unicorn",
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
plugins: {
|
|
8
|
+
unicorn: eslintPluginUnicorn
|
|
9
|
+
},
|
|
9
10
|
rules: {
|
|
10
|
-
/**
|
|
11
|
-
* Improve regexes by making them shorter, consistent, and safer.
|
|
12
|
-
*
|
|
13
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-regex.md
|
|
14
|
-
*/
|
|
15
|
-
"unicorn/better-regex": error,
|
|
16
11
|
/**
|
|
17
12
|
* Enforce a specific parameter name in catch clauses.
|
|
18
13
|
*
|
|
19
14
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/catch-error-name.md
|
|
20
15
|
*/
|
|
21
|
-
"unicorn/catch-error-name": error,
|
|
16
|
+
"unicorn/catch-error-name": "error",
|
|
22
17
|
/**
|
|
23
18
|
* Use destructured variables over properties.
|
|
24
19
|
*
|
|
25
20
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-destructuring.md
|
|
26
21
|
*/
|
|
27
|
-
"unicorn/consistent-destructuring": error,
|
|
22
|
+
"unicorn/consistent-destructuring": "error",
|
|
28
23
|
/**
|
|
29
24
|
* Move function definitions to the highest possible scope.
|
|
30
25
|
*
|
|
31
26
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-function-scoping.md
|
|
32
27
|
*/
|
|
33
|
-
"unicorn/consistent-function-scoping": error,
|
|
28
|
+
"unicorn/consistent-function-scoping": "error",
|
|
34
29
|
/**
|
|
35
30
|
* Enforce correct `Error` subclassing.
|
|
36
31
|
*
|
|
37
32
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/custom-error-definition.md
|
|
38
33
|
*/
|
|
39
|
-
"unicorn/custom-error-definition": error,
|
|
34
|
+
"unicorn/custom-error-definition": "error",
|
|
40
35
|
/**
|
|
41
36
|
* Enforce no spaces between braces.
|
|
42
37
|
*
|
|
43
38
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/empty-brace-spaces.md
|
|
44
39
|
*/
|
|
45
|
-
"unicorn/empty-brace-spaces": error,
|
|
40
|
+
"unicorn/empty-brace-spaces": "error",
|
|
46
41
|
/**
|
|
47
42
|
* Enforce passing a `message` value when creating a built-in error.
|
|
48
43
|
*
|
|
49
44
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/error-message.md
|
|
50
45
|
*/
|
|
51
|
-
"unicorn/error-message": error,
|
|
46
|
+
"unicorn/error-message": "error",
|
|
52
47
|
/**
|
|
53
48
|
* Require escape sequences to use uppercase values.
|
|
54
49
|
*
|
|
55
50
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/escape-case.md
|
|
56
51
|
*/
|
|
57
|
-
"unicorn/escape-case": error,
|
|
52
|
+
"unicorn/escape-case": "error",
|
|
58
53
|
/**
|
|
59
54
|
* Add expiration conditions to TODO comments.
|
|
60
55
|
*
|
|
61
56
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/expiring-todo-comments.md
|
|
62
57
|
*/
|
|
63
|
-
"unicorn/expiring-todo-comments": error,
|
|
58
|
+
"unicorn/expiring-todo-comments": "error",
|
|
64
59
|
/**
|
|
65
60
|
* Enforce explicitly comparing the `length` or `size` property of a value.
|
|
66
61
|
*
|
|
67
62
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/explicit-length-check.md
|
|
68
63
|
*/
|
|
69
|
-
"unicorn/explicit-length-check": error,
|
|
64
|
+
"unicorn/explicit-length-check": "error",
|
|
70
65
|
/**
|
|
71
66
|
* Require consistent filename case for all linted files.
|
|
72
67
|
*
|
|
@@ -74,49 +69,49 @@ module.exports = {
|
|
|
74
69
|
*
|
|
75
70
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
|
|
76
71
|
*/
|
|
77
|
-
"unicorn/filename-case": off,
|
|
72
|
+
"unicorn/filename-case": "off",
|
|
78
73
|
/**
|
|
79
74
|
* Enforce specific import styles per module.
|
|
80
75
|
*
|
|
81
76
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/import-style.md
|
|
82
77
|
*/
|
|
83
|
-
"unicorn/import-style": error,
|
|
78
|
+
"unicorn/import-style": "error",
|
|
84
79
|
/**
|
|
85
80
|
* Enforce the use of `new` for all builtins, except `String`, `Number`, `Boolean`, `Symbol` and `BigInt`.
|
|
86
81
|
*
|
|
87
82
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/new-for-builtins.md
|
|
88
83
|
*/
|
|
89
|
-
"unicorn/new-for-builtins": error,
|
|
84
|
+
"unicorn/new-for-builtins": "error",
|
|
90
85
|
/**
|
|
91
86
|
* Enforce specifying rules to disable in `eslint-disable` comments.
|
|
92
87
|
*
|
|
93
88
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-abusive-eslint-disable.md
|
|
94
89
|
*/
|
|
95
|
-
"unicorn/no-abusive-eslint-disable": error,
|
|
90
|
+
"unicorn/no-abusive-eslint-disable": "error",
|
|
96
91
|
/**
|
|
97
92
|
* Prevent passing a function reference directly to iterator methods.
|
|
98
93
|
*
|
|
99
94
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-callback-reference.md
|
|
100
95
|
*/
|
|
101
|
-
"unicorn/no-array-callback-reference": error,
|
|
96
|
+
"unicorn/no-array-callback-reference": "error",
|
|
102
97
|
/**
|
|
103
98
|
* Prefer `for…of` over the `forEach` method.
|
|
104
99
|
*
|
|
105
100
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-for-each.md
|
|
106
101
|
*/
|
|
107
|
-
"unicorn/no-array-for-each": error,
|
|
102
|
+
"unicorn/no-array-for-each": "error",
|
|
108
103
|
/**
|
|
109
104
|
* Disallow using the `this` argument in array methods.
|
|
110
105
|
*
|
|
111
106
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-method-this-argument.md
|
|
112
107
|
*/
|
|
113
|
-
"unicorn/no-array-method-this-argument": error,
|
|
108
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
114
109
|
/**
|
|
115
110
|
* Enforce combining multiple `Array#push()` into one call.
|
|
116
111
|
*
|
|
117
112
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-push-push.md
|
|
118
113
|
*/
|
|
119
|
-
"unicorn/no-array-push-push": error,
|
|
114
|
+
"unicorn/no-array-push-push": "error",
|
|
120
115
|
/**
|
|
121
116
|
* Disallow `Array#reduce()` and `Array#reduceRight()`.
|
|
122
117
|
*
|
|
@@ -124,55 +119,55 @@ module.exports = {
|
|
|
124
119
|
*
|
|
125
120
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reduce.md
|
|
126
121
|
*/
|
|
127
|
-
"unicorn/no-array-reduce": off,
|
|
122
|
+
"unicorn/no-array-reduce": "off",
|
|
128
123
|
/**
|
|
129
124
|
* Disallow member access from await expression.
|
|
130
125
|
*
|
|
131
126
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-expression-member.md
|
|
132
127
|
*/
|
|
133
|
-
"unicorn/no-await-expression-member": error,
|
|
128
|
+
"unicorn/no-await-expression-member": "error",
|
|
134
129
|
/**
|
|
135
130
|
* Do not use leading/trailing space between `console.log` parameters.
|
|
136
131
|
*
|
|
137
132
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-console-spaces.md
|
|
138
133
|
*/
|
|
139
|
-
"unicorn/no-console-spaces": error,
|
|
134
|
+
"unicorn/no-console-spaces": "error",
|
|
140
135
|
/**
|
|
141
136
|
* Do not use `document.cookie` directly.
|
|
142
137
|
*
|
|
143
138
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-document-cookie.md
|
|
144
139
|
*/
|
|
145
|
-
"unicorn/no-document-cookie": error,
|
|
140
|
+
"unicorn/no-document-cookie": "error",
|
|
146
141
|
/**
|
|
147
142
|
* Disallow empty files.
|
|
148
143
|
*
|
|
149
144
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-empty-file.md
|
|
150
145
|
*/
|
|
151
|
-
"unicorn/no-empty-file": error,
|
|
146
|
+
"unicorn/no-empty-file": "error",
|
|
152
147
|
/**
|
|
153
148
|
* Do not use a `for` loop that can be replaced with a `for-of` loop.
|
|
154
149
|
*
|
|
155
150
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-for-loop.md
|
|
156
151
|
*/
|
|
157
|
-
"unicorn/no-for-loop": error,
|
|
152
|
+
"unicorn/no-for-loop": "error",
|
|
158
153
|
/**
|
|
159
154
|
* Enforce the use of Unicode escapes instead of hexadecimal escapes.
|
|
160
155
|
*
|
|
161
156
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-hex-escape.md
|
|
162
157
|
*/
|
|
163
|
-
"unicorn/no-hex-escape": error,
|
|
158
|
+
"unicorn/no-hex-escape": "error",
|
|
164
159
|
/**
|
|
165
160
|
* Require `Array.isArray()` instead of `instanceof Array`.
|
|
166
161
|
*
|
|
167
162
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-array.md
|
|
168
163
|
*/
|
|
169
|
-
"unicorn/no-instanceof-array": error,
|
|
164
|
+
"unicorn/no-instanceof-array": "error",
|
|
170
165
|
/**
|
|
171
166
|
* Prevent calling `EventTarget#removeEventListener()` with the result of an expression.
|
|
172
167
|
*
|
|
173
168
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-remove-event-listener.md
|
|
174
169
|
*/
|
|
175
|
-
"unicorn/no-invalid-remove-event-listener": error,
|
|
170
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
176
171
|
/**
|
|
177
172
|
* Disallow identifiers starting with `new` or `class`.
|
|
178
173
|
*
|
|
@@ -180,37 +175,37 @@ module.exports = {
|
|
|
180
175
|
*
|
|
181
176
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-keyword-prefix.md
|
|
182
177
|
*/
|
|
183
|
-
"unicorn/no-keyword-prefix": off,
|
|
178
|
+
"unicorn/no-keyword-prefix": "off",
|
|
184
179
|
/**
|
|
185
180
|
* Disallow `if` statements as the only statement in `if` blocks without `else`.
|
|
186
181
|
*
|
|
187
182
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-lonely-if.md
|
|
188
183
|
*/
|
|
189
|
-
"unicorn/no-lonely-if": error,
|
|
184
|
+
"unicorn/no-lonely-if": "error",
|
|
190
185
|
/**
|
|
191
186
|
* Disallow negated conditions.
|
|
192
187
|
*
|
|
193
188
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negated-condition.md
|
|
194
189
|
*/
|
|
195
|
-
"unicorn/no-negated-condition": error,
|
|
190
|
+
"unicorn/no-negated-condition": "error",
|
|
196
191
|
/**
|
|
197
192
|
* Disallow nested ternary expressions.
|
|
198
193
|
*
|
|
199
194
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-nested-ternary.md
|
|
200
195
|
*/
|
|
201
|
-
"unicorn/no-nested-ternary": error,
|
|
196
|
+
"unicorn/no-nested-ternary": "error",
|
|
202
197
|
/**
|
|
203
198
|
* Disallow `new Array()`.
|
|
204
199
|
*
|
|
205
200
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md
|
|
206
201
|
*/
|
|
207
|
-
"unicorn/no-new-array": error,
|
|
202
|
+
"unicorn/no-new-array": "error",
|
|
208
203
|
/**
|
|
209
204
|
* Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.
|
|
210
205
|
*
|
|
211
206
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-buffer.md
|
|
212
207
|
*/
|
|
213
|
-
"unicorn/no-new-buffer": error,
|
|
208
|
+
"unicorn/no-new-buffer": "error",
|
|
214
209
|
/**
|
|
215
210
|
* Disallow the use of the `null` literal.
|
|
216
211
|
*
|
|
@@ -218,289 +213,289 @@ module.exports = {
|
|
|
218
213
|
*
|
|
219
214
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-null.md
|
|
220
215
|
*/
|
|
221
|
-
"unicorn/no-null": off,
|
|
216
|
+
"unicorn/no-null": "off",
|
|
222
217
|
/**
|
|
223
218
|
* Disallow the use of objects as default parameters.
|
|
224
219
|
*
|
|
225
220
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-object-as-default-parameter.md
|
|
226
221
|
*/
|
|
227
|
-
"unicorn/no-object-as-default-parameter": error,
|
|
222
|
+
"unicorn/no-object-as-default-parameter": "error",
|
|
228
223
|
/**
|
|
229
224
|
* Disallow `process.exit()`.
|
|
230
225
|
*
|
|
231
226
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-process-exit.md
|
|
232
227
|
*/
|
|
233
|
-
"unicorn/no-process-exit": error,
|
|
228
|
+
"unicorn/no-process-exit": "error",
|
|
234
229
|
/**
|
|
235
230
|
* Disallow classes that only have static members.
|
|
236
231
|
*
|
|
237
232
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-static-only-class.md
|
|
238
233
|
*/
|
|
239
|
-
"unicorn/no-static-only-class": error,
|
|
234
|
+
"unicorn/no-static-only-class": "error",
|
|
240
235
|
/**
|
|
241
236
|
* Disallow `then` property.
|
|
242
237
|
*
|
|
243
238
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-thenable.md
|
|
244
239
|
*/
|
|
245
|
-
"unicorn/no-thenable": error,
|
|
240
|
+
"unicorn/no-thenable": "error",
|
|
246
241
|
/**
|
|
247
242
|
* Disallow assigning `this` to a variable.
|
|
248
243
|
*
|
|
249
244
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-this-assignment.md
|
|
250
245
|
*/
|
|
251
|
-
"unicorn/no-this-assignment": error,
|
|
246
|
+
"unicorn/no-this-assignment": "error",
|
|
252
247
|
/**
|
|
253
248
|
* Disallow comparing `undefined` using `typeof`.
|
|
254
249
|
*
|
|
255
250
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-typeof-undefined.md
|
|
256
251
|
*/
|
|
257
|
-
"unicorn/no-typeof-undefined": error,
|
|
252
|
+
"unicorn/no-typeof-undefined": "error",
|
|
258
253
|
/**
|
|
259
254
|
* Disallow awaiting non-promise values.
|
|
260
255
|
*
|
|
261
256
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-await.md
|
|
262
257
|
*/
|
|
263
|
-
"unicorn/no-unnecessary-await": error,
|
|
258
|
+
"unicorn/no-unnecessary-await": "error",
|
|
264
259
|
/**
|
|
265
260
|
* Disallow unreadable array destructuring.
|
|
266
261
|
*
|
|
267
262
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-array-destructuring.md
|
|
268
263
|
*/
|
|
269
|
-
"unicorn/no-unreadable-array-destructuring": error,
|
|
264
|
+
"unicorn/no-unreadable-array-destructuring": "error",
|
|
270
265
|
/**
|
|
271
266
|
* Disallow unreadable IIFEs.
|
|
272
267
|
*
|
|
273
268
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-iife.md
|
|
274
269
|
*/
|
|
275
|
-
"unicorn/no-unreadable-iife": error,
|
|
270
|
+
"unicorn/no-unreadable-iife": "error",
|
|
276
271
|
/**
|
|
277
272
|
* Disallow unused object properties.
|
|
278
273
|
*
|
|
279
274
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unused-properties.md
|
|
280
275
|
*/
|
|
281
|
-
"unicorn/no-unused-properties": error,
|
|
276
|
+
"unicorn/no-unused-properties": "error",
|
|
282
277
|
/**
|
|
283
278
|
* Disallow useless fallback when spreading in object literals.
|
|
284
279
|
*
|
|
285
280
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-fallback-in-spread.md
|
|
286
281
|
*/
|
|
287
|
-
"unicorn/no-useless-fallback-in-spread": error,
|
|
282
|
+
"unicorn/no-useless-fallback-in-spread": "error",
|
|
288
283
|
/**
|
|
289
284
|
* Disallow useless array length check.
|
|
290
285
|
*
|
|
291
286
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-length-check.md
|
|
292
287
|
*/
|
|
293
|
-
"unicorn/no-useless-length-check": error,
|
|
288
|
+
"unicorn/no-useless-length-check": "error",
|
|
294
289
|
/**
|
|
295
290
|
* Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks
|
|
296
291
|
*
|
|
297
292
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-promise-resolve-reject.md
|
|
298
293
|
*/
|
|
299
|
-
"unicorn/no-useless-promise-resolve-reject": error,
|
|
294
|
+
"unicorn/no-useless-promise-resolve-reject": "error",
|
|
300
295
|
/**
|
|
301
296
|
* Disallow unnecessary spread.
|
|
302
297
|
*
|
|
303
298
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-spread.md
|
|
304
299
|
*/
|
|
305
|
-
"unicorn/no-useless-spread": error,
|
|
300
|
+
"unicorn/no-useless-spread": "error",
|
|
306
301
|
/**
|
|
307
302
|
* Disallow useless case in switch statements.
|
|
308
303
|
*
|
|
309
304
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-switch-case.md
|
|
310
305
|
*/
|
|
311
|
-
"unicorn/no-useless-switch-case": error,
|
|
306
|
+
"unicorn/no-useless-switch-case": "error",
|
|
312
307
|
/**
|
|
313
308
|
* Disallow useless `undefined`.
|
|
314
309
|
*
|
|
315
310
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-undefined.md
|
|
316
311
|
*/
|
|
317
|
-
"unicorn/no-useless-undefined": error,
|
|
312
|
+
"unicorn/no-useless-undefined": "error",
|
|
318
313
|
/**
|
|
319
314
|
* Disallow number literals with zero fractions or dangling dots.
|
|
320
315
|
*
|
|
321
316
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-zero-fractions.md
|
|
322
317
|
*/
|
|
323
|
-
"unicorn/no-zero-fractions": error,
|
|
318
|
+
"unicorn/no-zero-fractions": "error",
|
|
324
319
|
/**
|
|
325
320
|
* Enforce proper case for numeric literals.
|
|
326
321
|
*
|
|
327
322
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/number-literal-case.md
|
|
328
323
|
*/
|
|
329
|
-
"unicorn/number-literal-case": error,
|
|
324
|
+
"unicorn/number-literal-case": "error",
|
|
330
325
|
/**
|
|
331
326
|
* Enforce the style of numeric separators by correctly grouping digits.
|
|
332
327
|
*
|
|
333
328
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
|
|
334
329
|
*/
|
|
335
|
-
"unicorn/numeric-separators-style": error,
|
|
330
|
+
"unicorn/numeric-separators-style": "error",
|
|
336
331
|
/**
|
|
337
332
|
* Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.
|
|
338
333
|
*
|
|
339
334
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-add-event-listener.md
|
|
340
335
|
*/
|
|
341
|
-
"unicorn/prefer-add-event-listener": error,
|
|
336
|
+
"unicorn/prefer-add-event-listener": "error",
|
|
342
337
|
/**
|
|
343
338
|
* Prefer `.find(…)` and `.findLast(…)` over the first or last element from `.filter(…)`.
|
|
344
339
|
*
|
|
345
340
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-find.md
|
|
346
341
|
*/
|
|
347
|
-
"unicorn/prefer-array-find": error,
|
|
342
|
+
"unicorn/prefer-array-find": "error",
|
|
348
343
|
/**
|
|
349
344
|
* Prefer `Array#flat()` over legacy techniques to flatten arrays.
|
|
350
345
|
*
|
|
351
346
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat.md
|
|
352
347
|
*/
|
|
353
|
-
"unicorn/prefer-array-flat": error,
|
|
348
|
+
"unicorn/prefer-array-flat": "error",
|
|
354
349
|
/**
|
|
355
350
|
* Prefer `.flatMap(…)` over `.map(…).flat()`.
|
|
356
351
|
*
|
|
357
352
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat-map.md
|
|
358
353
|
*/
|
|
359
|
-
"unicorn/prefer-array-flat-map": error,
|
|
354
|
+
"unicorn/prefer-array-flat-map": "error",
|
|
360
355
|
/**
|
|
361
356
|
* Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.
|
|
362
357
|
*
|
|
363
358
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-index-of.md
|
|
364
359
|
*/
|
|
365
|
-
"unicorn/prefer-array-index-of": error,
|
|
360
|
+
"unicorn/prefer-array-index-of": "error",
|
|
366
361
|
/**
|
|
367
362
|
* Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast}(…)`.
|
|
368
363
|
*
|
|
369
364
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-some.md
|
|
370
365
|
*/
|
|
371
|
-
"unicorn/prefer-array-some": error,
|
|
366
|
+
"unicorn/prefer-array-some": "error",
|
|
372
367
|
/**
|
|
373
368
|
* Prefer `.at()` method for index access and `String#charAt()`.
|
|
374
369
|
*
|
|
375
370
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-at.md
|
|
376
371
|
*/
|
|
377
|
-
"unicorn/prefer-at": error,
|
|
372
|
+
"unicorn/prefer-at": "error",
|
|
378
373
|
/**
|
|
379
374
|
* Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.
|
|
380
375
|
*
|
|
381
376
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-blob-reading-methods.md
|
|
382
377
|
*/
|
|
383
|
-
"unicorn/prefer-blob-reading-methods": error,
|
|
378
|
+
"unicorn/prefer-blob-reading-methods": "error",
|
|
384
379
|
/**
|
|
385
380
|
* Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.
|
|
386
381
|
*
|
|
387
382
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-code-point.md
|
|
388
383
|
*/
|
|
389
|
-
"unicorn/prefer-code-point": error,
|
|
384
|
+
"unicorn/prefer-code-point": "error",
|
|
390
385
|
/**
|
|
391
386
|
* Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.
|
|
392
387
|
*
|
|
393
388
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-date-now.md
|
|
394
389
|
*/
|
|
395
|
-
"unicorn/prefer-date-now": error,
|
|
390
|
+
"unicorn/prefer-date-now": "error",
|
|
396
391
|
/**
|
|
397
392
|
* Prefer default parameters over reassignment.
|
|
398
393
|
*
|
|
399
394
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-default-parameters.md
|
|
400
395
|
*/
|
|
401
|
-
"unicorn/prefer-default-parameters": error,
|
|
396
|
+
"unicorn/prefer-default-parameters": "error",
|
|
402
397
|
/**
|
|
403
398
|
* Prefer `Node#append()` over `Node#appendChild()`.
|
|
404
399
|
*
|
|
405
400
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-append.md
|
|
406
401
|
*/
|
|
407
|
-
"unicorn/prefer-dom-node-append": error,
|
|
402
|
+
"unicorn/prefer-dom-node-append": "error",
|
|
408
403
|
/**
|
|
409
404
|
* Prefer using `.dataset` on DOM elements over calling attribute methods.
|
|
410
405
|
*
|
|
411
406
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-dataset.md
|
|
412
407
|
*/
|
|
413
|
-
"unicorn/prefer-dom-node-dataset": error,
|
|
408
|
+
"unicorn/prefer-dom-node-dataset": "error",
|
|
414
409
|
/**
|
|
415
410
|
* Prefer `childNode.remove()` over `parentNode.removeChild(childNode)`.
|
|
416
411
|
*
|
|
417
412
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-remove.md
|
|
418
413
|
*/
|
|
419
|
-
"unicorn/prefer-dom-node-remove": error,
|
|
414
|
+
"unicorn/prefer-dom-node-remove": "error",
|
|
420
415
|
/**
|
|
421
416
|
* Prefer `.textContent` over `.innerText`.
|
|
422
417
|
*
|
|
423
418
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-text-content.md
|
|
424
419
|
*/
|
|
425
|
-
"unicorn/prefer-dom-node-text-content": error,
|
|
420
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
426
421
|
/**
|
|
427
422
|
* Prefer `EventTarget` over `EventEmitter`.
|
|
428
423
|
*
|
|
429
424
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-event-target.md
|
|
430
425
|
*/
|
|
431
|
-
"unicorn/prefer-event-target": error,
|
|
426
|
+
"unicorn/prefer-event-target": "error",
|
|
432
427
|
/**
|
|
433
428
|
* Prefer `export…from` when re-exporting.
|
|
434
429
|
*
|
|
435
430
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-export-from.md
|
|
436
431
|
*/
|
|
437
|
-
"unicorn/prefer-export-from": error,
|
|
432
|
+
"unicorn/prefer-export-from": "error",
|
|
438
433
|
/**
|
|
439
434
|
* Prefer `.includes()` over `.indexOf()` and `Array#some()` when checking for existence or non-existence.
|
|
440
435
|
*
|
|
441
436
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md
|
|
442
437
|
*/
|
|
443
|
-
"unicorn/prefer-includes": error,
|
|
438
|
+
"unicorn/prefer-includes": "error",
|
|
444
439
|
/**
|
|
445
440
|
* Prefer reading a JSON file as a buffer.
|
|
446
441
|
*
|
|
447
442
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-json-parse-buffer.md
|
|
448
443
|
*/
|
|
449
|
-
"unicorn/prefer-json-parse-buffer": error,
|
|
444
|
+
"unicorn/prefer-json-parse-buffer": "error",
|
|
450
445
|
/**
|
|
451
446
|
* Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`.
|
|
452
447
|
*
|
|
453
448
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-keyboard-event-key.md
|
|
454
449
|
*/
|
|
455
|
-
"unicorn/prefer-keyboard-event-key": error,
|
|
450
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
456
451
|
/**
|
|
457
452
|
* Prefer using a logical operator over a ternary.
|
|
458
453
|
*
|
|
459
454
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-logical-operator-over-ternary.md
|
|
460
455
|
*/
|
|
461
|
-
"unicorn/prefer-logical-operator-over-ternary": error,
|
|
456
|
+
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
462
457
|
/**
|
|
463
458
|
* Enforce the use of `Math.trunc` instead of bitwise operators.
|
|
464
459
|
*
|
|
465
460
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-math-trunc.md
|
|
466
461
|
*/
|
|
467
|
-
"unicorn/prefer-math-trunc": error,
|
|
462
|
+
"unicorn/prefer-math-trunc": "error",
|
|
468
463
|
/**
|
|
469
464
|
* Prefer `.before()` over `.insertBefore()`, `.replaceWith()` over `.replaceChild()`, prefer one of `.before()`, `.after()`, `.append()` or `.prepend()` over `insertAdjacentText()` and `insertAdjacentElement()`.
|
|
470
465
|
*
|
|
471
466
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-dom-apis.md
|
|
472
467
|
*/
|
|
473
|
-
"unicorn/prefer-modern-dom-apis": error,
|
|
468
|
+
"unicorn/prefer-modern-dom-apis": "error",
|
|
474
469
|
/**
|
|
475
470
|
* Prefer modern `Math` APIs over legacy patterns.
|
|
476
471
|
*
|
|
477
472
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-math-apis.md
|
|
478
473
|
*/
|
|
479
|
-
"unicorn/prefer-modern-math-apis": error,
|
|
474
|
+
"unicorn/prefer-modern-math-apis": "error",
|
|
480
475
|
/**
|
|
481
476
|
* Prefer JavaScript modules (ESM) over CommonJS.
|
|
482
477
|
*
|
|
483
478
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-module.md
|
|
484
479
|
*/
|
|
485
|
-
"unicorn/prefer-module": error,
|
|
480
|
+
"unicorn/prefer-module": "error",
|
|
486
481
|
/**
|
|
487
482
|
* Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.
|
|
488
483
|
*
|
|
489
484
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-native-coercion-functions.md
|
|
490
485
|
*/
|
|
491
|
-
"unicorn/prefer-native-coercion-functions": error,
|
|
486
|
+
"unicorn/prefer-native-coercion-functions": "error",
|
|
492
487
|
/**
|
|
493
488
|
* Prefer negative index over `.length - index` when possible.
|
|
494
489
|
*
|
|
495
490
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-negative-index.md
|
|
496
491
|
*/
|
|
497
|
-
"unicorn/prefer-negative-index": error,
|
|
492
|
+
"unicorn/prefer-negative-index": "error",
|
|
498
493
|
/**
|
|
499
494
|
* Prefer using the `node:` protocol when importing Node.js builtin modules.
|
|
500
495
|
*
|
|
501
496
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
502
497
|
*/
|
|
503
|
-
"unicorn/prefer-node-protocol": error,
|
|
498
|
+
"unicorn/prefer-node-protocol": "error",
|
|
504
499
|
/**
|
|
505
500
|
* Prefer `Number` static properties over global ones.
|
|
506
501
|
*
|
|
@@ -508,116 +503,116 @@ module.exports = {
|
|
|
508
503
|
*
|
|
509
504
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
510
505
|
*/
|
|
511
|
-
"unicorn/prefer-number-properties": error,
|
|
506
|
+
"unicorn/prefer-number-properties": "error",
|
|
512
507
|
/**
|
|
513
508
|
* Prefer using `Object.fromEntries(…)` to transform a list of key-value pairs into an object.
|
|
514
509
|
*
|
|
515
510
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-from-entries.md
|
|
516
511
|
*/
|
|
517
|
-
"unicorn/prefer-object-from-entries": error,
|
|
512
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
518
513
|
/**
|
|
519
514
|
* Prefer omitting the `catch` binding parameter.
|
|
520
515
|
*
|
|
521
516
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-optional-catch-binding.md
|
|
522
517
|
*/
|
|
523
|
-
"unicorn/prefer-optional-catch-binding": error,
|
|
518
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
524
519
|
/**
|
|
525
520
|
* Prefer borrowing methods from the prototype instead of the instance.
|
|
526
521
|
*
|
|
527
522
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-prototype-methods.md
|
|
528
523
|
*/
|
|
529
|
-
"unicorn/prefer-prototype-methods": error,
|
|
524
|
+
"unicorn/prefer-prototype-methods": "error",
|
|
530
525
|
/**
|
|
531
526
|
* Prefer `.querySelector()` over `.getElementById()`, `.querySelectorAll()` over `.getElementsByClassName()` and `.getElementsByTagName()`.
|
|
532
527
|
*
|
|
533
528
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-query-selector.md
|
|
534
529
|
*/
|
|
535
|
-
"unicorn/prefer-query-selector": error,
|
|
530
|
+
"unicorn/prefer-query-selector": "error",
|
|
536
531
|
/**
|
|
537
532
|
* Prefer `Reflect.apply()` over `Function#apply()`.
|
|
538
533
|
*
|
|
539
534
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-reflect-apply.md
|
|
540
535
|
*/
|
|
541
|
-
"unicorn/prefer-reflect-apply": error,
|
|
536
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
542
537
|
/**
|
|
543
538
|
* Prefer `RegExp#test()` over `String#match()` and `RegExp#exec()`.
|
|
544
539
|
*
|
|
545
540
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-regexp-test.md
|
|
546
541
|
*/
|
|
547
|
-
"unicorn/prefer-regexp-test": error,
|
|
542
|
+
"unicorn/prefer-regexp-test": "error",
|
|
548
543
|
/**
|
|
549
544
|
* Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.
|
|
550
545
|
*
|
|
551
546
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-has.md
|
|
552
547
|
*/
|
|
553
|
-
"unicorn/prefer-set-has": error,
|
|
548
|
+
"unicorn/prefer-set-has": "error",
|
|
554
549
|
/**
|
|
555
550
|
* Prefer using `Set#size` instead of `Array#length`.
|
|
556
551
|
*
|
|
557
552
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-size.md
|
|
558
553
|
*/
|
|
559
|
-
"unicorn/prefer-set-size": error,
|
|
554
|
+
"unicorn/prefer-set-size": "error",
|
|
560
555
|
/**
|
|
561
556
|
* Prefer the spread operator over `Array.from(…)`, `Array#concat(…)`, `Array#{slice,toSpliced}()` and `String#split('')`.
|
|
562
557
|
*
|
|
563
558
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-spread.md
|
|
564
559
|
*/
|
|
565
|
-
"unicorn/prefer-spread": error,
|
|
560
|
+
"unicorn/prefer-spread": "error",
|
|
566
561
|
/**
|
|
567
562
|
* Prefer `String#replaceAll()` over regex searches with the global flag.
|
|
568
563
|
*
|
|
569
564
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-replace-all.md
|
|
570
565
|
*/
|
|
571
|
-
"unicorn/prefer-string-replace-all": error,
|
|
566
|
+
"unicorn/prefer-string-replace-all": "error",
|
|
572
567
|
/**
|
|
573
568
|
* Prefer `String#slice()` over `String#substr()` and `String#substring()`.
|
|
574
569
|
*
|
|
575
570
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-slice.md
|
|
576
571
|
*/
|
|
577
|
-
"unicorn/prefer-string-slice": error,
|
|
572
|
+
"unicorn/prefer-string-slice": "error",
|
|
578
573
|
/**
|
|
579
574
|
* Prefer `String#startsWith()` & `String#endsWith()` over `RegExp#test()`.
|
|
580
575
|
*
|
|
581
576
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md
|
|
582
577
|
*/
|
|
583
|
-
"unicorn/prefer-string-starts-ends-with": error,
|
|
578
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
584
579
|
/**
|
|
585
580
|
* Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.
|
|
586
581
|
*
|
|
587
582
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-trim-start-end.md
|
|
588
583
|
*/
|
|
589
|
-
"unicorn/prefer-string-trim-start-end": error,
|
|
584
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
590
585
|
/**
|
|
591
586
|
* Prefer `switch` over multiple `else-if`.
|
|
592
587
|
*
|
|
593
588
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-switch.md
|
|
594
589
|
*/
|
|
595
|
-
"unicorn/prefer-switch": error,
|
|
590
|
+
"unicorn/prefer-switch": "error",
|
|
596
591
|
/**
|
|
597
592
|
* Prefer ternary expressions over simple `if-else` statements.
|
|
598
593
|
*
|
|
599
594
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-ternary.md
|
|
600
595
|
*/
|
|
601
|
-
"unicorn/prefer-ternary": error,
|
|
596
|
+
"unicorn/prefer-ternary": "error",
|
|
602
597
|
/**
|
|
603
598
|
* Prefer top-level await over top-level promises and async function calls.
|
|
604
599
|
*
|
|
605
600
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-top-level-await.md
|
|
606
601
|
*/
|
|
607
|
-
"unicorn/prefer-top-level-await": error,
|
|
602
|
+
"unicorn/prefer-top-level-await": "error",
|
|
608
603
|
/**
|
|
609
604
|
* Enforce throwing `TypeError` in type checking conditions.
|
|
610
605
|
*
|
|
611
606
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-type-error.md
|
|
612
607
|
*/
|
|
613
|
-
"unicorn/prefer-type-error": error,
|
|
608
|
+
"unicorn/prefer-type-error": "error",
|
|
614
609
|
/**
|
|
615
610
|
* Prevent abbreviations.
|
|
616
611
|
*
|
|
617
612
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md
|
|
618
613
|
*/
|
|
619
614
|
"unicorn/prevent-abbreviations": [
|
|
620
|
-
error,
|
|
615
|
+
"error",
|
|
621
616
|
{
|
|
622
617
|
ignore: [
|
|
623
618
|
// e.g., `next-env.d.ts` filename
|
|
@@ -648,19 +643,19 @@ module.exports = {
|
|
|
648
643
|
*
|
|
649
644
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/relative-url-style.md
|
|
650
645
|
*/
|
|
651
|
-
"unicorn/relative-url-style": error,
|
|
646
|
+
"unicorn/relative-url-style": "error",
|
|
652
647
|
/**
|
|
653
648
|
* Enforce using the separator argument with `Array#join()`.
|
|
654
649
|
*
|
|
655
650
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-join-separator.md
|
|
656
651
|
*/
|
|
657
|
-
"unicorn/require-array-join-separator": error,
|
|
652
|
+
"unicorn/require-array-join-separator": "error",
|
|
658
653
|
/**
|
|
659
654
|
* Enforce using the digits argument with `Number#toFixed()`.
|
|
660
655
|
*
|
|
661
656
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-number-to-fixed-digits-argument.md
|
|
662
657
|
*/
|
|
663
|
-
"unicorn/require-number-to-fixed-digits-argument": error,
|
|
658
|
+
"unicorn/require-number-to-fixed-digits-argument": "error",
|
|
664
659
|
/**
|
|
665
660
|
* Enforce using the `targetOrigin` argument with `window.postMessage()`.
|
|
666
661
|
*
|
|
@@ -669,36 +664,36 @@ module.exports = {
|
|
|
669
664
|
*
|
|
670
665
|
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-post-message-target-origin.md
|
|
671
666
|
*/
|
|
672
|
-
"unicorn/require-post-message-target-origin": off,
|
|
667
|
+
"unicorn/require-post-message-target-origin": "off",
|
|
673
668
|
/**
|
|
674
669
|
* Enforce better string content.
|
|
675
670
|
*
|
|
676
671
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/string-content.md
|
|
677
672
|
*/
|
|
678
|
-
"unicorn/string-content": error,
|
|
673
|
+
"unicorn/string-content": "error",
|
|
679
674
|
/**
|
|
680
675
|
* Enforce consistent brace style for `case` clauses.
|
|
681
676
|
*
|
|
682
677
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/switch-case-braces.md
|
|
683
678
|
*/
|
|
684
|
-
"unicorn/switch-case-braces": error,
|
|
679
|
+
"unicorn/switch-case-braces": "error",
|
|
685
680
|
/**
|
|
686
681
|
* Fix whitespace-insensitive template indentation.
|
|
687
682
|
*
|
|
688
683
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/template-indent.md
|
|
689
684
|
*/
|
|
690
|
-
"unicorn/template-indent": error,
|
|
685
|
+
"unicorn/template-indent": "error",
|
|
691
686
|
/**
|
|
692
687
|
* Enforce consistent case for text encoding identifiers.
|
|
693
688
|
*
|
|
694
689
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/text-encoding-identifier-case.md
|
|
695
690
|
*/
|
|
696
|
-
"unicorn/text-encoding-identifier-case": error,
|
|
691
|
+
"unicorn/text-encoding-identifier-case": "error",
|
|
697
692
|
/**
|
|
698
693
|
* Require `new` when throwing an error.
|
|
699
694
|
*
|
|
700
695
|
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md
|
|
701
696
|
*/
|
|
702
|
-
"unicorn/throw-new-error": error
|
|
697
|
+
"unicorn/throw-new-error": "error"
|
|
703
698
|
}
|
|
704
|
-
};
|
|
699
|
+
});
|