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