@haltcase/style 1.0.0

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