@haltcase/style 6.2.1 → 7.0.0-canary.10

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