@newsteam/eslint-config 1.2.15 → 1.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -52
- package/dist/plugins/sort-react-dependency-arrays.d.ts +3 -2
- package/dist/plugins/sort-react-dependency-arrays.d.ts.map +1 -1
- package/dist/plugins/sort-react-dependency-arrays.js +95 -18
- package/dist/rules/array-function.d.ts +3 -0
- package/dist/rules/array-function.d.ts.map +1 -0
- package/dist/rules/array-function.js +56 -0
- package/dist/rules/css-modules.d.ts +3 -0
- package/dist/rules/css-modules.d.ts.map +1 -0
- package/dist/rules/css-modules.js +27 -0
- package/dist/rules/destructuring.d.ts +3 -0
- package/dist/rules/destructuring.d.ts.map +1 -0
- package/dist/rules/destructuring.js +39 -0
- package/dist/rules/eslint-comments.d.ts +3 -0
- package/dist/rules/eslint-comments.d.ts.map +1 -0
- package/dist/rules/eslint-comments.js +77 -0
- package/dist/rules/import-newlines.d.ts +3 -0
- package/dist/rules/import-newlines.d.ts.map +1 -0
- package/dist/rules/import-newlines.js +26 -0
- package/dist/rules/import-x.d.ts +3 -0
- package/dist/rules/import-x.d.ts.map +1 -0
- package/dist/rules/import-x.js +420 -0
- package/dist/{rules.d.ts → rules/index.d.ts} +1 -1
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/{rules.js → rules/index.js} +51 -1
- package/dist/rules/next.d.ts +3 -0
- package/dist/rules/next.d.ts.map +1 -0
- package/dist/rules/next.js +140 -0
- package/dist/rules/no-unsanitized.d.ts +3 -0
- package/dist/rules/no-unsanitized.d.ts.map +1 -0
- package/dist/rules/no-unsanitized.js +38 -0
- package/dist/rules/no-useless-assign.d.ts +3 -0
- package/dist/rules/no-useless-assign.d.ts.map +1 -0
- package/dist/rules/no-useless-assign.js +20 -0
- package/dist/rules/node.d.ts +3 -0
- package/dist/rules/node.d.ts.map +1 -0
- package/dist/rules/node.js +305 -0
- package/dist/rules/perfectionist.d.ts +3 -0
- package/dist/rules/perfectionist.d.ts.map +1 -0
- package/dist/rules/perfectionist.js +94 -0
- package/dist/rules/promise.d.ts +3 -0
- package/dist/rules/promise.d.ts.map +1 -0
- package/dist/rules/promise.js +123 -0
- package/dist/rules/react-19-upgrade.d.ts +3 -0
- package/dist/rules/react-19-upgrade.d.ts.map +1 -0
- package/dist/rules/react-19-upgrade.js +20 -0
- package/dist/rules/react-compiler.d.ts +3 -0
- package/dist/rules/react-compiler.d.ts.map +1 -0
- package/dist/{plugins → rules}/react-compiler.js +7 -9
- package/dist/rules/react-hooks.d.ts +3 -0
- package/dist/rules/react-hooks.d.ts.map +1 -0
- package/dist/rules/react-hooks.js +163 -0
- package/dist/rules/react-perf.d.ts +3 -0
- package/dist/rules/react-perf.d.ts.map +1 -0
- package/dist/rules/react-perf.js +47 -0
- package/dist/rules/react-refresh.d.ts +3 -0
- package/dist/rules/react-refresh.d.ts.map +1 -0
- package/dist/rules/react-refresh.js +19 -0
- package/dist/rules/react.d.ts +3 -0
- package/dist/rules/react.d.ts.map +1 -0
- package/dist/rules/react.js +740 -0
- package/dist/rules/security.d.ts +3 -0
- package/dist/rules/security.d.ts.map +1 -0
- package/dist/rules/security.js +112 -0
- package/dist/rules/sort-react-dependency-arrays.d.ts +3 -0
- package/dist/rules/sort-react-dependency-arrays.d.ts.map +1 -0
- package/dist/rules/sort-react-dependency-arrays.js +12 -0
- package/dist/rules/stylistic.d.ts +3 -0
- package/dist/rules/stylistic.d.ts.map +1 -0
- package/dist/rules/stylistic.js +916 -0
- package/dist/rules/typescript.d.ts +3 -0
- package/dist/rules/typescript.d.ts.map +1 -0
- package/dist/{plugins → rules}/typescript.js +2 -1
- package/dist/rules/unicorn.d.ts +3 -0
- package/dist/rules/unicorn.d.ts.map +1 -0
- package/dist/rules/unicorn.js +998 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +15 -0
- package/package.json +11 -13
- package/dist/plugins/array-function.d.ts +0 -3
- package/dist/plugins/array-function.d.ts.map +0 -1
- package/dist/plugins/array-function.js +0 -58
- package/dist/plugins/css-modules.d.ts +0 -3
- package/dist/plugins/css-modules.d.ts.map +0 -1
- package/dist/plugins/css-modules.js +0 -19
- package/dist/plugins/destructuring.d.ts +0 -3
- package/dist/plugins/destructuring.d.ts.map +0 -1
- package/dist/plugins/destructuring.js +0 -41
- package/dist/plugins/eslint-comments.d.ts +0 -3
- package/dist/plugins/eslint-comments.d.ts.map +0 -1
- package/dist/plugins/eslint-comments.js +0 -79
- package/dist/plugins/import-newlines.d.ts +0 -3
- package/dist/plugins/import-newlines.d.ts.map +0 -1
- package/dist/plugins/import-newlines.js +0 -28
- package/dist/plugins/import-x.d.ts +0 -3
- package/dist/plugins/import-x.d.ts.map +0 -1
- package/dist/plugins/import-x.js +0 -418
- package/dist/plugins/newline-destructuring.d.ts +0 -3
- package/dist/plugins/newline-destructuring.d.ts.map +0 -1
- package/dist/plugins/newline-destructuring.js +0 -26
- package/dist/plugins/next.d.ts +0 -3
- package/dist/plugins/next.d.ts.map +0 -1
- package/dist/plugins/next.js +0 -142
- package/dist/plugins/no-unsanitized.d.ts +0 -3
- package/dist/plugins/no-unsanitized.d.ts.map +0 -1
- package/dist/plugins/no-unsanitized.js +0 -40
- package/dist/plugins/no-useless-assign.d.ts +0 -3
- package/dist/plugins/no-useless-assign.d.ts.map +0 -1
- package/dist/plugins/no-useless-assign.js +0 -22
- package/dist/plugins/node.d.ts +0 -3
- package/dist/plugins/node.d.ts.map +0 -1
- package/dist/plugins/node.js +0 -307
- package/dist/plugins/perfectionist.d.ts +0 -3
- package/dist/plugins/perfectionist.d.ts.map +0 -1
- package/dist/plugins/perfectionist.js +0 -96
- package/dist/plugins/promise.d.ts +0 -3
- package/dist/plugins/promise.d.ts.map +0 -1
- package/dist/plugins/promise.js +0 -125
- package/dist/plugins/react-19-upgrade.d.ts +0 -3
- package/dist/plugins/react-19-upgrade.d.ts.map +0 -1
- package/dist/plugins/react-19-upgrade.js +0 -22
- package/dist/plugins/react-compiler.d.ts +0 -3
- package/dist/plugins/react-compiler.d.ts.map +0 -1
- package/dist/plugins/react-hooks.d.ts +0 -3
- package/dist/plugins/react-hooks.d.ts.map +0 -1
- package/dist/plugins/react-hooks.js +0 -165
- package/dist/plugins/react-perf.d.ts +0 -3
- package/dist/plugins/react-perf.d.ts.map +0 -1
- package/dist/plugins/react-perf.js +0 -49
- package/dist/plugins/react-refresh.d.ts +0 -3
- package/dist/plugins/react-refresh.d.ts.map +0 -1
- package/dist/plugins/react-refresh.js +0 -21
- package/dist/plugins/react.d.ts +0 -3
- package/dist/plugins/react.d.ts.map +0 -1
- package/dist/plugins/react.js +0 -738
- package/dist/plugins/security.d.ts +0 -3
- package/dist/plugins/security.d.ts.map +0 -1
- package/dist/plugins/security.js +0 -114
- package/dist/plugins/stylistic.d.ts +0 -3
- package/dist/plugins/stylistic.d.ts.map +0 -1
- package/dist/plugins/stylistic.js +0 -901
- package/dist/plugins/typescript.d.ts +0 -3
- package/dist/plugins/typescript.d.ts.map +0 -1
- package/dist/plugins/unicorn.d.ts +0 -3
- package/dist/plugins/unicorn.d.ts.map +0 -1
- package/dist/plugins/unicorn.js +0 -994
- package/dist/rules.d.ts.map +0 -1
|
@@ -0,0 +1,998 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
eslint
|
|
4
|
+
|
|
5
|
+
max-lines: "off",
|
|
6
|
+
|
|
7
|
+
--
|
|
8
|
+
|
|
9
|
+
not really an issue in a file like this, it's just a big list
|
|
10
|
+
|
|
11
|
+
*/
|
|
12
|
+
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
13
|
+
/*
|
|
14
|
+
* Various awesome ESLint rules
|
|
15
|
+
*
|
|
16
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
17
|
+
*/
|
|
18
|
+
export const unicornPluginConfig = {
|
|
19
|
+
plugins: {
|
|
20
|
+
unicorn: eslintPluginUnicorn,
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
/*
|
|
24
|
+
* Enforce the use of regex shorthands to improve readability. (fixable)
|
|
25
|
+
*
|
|
26
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-regex.md
|
|
27
|
+
*/
|
|
28
|
+
"unicorn/better-regex": "warn",
|
|
29
|
+
/*
|
|
30
|
+
* Enforce a specific parameter name in catch clauses.
|
|
31
|
+
*
|
|
32
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/catch-error-name.md
|
|
33
|
+
*/
|
|
34
|
+
"unicorn/catch-error-name": [
|
|
35
|
+
"warn",
|
|
36
|
+
{
|
|
37
|
+
name: "warn",
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
/*
|
|
41
|
+
* Enforce consistent assertion style with node:assert
|
|
42
|
+
*
|
|
43
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-assert.md
|
|
44
|
+
*/
|
|
45
|
+
"unicorn/consistent-assert": "warn",
|
|
46
|
+
/*
|
|
47
|
+
* Prefer passing Date directly to the constructor when cloning
|
|
48
|
+
*
|
|
49
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-date-clone.md
|
|
50
|
+
*/
|
|
51
|
+
"unicorn/consistent-date-clone": "warn",
|
|
52
|
+
/*
|
|
53
|
+
* Use destructured variables over properties
|
|
54
|
+
*
|
|
55
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-destructuring.md
|
|
56
|
+
*/
|
|
57
|
+
"unicorn/consistent-destructuring": "warn",
|
|
58
|
+
/*
|
|
59
|
+
* Prefer consistent types when spreading a ternary in an array literal
|
|
60
|
+
*
|
|
61
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-empty-array-spread.md
|
|
62
|
+
*/
|
|
63
|
+
"unicorn/consistent-empty-array-spread": "warn",
|
|
64
|
+
/*
|
|
65
|
+
* Enforce consistent style for element existence checks with indexOf(), lastIndexOf(), findIndex(), and findLastIndex()
|
|
66
|
+
*
|
|
67
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-existence-index-check.md
|
|
68
|
+
*/
|
|
69
|
+
"unicorn/consistent-existence-index-check": "warn",
|
|
70
|
+
/*
|
|
71
|
+
* Move function definitions to the highest possible scope.
|
|
72
|
+
*
|
|
73
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-function-scoping.md
|
|
74
|
+
*/
|
|
75
|
+
"unicorn/consistent-function-scoping": "warn",
|
|
76
|
+
/*
|
|
77
|
+
* Enforce correct Error subclassing. (fixable)
|
|
78
|
+
*
|
|
79
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/custom-error-definition.md
|
|
80
|
+
*/
|
|
81
|
+
"unicorn/custom-error-definition": "warn",
|
|
82
|
+
/*
|
|
83
|
+
* Enforce no spaces between braces. (fixable)
|
|
84
|
+
*
|
|
85
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/empty-brace-spaces.md
|
|
86
|
+
*/
|
|
87
|
+
"unicorn/empty-brace-spaces": "warn",
|
|
88
|
+
/*
|
|
89
|
+
* Enforce passing a message value when throwing a built-in error.
|
|
90
|
+
*
|
|
91
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/error-message.md
|
|
92
|
+
*/
|
|
93
|
+
"unicorn/error-message": "warn",
|
|
94
|
+
/*
|
|
95
|
+
* Require escape sequences to use uppercase values. (fixable)
|
|
96
|
+
*
|
|
97
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/escape-case.md
|
|
98
|
+
*/
|
|
99
|
+
"unicorn/escape-case": "warn",
|
|
100
|
+
/*
|
|
101
|
+
* Add expiration conditions to TODO comments
|
|
102
|
+
*
|
|
103
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/expiring-todo-comments.md
|
|
104
|
+
*/
|
|
105
|
+
"unicorn/expiring-todo-comments": "off",
|
|
106
|
+
/*
|
|
107
|
+
* Enforce explicitly comparing the length property of a value. (partly fixable)
|
|
108
|
+
*
|
|
109
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/explicit-length-check.md
|
|
110
|
+
*/
|
|
111
|
+
"unicorn/explicit-length-check": "warn",
|
|
112
|
+
/*
|
|
113
|
+
* Enforce a case style for filenames.
|
|
114
|
+
*
|
|
115
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
|
|
116
|
+
*/
|
|
117
|
+
"unicorn/filename-case": [
|
|
118
|
+
"warn",
|
|
119
|
+
{
|
|
120
|
+
case: "kebabCase",
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
/*
|
|
124
|
+
* Enforce specific import styles per module
|
|
125
|
+
*
|
|
126
|
+
* Off for now...
|
|
127
|
+
*
|
|
128
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/import-style.md
|
|
129
|
+
*/
|
|
130
|
+
"unicorn/import-style": "off",
|
|
131
|
+
/*
|
|
132
|
+
* Prevent usage of variables from outside the scope of isolated functions
|
|
133
|
+
*
|
|
134
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/isolated-functions.md
|
|
135
|
+
*/
|
|
136
|
+
"unicorn/isolated-functions": "warn",
|
|
137
|
+
/*
|
|
138
|
+
* Enforce the use of new for all builtins, except String, Number and Boolean. (fixable)
|
|
139
|
+
*
|
|
140
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/new-for-builtins.md
|
|
141
|
+
*/
|
|
142
|
+
"unicorn/new-for-builtins": "warn",
|
|
143
|
+
/*
|
|
144
|
+
* Enforce specifying rules to disable in eslint-disable comments.
|
|
145
|
+
*
|
|
146
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-abusive-eslint-disable.md
|
|
147
|
+
*/
|
|
148
|
+
"unicorn/no-abusive-eslint-disable": "warn",
|
|
149
|
+
/*
|
|
150
|
+
* Disallow recursive access to this within getters and setters
|
|
151
|
+
*
|
|
152
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-accessor-recursion.md
|
|
153
|
+
*/
|
|
154
|
+
"unicorn/no-accessor-recursion": "warn",
|
|
155
|
+
/*
|
|
156
|
+
* Disallow anonymous functions and classes as the default export
|
|
157
|
+
*
|
|
158
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-anonymous-default-export.md
|
|
159
|
+
*/
|
|
160
|
+
"unicorn/no-anonymous-default-export": "warn",
|
|
161
|
+
/*
|
|
162
|
+
* Prevent passing a function reference directly to iterator methods
|
|
163
|
+
*
|
|
164
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-callback-reference.md
|
|
165
|
+
*/
|
|
166
|
+
"unicorn/no-array-callback-reference": "warn",
|
|
167
|
+
/*
|
|
168
|
+
* Prefer for...of over Array#forEach(...)
|
|
169
|
+
*
|
|
170
|
+
* We're turning this off because forEach is really convienient to use
|
|
171
|
+
* with nodeLists, which can't be processed as arrays
|
|
172
|
+
*
|
|
173
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-for-each.md
|
|
174
|
+
*/
|
|
175
|
+
"unicorn/no-array-for-each": "off",
|
|
176
|
+
/*
|
|
177
|
+
* Disallow using the this argument in array methods
|
|
178
|
+
*
|
|
179
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-method-this-argument.md
|
|
180
|
+
*/
|
|
181
|
+
"unicorn/no-array-method-this-argument": "warn",
|
|
182
|
+
/*
|
|
183
|
+
* Disallow Array#reduce() and Array#reduceRight()
|
|
184
|
+
*
|
|
185
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reduce.md
|
|
186
|
+
*/
|
|
187
|
+
"unicorn/no-array-reduce": "warn",
|
|
188
|
+
/*
|
|
189
|
+
* Prefer Array#toReversed() over Array#reverse()
|
|
190
|
+
*
|
|
191
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reverse.md
|
|
192
|
+
*/
|
|
193
|
+
"unicorn/no-array-reverse": "warn",
|
|
194
|
+
/*
|
|
195
|
+
* Prefer using Array#toSorted() over Array#sort().
|
|
196
|
+
*
|
|
197
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-sort.md
|
|
198
|
+
*/
|
|
199
|
+
"unicorn/no-array-sort": "warn",
|
|
200
|
+
/*
|
|
201
|
+
* Forbid member access from await expression
|
|
202
|
+
*
|
|
203
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-expression-member.md
|
|
204
|
+
*/
|
|
205
|
+
"unicorn/no-await-expression-member": "warn",
|
|
206
|
+
/*
|
|
207
|
+
* Disallow member access from await expression
|
|
208
|
+
*
|
|
209
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-in-promise-methods.md
|
|
210
|
+
*/
|
|
211
|
+
"unicorn/no-await-in-promise-methods": "warn",
|
|
212
|
+
/*
|
|
213
|
+
* Do not use leading/trailing space between console.log parameters. (fixable)
|
|
214
|
+
*
|
|
215
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-console-spaces.md
|
|
216
|
+
*/
|
|
217
|
+
"unicorn/no-console-spaces": "warn",
|
|
218
|
+
/*
|
|
219
|
+
* Do not use document.cookie directly
|
|
220
|
+
*
|
|
221
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-document-cookie.md
|
|
222
|
+
*/
|
|
223
|
+
"unicorn/no-document-cookie": "warn",
|
|
224
|
+
/*
|
|
225
|
+
* Disallow empty files
|
|
226
|
+
*
|
|
227
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-empty-file.md
|
|
228
|
+
*/
|
|
229
|
+
"unicorn/no-empty-file": "warn",
|
|
230
|
+
/*
|
|
231
|
+
* Do not use a for loop that can be replaced with a for-of loop
|
|
232
|
+
*
|
|
233
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-for-loop.md
|
|
234
|
+
*/
|
|
235
|
+
"unicorn/no-for-loop": "warn",
|
|
236
|
+
/*
|
|
237
|
+
* Enforce the use of unicode escapes instead of hexadecimal escapes. (fixable)
|
|
238
|
+
*
|
|
239
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-hex-escape.md
|
|
240
|
+
*/
|
|
241
|
+
"unicorn/no-hex-escape": "warn",
|
|
242
|
+
/*
|
|
243
|
+
* Disallow immediate mutation after variable assignment
|
|
244
|
+
*
|
|
245
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-immediate-mutation.md
|
|
246
|
+
*/
|
|
247
|
+
"unicorn/no-immediate-mutation": "warn",
|
|
248
|
+
/*
|
|
249
|
+
* Require Array.isArray() instead of instanceof Array
|
|
250
|
+
*
|
|
251
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-array.md
|
|
252
|
+
*/
|
|
253
|
+
"unicorn/no-instanceof-builtins": [
|
|
254
|
+
"warn",
|
|
255
|
+
{
|
|
256
|
+
strategy: "loose",
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
/*
|
|
260
|
+
* Disallow invalid options in fetch() and new Request()
|
|
261
|
+
*
|
|
262
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-fetch-options.md
|
|
263
|
+
*/
|
|
264
|
+
"unicorn/no-invalid-fetch-options": "warn",
|
|
265
|
+
/*
|
|
266
|
+
* Prevent calling EventTarget#removeEventListener() with the result of an expression
|
|
267
|
+
*
|
|
268
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-remove-event-listener.md
|
|
269
|
+
*/
|
|
270
|
+
"unicorn/no-invalid-remove-event-listener": "warn",
|
|
271
|
+
/*
|
|
272
|
+
* Disallow identifiers starting with new or class
|
|
273
|
+
*
|
|
274
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-keyword-prefix.md
|
|
275
|
+
*/
|
|
276
|
+
"unicorn/no-keyword-prefix": "off",
|
|
277
|
+
/*
|
|
278
|
+
* Disallow if statements as the only statement in if blocks without else
|
|
279
|
+
*
|
|
280
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-lonely-if.md
|
|
281
|
+
*/
|
|
282
|
+
"unicorn/no-lonely-if": "warn",
|
|
283
|
+
/*
|
|
284
|
+
* Disallow a magic number as the depth argument in Array#flat(…).
|
|
285
|
+
*
|
|
286
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-magic-array-flat-depth.md
|
|
287
|
+
*/
|
|
288
|
+
"unicorn/no-magic-array-flat-depth": "warn",
|
|
289
|
+
/*
|
|
290
|
+
* Disallow named usage of default import and export
|
|
291
|
+
*
|
|
292
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-named-default.md
|
|
293
|
+
*/
|
|
294
|
+
"unicorn/no-named-default": "warn",
|
|
295
|
+
/*
|
|
296
|
+
* Disallow negated conditions
|
|
297
|
+
*
|
|
298
|
+
* This is an improved version of the no-negated-condition ESLint rule that makes it automatically fixable.
|
|
299
|
+
*
|
|
300
|
+
* Turning off no-negated-condition because this overrides it
|
|
301
|
+
*
|
|
302
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negated-condition.md
|
|
303
|
+
*/
|
|
304
|
+
"unicorn/no-negated-condition": "warn",
|
|
305
|
+
/*
|
|
306
|
+
* Disallow negated expression in equality check
|
|
307
|
+
*
|
|
308
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negation-in-equality-check.md
|
|
309
|
+
*/
|
|
310
|
+
"unicorn/no-negation-in-equality-check": "warn",
|
|
311
|
+
/*
|
|
312
|
+
* Disallow nested ternary expressions. (partly fixable)
|
|
313
|
+
*
|
|
314
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-nested-ternary.md
|
|
315
|
+
*/
|
|
316
|
+
"unicorn/no-nested-ternary": "warn",
|
|
317
|
+
/*
|
|
318
|
+
* Disallow new Array()
|
|
319
|
+
*
|
|
320
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md
|
|
321
|
+
*/
|
|
322
|
+
"unicorn/no-new-array": "warn",
|
|
323
|
+
/*
|
|
324
|
+
* Enforce the use of Buffer.from() and Buffer.alloc() instead of the deprecated new Buffer(). (fixable)
|
|
325
|
+
*
|
|
326
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-buffer.md
|
|
327
|
+
*/
|
|
328
|
+
"unicorn/no-new-buffer": "warn",
|
|
329
|
+
/*
|
|
330
|
+
* Disallow the use of the null literal, to encourage using undefined instead.
|
|
331
|
+
*
|
|
332
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-null.md
|
|
333
|
+
*/
|
|
334
|
+
"unicorn/no-null": "warn",
|
|
335
|
+
/*
|
|
336
|
+
* Disallow the use of objects as default parameters
|
|
337
|
+
*
|
|
338
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-object-as-default-parameter.md
|
|
339
|
+
*/
|
|
340
|
+
"unicorn/no-object-as-default-parameter": "warn",
|
|
341
|
+
/*
|
|
342
|
+
* Disallow process.exit().
|
|
343
|
+
*
|
|
344
|
+
* Handled by 'node/no-process-exit'
|
|
345
|
+
*
|
|
346
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-process-exit.md
|
|
347
|
+
*/
|
|
348
|
+
"unicorn/no-process-exit": "off",
|
|
349
|
+
/*
|
|
350
|
+
* Disallow passing single-element arrays to Promise methods
|
|
351
|
+
*
|
|
352
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-single-promise-in-promise-methods.md
|
|
353
|
+
*/
|
|
354
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
355
|
+
/*
|
|
356
|
+
* Forbid classes that only have static members
|
|
357
|
+
*
|
|
358
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-static-only-class.md
|
|
359
|
+
*/
|
|
360
|
+
"unicorn/no-static-only-class": "warn",
|
|
361
|
+
/*
|
|
362
|
+
* Disallow then property
|
|
363
|
+
*
|
|
364
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-thenable.md
|
|
365
|
+
*/
|
|
366
|
+
"unicorn/no-thenable": "warn",
|
|
367
|
+
/*
|
|
368
|
+
* Disallow assigning this to a variable
|
|
369
|
+
*
|
|
370
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-this-assignment.md
|
|
371
|
+
*/
|
|
372
|
+
"unicorn/no-this-assignment": "warn",
|
|
373
|
+
/*
|
|
374
|
+
* Disallow comparing undefined using typeof
|
|
375
|
+
*
|
|
376
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-typeof-undefined.md
|
|
377
|
+
*/
|
|
378
|
+
"unicorn/no-typeof-undefined": "warn",
|
|
379
|
+
/*
|
|
380
|
+
* Disallow using 1 as the depth argument of Array#flat()
|
|
381
|
+
*
|
|
382
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-flat-depth.md
|
|
383
|
+
*/
|
|
384
|
+
"unicorn/no-unnecessary-array-flat-depth": "warn",
|
|
385
|
+
/*
|
|
386
|
+
* Disallow using .length or Infinity as the deleteCount or skipCount argument of Array#{splice,toSpliced}()
|
|
387
|
+
*
|
|
388
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-splice-count.md
|
|
389
|
+
*/
|
|
390
|
+
"unicorn/no-unnecessary-array-splice-count": "warn",
|
|
391
|
+
/*
|
|
392
|
+
* Disallow awaiting non-promise values
|
|
393
|
+
*
|
|
394
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-await.md
|
|
395
|
+
*/
|
|
396
|
+
"unicorn/no-unnecessary-await": "warn",
|
|
397
|
+
/*
|
|
398
|
+
* Enforce the use of built-in methods instead of unnecessary polyfills
|
|
399
|
+
*
|
|
400
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-polyfills.md
|
|
401
|
+
*/
|
|
402
|
+
"unicorn/no-unnecessary-polyfills": "warn",
|
|
403
|
+
/*
|
|
404
|
+
* Disallow using .length or Infinity as the end argument of {Array,String,TypedArray}#slice()
|
|
405
|
+
*
|
|
406
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-slice-end.md
|
|
407
|
+
*/
|
|
408
|
+
"unicorn/no-unnecessary-slice-end": "warn",
|
|
409
|
+
/*
|
|
410
|
+
* Disallow unreadable array destructuring.
|
|
411
|
+
*
|
|
412
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-array-destructuring.md
|
|
413
|
+
*/
|
|
414
|
+
"unicorn/no-unreadable-array-destructuring": "warn",
|
|
415
|
+
/*
|
|
416
|
+
* Disallow unreadable IIFEs
|
|
417
|
+
*
|
|
418
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-iife.md
|
|
419
|
+
*/
|
|
420
|
+
"unicorn/no-unreadable-iife": "warn",
|
|
421
|
+
/*
|
|
422
|
+
* Disallow unused object properties.
|
|
423
|
+
*
|
|
424
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unused-properties.md
|
|
425
|
+
*/
|
|
426
|
+
"unicorn/no-unused-properties": "warn",
|
|
427
|
+
/*
|
|
428
|
+
* Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`.
|
|
429
|
+
*
|
|
430
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-collection-argument.md
|
|
431
|
+
*/
|
|
432
|
+
"unicorn/no-useless-collection-argument": "warn",
|
|
433
|
+
/*
|
|
434
|
+
* Disallow unnecessary Error.captureStackTrace(…)
|
|
435
|
+
*
|
|
436
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-error-capture-stack-trace.md
|
|
437
|
+
*/
|
|
438
|
+
"unicorn/no-useless-error-capture-stack-trace": "warn",
|
|
439
|
+
/*
|
|
440
|
+
* Forbid useless fallback when spreading in object literals
|
|
441
|
+
*
|
|
442
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-fallback-in-spread.md
|
|
443
|
+
*/
|
|
444
|
+
"unicorn/no-useless-fallback-in-spread": "warn",
|
|
445
|
+
/*
|
|
446
|
+
* Disallow useless array length check
|
|
447
|
+
*
|
|
448
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-length-check.md
|
|
449
|
+
*/
|
|
450
|
+
"unicorn/no-useless-length-check": "warn",
|
|
451
|
+
/*
|
|
452
|
+
* Disallow returning/yielding Promise.resolve/reject() in async functions or promise callbacks
|
|
453
|
+
*
|
|
454
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-promise-resolve-reject.md
|
|
455
|
+
*/
|
|
456
|
+
"unicorn/no-useless-promise-resolve-reject": "warn",
|
|
457
|
+
/*
|
|
458
|
+
* Disallow useless spread
|
|
459
|
+
*
|
|
460
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-spread.md
|
|
461
|
+
*/
|
|
462
|
+
"unicorn/no-useless-spread": "warn",
|
|
463
|
+
/*
|
|
464
|
+
* Disallow useless case in switch statements
|
|
465
|
+
*
|
|
466
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-switch-case.md
|
|
467
|
+
*/
|
|
468
|
+
"unicorn/no-useless-switch-case": "warn",
|
|
469
|
+
/*
|
|
470
|
+
* Disallow useless undefined
|
|
471
|
+
*
|
|
472
|
+
* This conflicts with @typescript-eslint/init-declarations
|
|
473
|
+
*
|
|
474
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-undefined.md
|
|
475
|
+
*/
|
|
476
|
+
"unicorn/no-useless-undefined": "off",
|
|
477
|
+
/*
|
|
478
|
+
* Disallow number literals with zero fractions or dangling dots
|
|
479
|
+
*
|
|
480
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-zero-fractions.md
|
|
481
|
+
*/
|
|
482
|
+
"unicorn/no-zero-fractions": "warn",
|
|
483
|
+
/*
|
|
484
|
+
* Enforce lowercase identifier and uppercase value for number literals. (fixable)
|
|
485
|
+
*
|
|
486
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/number-literal-case.md
|
|
487
|
+
*/
|
|
488
|
+
"unicorn/number-literal-case": "warn",
|
|
489
|
+
/*
|
|
490
|
+
* Enforce the style of numeric separators by correctly grouping digits
|
|
491
|
+
*
|
|
492
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
|
|
493
|
+
*/
|
|
494
|
+
"unicorn/numeric-separators-style": "warn",
|
|
495
|
+
/*
|
|
496
|
+
* Prefer addEventListener over on-functions. (fixable)
|
|
497
|
+
*
|
|
498
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-add-event-listener.md
|
|
499
|
+
*/
|
|
500
|
+
"unicorn/prefer-add-event-listener": "warn",
|
|
501
|
+
/*
|
|
502
|
+
* Prefer .find(...) over the first element from .filter(...)
|
|
503
|
+
*
|
|
504
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-find.md
|
|
505
|
+
*/
|
|
506
|
+
"unicorn/prefer-array-find": "warn",
|
|
507
|
+
/*
|
|
508
|
+
* Prefer Array#flat() over legacy techniques to flatten arrays
|
|
509
|
+
*
|
|
510
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat.md
|
|
511
|
+
*/
|
|
512
|
+
"unicorn/prefer-array-flat": "warn",
|
|
513
|
+
/*
|
|
514
|
+
* Prefer .flatMap(...) over .map(...).flat()
|
|
515
|
+
*
|
|
516
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat-map.md
|
|
517
|
+
*/
|
|
518
|
+
"unicorn/prefer-array-flat-map": "warn",
|
|
519
|
+
/*
|
|
520
|
+
* Prefer Array#indexOf() over Array#findIndex() when looking for the index of an item
|
|
521
|
+
*
|
|
522
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-index-of.md
|
|
523
|
+
*/
|
|
524
|
+
"unicorn/prefer-array-index-of": "warn",
|
|
525
|
+
/*
|
|
526
|
+
* Prefer .some(...) over .find(...).
|
|
527
|
+
*
|
|
528
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-some.md
|
|
529
|
+
*/
|
|
530
|
+
"unicorn/prefer-array-some": "warn",
|
|
531
|
+
/*
|
|
532
|
+
* Prefer .at() method for index access and String#charAt()
|
|
533
|
+
*
|
|
534
|
+
* This breaks typescript array typings at the moment
|
|
535
|
+
*
|
|
536
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-at.md
|
|
537
|
+
*/
|
|
538
|
+
"unicorn/prefer-at": "off",
|
|
539
|
+
/*
|
|
540
|
+
* Prefer BigInt literals over the constructor
|
|
541
|
+
*
|
|
542
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-bigint-literals.md
|
|
543
|
+
*/
|
|
544
|
+
"unicorn/prefer-bigint-literals": "warn",
|
|
545
|
+
/*
|
|
546
|
+
* Prefer .at() method for index access and String#charAt()
|
|
547
|
+
*
|
|
548
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-blob-reading-methods.md
|
|
549
|
+
*/
|
|
550
|
+
"unicorn/prefer-blob-reading-methods": "warn",
|
|
551
|
+
/*
|
|
552
|
+
* Prefer class field declarations over this assignments in constructors
|
|
553
|
+
*
|
|
554
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-class-fields.md
|
|
555
|
+
*/
|
|
556
|
+
"unicorn/prefer-class-fields": "warn",
|
|
557
|
+
/*
|
|
558
|
+
* Prefer using Element#classList.toggle() to toggle class names
|
|
559
|
+
*
|
|
560
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-classlist-toggle.md
|
|
561
|
+
*/
|
|
562
|
+
"unicorn/prefer-classlist-toggle": "warn",
|
|
563
|
+
/*
|
|
564
|
+
* Prefer String#codePointAt(...) over String#charCodeAt(...) and String.fromCodePoint(...) over String.fromCharCode(...)
|
|
565
|
+
*
|
|
566
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-code-point.md
|
|
567
|
+
*/
|
|
568
|
+
"unicorn/prefer-code-point": "warn",
|
|
569
|
+
/*
|
|
570
|
+
* Prefer Date.now() to get the number of milliseconds since the Unix Epoch
|
|
571
|
+
*
|
|
572
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-date-now.md
|
|
573
|
+
*/
|
|
574
|
+
"unicorn/prefer-date-now": "warn",
|
|
575
|
+
/*
|
|
576
|
+
* Prefer default parameters over reassignment
|
|
577
|
+
*
|
|
578
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-default-parameters.md
|
|
579
|
+
*/
|
|
580
|
+
"unicorn/prefer-default-parameters": "warn",
|
|
581
|
+
/*
|
|
582
|
+
* Prefer Node#append() over Node#appendChild()
|
|
583
|
+
*
|
|
584
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-append.md
|
|
585
|
+
*/
|
|
586
|
+
"unicorn/prefer-dom-node-append": "warn",
|
|
587
|
+
/*
|
|
588
|
+
* Prefer using .dataset on DOM elements over .setAttribute(...)
|
|
589
|
+
*
|
|
590
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-dataset.md
|
|
591
|
+
*/
|
|
592
|
+
"unicorn/prefer-dom-node-dataset": "warn",
|
|
593
|
+
/*
|
|
594
|
+
* Prefer childNode.remove() over parentNode.removeChild(childNode)
|
|
595
|
+
*
|
|
596
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-remove.md
|
|
597
|
+
*/
|
|
598
|
+
"unicorn/prefer-dom-node-remove": "warn",
|
|
599
|
+
/*
|
|
600
|
+
* Prefer .textContent over .innerText
|
|
601
|
+
*
|
|
602
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-text-content.md
|
|
603
|
+
*/
|
|
604
|
+
"unicorn/prefer-dom-node-text-content": "warn",
|
|
605
|
+
/*
|
|
606
|
+
* While EventEmitter is only available in Node.js, EventTarget is also available in Deno and browsers.
|
|
607
|
+
*
|
|
608
|
+
* EventTarget is stupid.
|
|
609
|
+
*
|
|
610
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-event-target.md
|
|
611
|
+
*/
|
|
612
|
+
"unicorn/prefer-event-target": "off",
|
|
613
|
+
/*
|
|
614
|
+
* Prefer export... from when re-exporting
|
|
615
|
+
*
|
|
616
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-export-from.md
|
|
617
|
+
*/
|
|
618
|
+
"unicorn/prefer-export-from": "warn",
|
|
619
|
+
/*
|
|
620
|
+
* Prefer `globalThis` over `window`, `self`, and `global`.
|
|
621
|
+
*
|
|
622
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-global-this.md
|
|
623
|
+
*/
|
|
624
|
+
"unicorn/prefer-global-this": "warn",
|
|
625
|
+
/*
|
|
626
|
+
* Prefer `import.meta.{dirname,filename}` over legacy techniques for getting file paths
|
|
627
|
+
*
|
|
628
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-import-meta-properties.md
|
|
629
|
+
*/
|
|
630
|
+
"unicorn/prefer-import-meta-properties": "warn",
|
|
631
|
+
/*
|
|
632
|
+
* Prefer .includes() over .indexOf() when checking for existence or non-existence
|
|
633
|
+
*
|
|
634
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md
|
|
635
|
+
*/
|
|
636
|
+
"unicorn/prefer-includes": "warn",
|
|
637
|
+
/*
|
|
638
|
+
* Prefer reading a JSON file as a buffer
|
|
639
|
+
*
|
|
640
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-json-parse-buffer.md
|
|
641
|
+
*/
|
|
642
|
+
"unicorn/prefer-json-parse-buffer": "warn",
|
|
643
|
+
/*
|
|
644
|
+
* Prefer KeyboardEvent#key over KeyboardEvent#keyCode
|
|
645
|
+
*
|
|
646
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-keyboard-event-key.md
|
|
647
|
+
*/
|
|
648
|
+
"unicorn/prefer-keyboard-event-key": "warn",
|
|
649
|
+
/*
|
|
650
|
+
* Prefer using a logical operator over a ternary
|
|
651
|
+
*
|
|
652
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-logical-operator-over-ternary.md
|
|
653
|
+
*/
|
|
654
|
+
"unicorn/prefer-logical-operator-over-ternary": "warn",
|
|
655
|
+
/*
|
|
656
|
+
* Prefer Math.min() and Math.max() over ternaries for simple comparisons
|
|
657
|
+
*
|
|
658
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-math-min-max.md
|
|
659
|
+
*/
|
|
660
|
+
"unicorn/prefer-math-min-max": "warn",
|
|
661
|
+
/*
|
|
662
|
+
* Enforce the use of Math.trunc instead of bitwise operators. (partly fixable)
|
|
663
|
+
*
|
|
664
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-math-trunc.md
|
|
665
|
+
*/
|
|
666
|
+
"unicorn/prefer-math-trunc": "warn",
|
|
667
|
+
/*
|
|
668
|
+
* Prefer modern DOM APIs
|
|
669
|
+
*
|
|
670
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-dom-apis.md
|
|
671
|
+
*/
|
|
672
|
+
"unicorn/prefer-modern-dom-apis": "warn",
|
|
673
|
+
/*
|
|
674
|
+
* Prefer modern Math APIs over legacy patterns
|
|
675
|
+
*
|
|
676
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-math-apis.md
|
|
677
|
+
*/
|
|
678
|
+
"unicorn/prefer-modern-math-apis": "warn",
|
|
679
|
+
/*
|
|
680
|
+
* Prefer JavaScript modules (ESM) over CommonJS
|
|
681
|
+
*
|
|
682
|
+
* This is only a problem in node 16 - so it's off for now
|
|
683
|
+
*
|
|
684
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-module.md
|
|
685
|
+
*/
|
|
686
|
+
"unicorn/prefer-module": "off",
|
|
687
|
+
/*
|
|
688
|
+
* Prefer using String, Number, BigInt, Boolean, and Symbol directly
|
|
689
|
+
*
|
|
690
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-native-coercion-functions.md
|
|
691
|
+
*/
|
|
692
|
+
"unicorn/prefer-native-coercion-functions": "warn",
|
|
693
|
+
/*
|
|
694
|
+
* Prefer negative index over .length - index for {String,Array,TypedArray}#slice() and Array#splice()
|
|
695
|
+
*
|
|
696
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-negative-index.md
|
|
697
|
+
*/
|
|
698
|
+
"unicorn/prefer-negative-index": "warn",
|
|
699
|
+
/*
|
|
700
|
+
* Prefer using the node: protocol when importing Node.js builtin modules
|
|
701
|
+
*
|
|
702
|
+
* Off for now since this isn't supported in node < 16 in require() and we compile down to require()
|
|
703
|
+
*
|
|
704
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
705
|
+
*/
|
|
706
|
+
"unicorn/prefer-node-protocol": "off",
|
|
707
|
+
/*
|
|
708
|
+
* Prefer Number static properties over global ones.
|
|
709
|
+
*
|
|
710
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md
|
|
711
|
+
*/
|
|
712
|
+
"unicorn/prefer-number-properties": "warn",
|
|
713
|
+
/*
|
|
714
|
+
* Prefer using Object.fromEntries(...) to transform a list of key-value pairs into an object
|
|
715
|
+
*
|
|
716
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-from-entries.md
|
|
717
|
+
*/
|
|
718
|
+
"unicorn/prefer-object-from-entries": "warn",
|
|
719
|
+
/*
|
|
720
|
+
* Prefer omitting the catch binding parameter
|
|
721
|
+
*
|
|
722
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-optional-catch-binding.md
|
|
723
|
+
*/
|
|
724
|
+
"unicorn/prefer-optional-catch-binding": "warn",
|
|
725
|
+
/*
|
|
726
|
+
* Prefer borrowing methods from the prototype instead of methods from an instance
|
|
727
|
+
*
|
|
728
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-prototype-methods.md
|
|
729
|
+
*/
|
|
730
|
+
"unicorn/prefer-prototype-methods": "warn",
|
|
731
|
+
/*
|
|
732
|
+
* Prefer String#replaceAll() over regex searches with the global flag
|
|
733
|
+
*
|
|
734
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-replace-all.md
|
|
735
|
+
*/
|
|
736
|
+
"unicorn/prefer-query-selector": "warn",
|
|
737
|
+
/*
|
|
738
|
+
* Prefer querySelector over getElementById, querySelectorAll over getElementsByClassName and getElementsByTagName. (partly fixable)
|
|
739
|
+
*
|
|
740
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-query-selector.md
|
|
741
|
+
*/
|
|
742
|
+
"unicorn/prefer-reflect-apply": "warn",
|
|
743
|
+
/*
|
|
744
|
+
* Prefer RegExp#test() over String#match() and RegExp#exec()
|
|
745
|
+
*
|
|
746
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-regexp-test.md
|
|
747
|
+
*/
|
|
748
|
+
"unicorn/prefer-regexp-test": "warn",
|
|
749
|
+
/*
|
|
750
|
+
* Prefer Response.json() over new Response(JSON.stringify())
|
|
751
|
+
*
|
|
752
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-response-static-json.md
|
|
753
|
+
*/
|
|
754
|
+
"unicorn/prefer-response-static-json": "warn",
|
|
755
|
+
/*
|
|
756
|
+
* Prefer Set#has() over Array#includes() when checking for existence or non-existenc (fixable)
|
|
757
|
+
*
|
|
758
|
+
* It's a bit heavy handed to use this right now.
|
|
759
|
+
*
|
|
760
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-has.md
|
|
761
|
+
*/
|
|
762
|
+
"unicorn/prefer-set-has": "off",
|
|
763
|
+
/*
|
|
764
|
+
* Prefer using Set#size instead of Array#length
|
|
765
|
+
*
|
|
766
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-size.md
|
|
767
|
+
*/
|
|
768
|
+
"unicorn/prefer-set-size": "warn",
|
|
769
|
+
/*
|
|
770
|
+
* Prefer using Set#size instead of Array#length
|
|
771
|
+
*
|
|
772
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-single-call.md
|
|
773
|
+
*/
|
|
774
|
+
"unicorn/prefer-single-call": "warn",
|
|
775
|
+
/*
|
|
776
|
+
* Prefer the spread operator over Array.from(). (fixable)
|
|
777
|
+
*
|
|
778
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-spread.md
|
|
779
|
+
*/
|
|
780
|
+
"unicorn/prefer-spread": "warn",
|
|
781
|
+
/*
|
|
782
|
+
* Prefer using the String.raw tag to avoid escaping \
|
|
783
|
+
*
|
|
784
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-raw.md
|
|
785
|
+
*/
|
|
786
|
+
"unicorn/prefer-string-raw": "warn",
|
|
787
|
+
/*
|
|
788
|
+
* Prefer String#replaceAll() over regex searches with the global flag
|
|
789
|
+
*
|
|
790
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-replace-all.md
|
|
791
|
+
*/
|
|
792
|
+
"unicorn/prefer-string-replace-all": "warn",
|
|
793
|
+
/*
|
|
794
|
+
* Prefer String#slice() over String#substr() and String#substring()
|
|
795
|
+
*
|
|
796
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-slice.md
|
|
797
|
+
*/
|
|
798
|
+
"unicorn/prefer-string-slice": "warn",
|
|
799
|
+
/*
|
|
800
|
+
* Prefer String#startsWith() & String#endsWith() over more complex alternatives
|
|
801
|
+
*
|
|
802
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md
|
|
803
|
+
*/
|
|
804
|
+
"unicorn/prefer-string-starts-ends-with": "warn",
|
|
805
|
+
/*
|
|
806
|
+
* Prefer String#trimStart() / String#trimEnd() over String#trimLeft() / String#trimRight()
|
|
807
|
+
*
|
|
808
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-trim-start-end.md
|
|
809
|
+
*/
|
|
810
|
+
"unicorn/prefer-string-trim-start-end": "warn",
|
|
811
|
+
/*
|
|
812
|
+
* Prefer using structuredClone to create a deep clone
|
|
813
|
+
*
|
|
814
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-structured-clone.md
|
|
815
|
+
*/
|
|
816
|
+
"unicorn/prefer-structured-clone": [
|
|
817
|
+
"warn",
|
|
818
|
+
{
|
|
819
|
+
functions: [
|
|
820
|
+
"cloneDeep",
|
|
821
|
+
"utils.clone",
|
|
822
|
+
],
|
|
823
|
+
},
|
|
824
|
+
],
|
|
825
|
+
/*
|
|
826
|
+
* Prefer switch over multiple else-if
|
|
827
|
+
*
|
|
828
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-switch.md
|
|
829
|
+
*/
|
|
830
|
+
"unicorn/prefer-switch": [
|
|
831
|
+
"warn",
|
|
832
|
+
{
|
|
833
|
+
emptyDefaultCase: "do-nothing-comment",
|
|
834
|
+
minimumCases: 3,
|
|
835
|
+
},
|
|
836
|
+
],
|
|
837
|
+
/*
|
|
838
|
+
* Prefer ternary expressions over simple if-else statements
|
|
839
|
+
*
|
|
840
|
+
* This often makes very complicated ternaries and it turns out thats annoying
|
|
841
|
+
*
|
|
842
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-ternary.md
|
|
843
|
+
*/
|
|
844
|
+
"unicorn/prefer-ternary": "off",
|
|
845
|
+
/*
|
|
846
|
+
* Prefer top-level await over top-level promises and async function calls
|
|
847
|
+
*
|
|
848
|
+
* Off for now because we don't have ESM yet
|
|
849
|
+
*
|
|
850
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-top-level-await.md
|
|
851
|
+
*/
|
|
852
|
+
"unicorn/prefer-top-level-await": "off",
|
|
853
|
+
/*
|
|
854
|
+
* Enforce throwing TypeError in type checking conditions. (fixable)
|
|
855
|
+
*
|
|
856
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-type-error.md
|
|
857
|
+
*/
|
|
858
|
+
"unicorn/prefer-type-error": "warn",
|
|
859
|
+
/*
|
|
860
|
+
* Prevent abbreviations
|
|
861
|
+
*
|
|
862
|
+
* Heres a list of the defaults:
|
|
863
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/rules/prevent-abbreviations.js#L13
|
|
864
|
+
*
|
|
865
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md
|
|
866
|
+
*/
|
|
867
|
+
"unicorn/prevent-abbreviations": [
|
|
868
|
+
"warn",
|
|
869
|
+
{
|
|
870
|
+
/*
|
|
871
|
+
* We disable this because of how often Objects are used to interface
|
|
872
|
+
* with third party code, and we don't want to eslint-ignore all of that.
|
|
873
|
+
*/
|
|
874
|
+
checkProperties: false,
|
|
875
|
+
ignore: [
|
|
876
|
+
/^arg*/ui,
|
|
877
|
+
/^utils*/ui,
|
|
878
|
+
],
|
|
879
|
+
replacements: {
|
|
880
|
+
args: {
|
|
881
|
+
// This is a reserved keyword in some cases - don't replace into this
|
|
882
|
+
arguments: false,
|
|
883
|
+
},
|
|
884
|
+
dev: {
|
|
885
|
+
// Term isn't overloaded - allow abbreviation
|
|
886
|
+
development: false,
|
|
887
|
+
},
|
|
888
|
+
doc: {
|
|
889
|
+
// Term isn't overloaded - allow abbreviation
|
|
890
|
+
document: false,
|
|
891
|
+
},
|
|
892
|
+
docs: {
|
|
893
|
+
// Term isn't overloaded - allow abbreviation
|
|
894
|
+
documents: false,
|
|
895
|
+
},
|
|
896
|
+
env: {
|
|
897
|
+
// Term isn't overloaded - allow abbreviation
|
|
898
|
+
environment: false,
|
|
899
|
+
},
|
|
900
|
+
envs: {
|
|
901
|
+
// Term isn't overloaded - allow abbreviation
|
|
902
|
+
environments: false,
|
|
903
|
+
},
|
|
904
|
+
param: {
|
|
905
|
+
// This is used extremely frequently in react-router-dom and we don't want to change it
|
|
906
|
+
parameter: false,
|
|
907
|
+
},
|
|
908
|
+
params: {
|
|
909
|
+
// This is used extremely frequently in react-router-dom and we don't want to change it
|
|
910
|
+
parameters: false,
|
|
911
|
+
},
|
|
912
|
+
props: {
|
|
913
|
+
// This is used extremely frequently in react and we don't want to change it
|
|
914
|
+
properties: false,
|
|
915
|
+
},
|
|
916
|
+
},
|
|
917
|
+
},
|
|
918
|
+
],
|
|
919
|
+
/*
|
|
920
|
+
* Enforce consistent relative URL style
|
|
921
|
+
*
|
|
922
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/relative-url-style.md
|
|
923
|
+
*/
|
|
924
|
+
"unicorn/relative-url-style": [
|
|
925
|
+
"warn",
|
|
926
|
+
"always",
|
|
927
|
+
],
|
|
928
|
+
/*
|
|
929
|
+
* Enforce using the separator argument with Array#join()
|
|
930
|
+
*
|
|
931
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-join-separator.md
|
|
932
|
+
*/
|
|
933
|
+
"unicorn/require-array-join-separator": "warn",
|
|
934
|
+
/*
|
|
935
|
+
* Require non-empty module attributes for imports and exports
|
|
936
|
+
*
|
|
937
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-module-attributes.md
|
|
938
|
+
*/
|
|
939
|
+
"unicorn/require-module-attributes": "warn",
|
|
940
|
+
/*
|
|
941
|
+
* Require non-empty specifier list in import and export statements
|
|
942
|
+
*
|
|
943
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-module-specifiers.md
|
|
944
|
+
*/
|
|
945
|
+
"unicorn/require-module-specifiers": "warn",
|
|
946
|
+
/*
|
|
947
|
+
* Enforce using the digits argument with Number#toFixed()
|
|
948
|
+
*
|
|
949
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-number-to-fixed-digits-argument.md
|
|
950
|
+
*/
|
|
951
|
+
"unicorn/require-number-to-fixed-digits-argument": "warn",
|
|
952
|
+
/*
|
|
953
|
+
* Enforce using the targetOrigin argument with window.postMessage()
|
|
954
|
+
*
|
|
955
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-post-message-target-origin.md
|
|
956
|
+
*/
|
|
957
|
+
"unicorn/require-post-message-target-origin": "warn",
|
|
958
|
+
/*
|
|
959
|
+
* Enforce certain things about the contents of strings. For example, you
|
|
960
|
+
* can enforce using ’ instead of ' to avoid escaping. Or you could block
|
|
961
|
+
* some words. The possibilities are endless.
|
|
962
|
+
*
|
|
963
|
+
* Not using this for now because I can't think of a good use case.
|
|
964
|
+
*
|
|
965
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/string-content.md
|
|
966
|
+
*/
|
|
967
|
+
"unicorn/string-content": "off",
|
|
968
|
+
/*
|
|
969
|
+
* Enforce consistent brace style for case clauses
|
|
970
|
+
*
|
|
971
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/switch-case-braces.md
|
|
972
|
+
*/
|
|
973
|
+
"unicorn/switch-case-braces": [
|
|
974
|
+
"warn",
|
|
975
|
+
"always",
|
|
976
|
+
],
|
|
977
|
+
/*
|
|
978
|
+
* Fix whitespace-insensitive template indentation
|
|
979
|
+
*
|
|
980
|
+
* Leaving this off for now because it might cause chaos.
|
|
981
|
+
*
|
|
982
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/template-indent.md
|
|
983
|
+
*/
|
|
984
|
+
"unicorn/template-indent": "off",
|
|
985
|
+
/*
|
|
986
|
+
* Enforce consistent case for text encoding identifiers
|
|
987
|
+
*
|
|
988
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/text-encoding-identifier-case.md
|
|
989
|
+
*/
|
|
990
|
+
"unicorn/text-encoding-identifier-case": "warn",
|
|
991
|
+
/*
|
|
992
|
+
* Require new when throwing an error. (fixable)
|
|
993
|
+
*
|
|
994
|
+
* https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md
|
|
995
|
+
*/
|
|
996
|
+
"unicorn/throw-new-error": "warn",
|
|
997
|
+
},
|
|
998
|
+
};
|