js-style-kit 0.2.10 → 0.2.12
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 +126 -9
- package/package.json +11 -11
- package/dist/eslint/base/config.d.ts +0 -17
- package/dist/eslint/base/config.js +0 -457
- package/dist/eslint/base/config.js.map +0 -1
- package/dist/eslint/base/rules.d.ts +0 -18
- package/dist/eslint/base/rules.js +0 -425
- package/dist/eslint/base/rules.js.map +0 -1
- package/dist/eslint/base/types.d.ts +0 -21
- package/dist/eslint/base/types.js +0 -1
- package/dist/eslint/base/types.js.map +0 -1
- package/dist/eslint/constants.d.ts +0 -28
- package/dist/eslint/constants.js +0 -25
- package/dist/eslint/constants.js.map +0 -1
- package/dist/eslint/ignores.d.ts +0 -19
- package/dist/eslint/ignores.js +0 -42
- package/dist/eslint/ignores.js.map +0 -1
- package/dist/eslint/index.d.ts +0 -55
- package/dist/eslint/index.js +0 -1410
- package/dist/eslint/index.js.map +0 -1
- package/dist/eslint/jsdoc/config.d.ts +0 -14
- package/dist/eslint/jsdoc/config.js +0 -109
- package/dist/eslint/jsdoc/config.js.map +0 -1
- package/dist/eslint/jsdoc/rules.d.ts +0 -15
- package/dist/eslint/jsdoc/rules.js +0 -73
- package/dist/eslint/jsdoc/rules.js.map +0 -1
- package/dist/eslint/jsdoc/types.d.ts +0 -52
- package/dist/eslint/jsdoc/types.js +0 -1
- package/dist/eslint/jsdoc/types.js.map +0 -1
- package/dist/eslint/nextjs/config.d.ts +0 -12
- package/dist/eslint/nextjs/config.js +0 -62
- package/dist/eslint/nextjs/config.js.map +0 -1
- package/dist/eslint/nextjs/rules.d.ts +0 -8
- package/dist/eslint/nextjs/rules.js +0 -28
- package/dist/eslint/nextjs/rules.js.map +0 -1
- package/dist/eslint/nextjs/types.d.ts +0 -29
- package/dist/eslint/nextjs/types.js +0 -1
- package/dist/eslint/nextjs/types.js.map +0 -1
- package/dist/eslint/perfectionist/config.d.ts +0 -7
- package/dist/eslint/perfectionist/config.js +0 -65
- package/dist/eslint/perfectionist/config.js.map +0 -1
- package/dist/eslint/perfectionist/rules.d.ts +0 -12
- package/dist/eslint/perfectionist/rules.js +0 -31
- package/dist/eslint/perfectionist/rules.js.map +0 -1
- package/dist/eslint/prefer-arrow-function/config.d.ts +0 -12
- package/dist/eslint/prefer-arrow-function/config.js +0 -45
- package/dist/eslint/prefer-arrow-function/config.js.map +0 -1
- package/dist/eslint/prefer-arrow-function/types.d.ts +0 -17
- package/dist/eslint/prefer-arrow-function/types.js +0 -1
- package/dist/eslint/prefer-arrow-function/types.js.map +0 -1
- package/dist/eslint/react/config.d.ts +0 -18
- package/dist/eslint/react/config.js +0 -186
- package/dist/eslint/react/config.js.map +0 -1
- package/dist/eslint/react/rules.d.ts +0 -26
- package/dist/eslint/react/rules.js +0 -132
- package/dist/eslint/react/rules.js.map +0 -1
- package/dist/eslint/react-compiler/config.d.ts +0 -12
- package/dist/eslint/react-compiler/config.js +0 -39
- package/dist/eslint/react-compiler/config.js.map +0 -1
- package/dist/eslint/react-refresh/config.d.ts +0 -16
- package/dist/eslint/react-refresh/config.js +0 -55
- package/dist/eslint/react-refresh/config.js.map +0 -1
- package/dist/eslint/react-refresh/rules.d.ts +0 -38
- package/dist/eslint/react-refresh/rules.js +0 -19
- package/dist/eslint/react-refresh/rules.js.map +0 -1
- package/dist/eslint/storybook/config.d.ts +0 -13
- package/dist/eslint/storybook/config.js +0 -67
- package/dist/eslint/storybook/config.js.map +0 -1
- package/dist/eslint/testing/config.d.ts +0 -25
- package/dist/eslint/testing/config.js +0 -169
- package/dist/eslint/testing/config.js.map +0 -1
- package/dist/eslint/testing/jest-rules.d.ts +0 -14
- package/dist/eslint/testing/jest-rules.js +0 -44
- package/dist/eslint/testing/jest-rules.js.map +0 -1
- package/dist/eslint/testing/vitest-rules.d.ts +0 -14
- package/dist/eslint/testing/vitest-rules.js +0 -50
- package/dist/eslint/testing/vitest-rules.js.map +0 -1
- package/dist/eslint/turbo/config.d.ts +0 -12
- package/dist/eslint/turbo/config.js +0 -39
- package/dist/eslint/turbo/config.js.map +0 -1
- package/dist/eslint/turbo/types.d.ts +0 -11
- package/dist/eslint/turbo/types.js +0 -1
- package/dist/eslint/turbo/types.js.map +0 -1
- package/dist/eslint/types.d.ts +0 -11
- package/dist/eslint/types.js +0 -1
- package/dist/eslint/types.js.map +0 -1
- package/dist/eslint/typescript/config.d.ts +0 -11
- package/dist/eslint/typescript/config.js +0 -186
- package/dist/eslint/typescript/config.js.map +0 -1
- package/dist/eslint/typescript/rules.d.ts +0 -8
- package/dist/eslint/typescript/rules.js +0 -135
- package/dist/eslint/typescript/rules.js.map +0 -1
- package/dist/eslint/typescript/types.d.ts +0 -7
- package/dist/eslint/typescript/types.js +0 -1
- package/dist/eslint/typescript/types.js.map +0 -1
- package/dist/eslint/unicorn/config.d.ts +0 -11
- package/dist/eslint/unicorn/config.js +0 -113
- package/dist/eslint/unicorn/config.js.map +0 -1
- package/dist/eslint/unicorn/rules.d.ts +0 -8
- package/dist/eslint/unicorn/rules.js +0 -79
- package/dist/eslint/unicorn/rules.js.map +0 -1
- package/dist/modules.d.d.ts +0 -3
- package/dist/modules.d.js +0 -1
- package/dist/modules.d.js.map +0 -1
- package/dist/prettier/index.d.ts +0 -34
- package/dist/prettier/index.js +0 -132
- package/dist/prettier/index.js.map +0 -1
- package/dist/prettier/patch-tailwind-plugin.d.ts +0 -9
- package/dist/prettier/patch-tailwind-plugin.js +0 -72
- package/dist/prettier/patch-tailwind-plugin.js.map +0 -1
- package/dist/utils/is-type.d.ts +0 -44
- package/dist/utils/is-type.js +0 -28
- package/dist/utils/is-type.js.map +0 -1
package/dist/eslint/index.js
DELETED
|
@@ -1,1410 +0,0 @@
|
|
|
1
|
-
// src/utils/is-type.ts
|
|
2
|
-
var isString = (value) => {
|
|
3
|
-
return typeof value === "string";
|
|
4
|
-
};
|
|
5
|
-
var isObject = (value) => {
|
|
6
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// src/eslint/constants.ts
|
|
10
|
-
var configNames = {
|
|
11
|
-
base: "base",
|
|
12
|
-
disableTypeChecked: "typescript-eslint/disable-type-checked",
|
|
13
|
-
ignores: "ignores",
|
|
14
|
-
jsdoc: "jsdoc",
|
|
15
|
-
markdown: "markdown",
|
|
16
|
-
nextjs: "nextjs",
|
|
17
|
-
perfectionist: "perfectionist",
|
|
18
|
-
preferArrowFunction: "prefer-arrow-function",
|
|
19
|
-
react: "react",
|
|
20
|
-
reactCompiler: "react-compiler",
|
|
21
|
-
reactRefresh: "react-refresh",
|
|
22
|
-
storybook: "storybook:stories",
|
|
23
|
-
storybookConfig: "storybook:config",
|
|
24
|
-
testing: "testing",
|
|
25
|
-
turbo: "turbo",
|
|
26
|
-
typescript: "tseslint",
|
|
27
|
-
typescriptTesting: "tseslint-testing",
|
|
28
|
-
unicorn: "unicorn"
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// src/eslint/base/rules.ts
|
|
32
|
-
var baseEslintRules = (functionStyle) => ({
|
|
33
|
-
/**
|
|
34
|
-
* Require return statements in array methods callbacks.
|
|
35
|
-
*
|
|
36
|
-
* 🚫 Not fixable -https://eslint.org/docs/rules/array-callback-return
|
|
37
|
-
*/
|
|
38
|
-
"array-callback-return": [
|
|
39
|
-
"warn",
|
|
40
|
-
{ allowImplicit: true, checkForEach: true }
|
|
41
|
-
],
|
|
42
|
-
/**
|
|
43
|
-
* Treat `var` statements as if they were block scoped.
|
|
44
|
-
*
|
|
45
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/block-scoped-var
|
|
46
|
-
*/
|
|
47
|
-
"block-scoped-var": "warn",
|
|
48
|
-
/**
|
|
49
|
-
* Require camel case names.
|
|
50
|
-
*
|
|
51
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/camelcase
|
|
52
|
-
*/
|
|
53
|
-
camelcase: [
|
|
54
|
-
"warn",
|
|
55
|
-
{
|
|
56
|
-
allow: ["^UNSAFE_"],
|
|
57
|
-
ignoreDestructuring: false,
|
|
58
|
-
ignoreImports: true,
|
|
59
|
-
properties: "never"
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
/**
|
|
63
|
-
* Require curly braces for multiline blocks.
|
|
64
|
-
*
|
|
65
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/curly
|
|
66
|
-
*/
|
|
67
|
-
curly: ["warn", "multi-line"],
|
|
68
|
-
/**
|
|
69
|
-
* Require default clauses in switch statements to be last (if used).
|
|
70
|
-
*
|
|
71
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/default-case-last
|
|
72
|
-
*/
|
|
73
|
-
"default-case-last": "warn",
|
|
74
|
-
/**
|
|
75
|
-
* Require triple equals (`===` and `!==`).
|
|
76
|
-
*å
|
|
77
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/eqeqeq
|
|
78
|
-
*/
|
|
79
|
-
eqeqeq: "warn",
|
|
80
|
-
"for-direction": "warn",
|
|
81
|
-
/**
|
|
82
|
-
* Require function expressions to have a name.
|
|
83
|
-
*
|
|
84
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/func-names
|
|
85
|
-
*/
|
|
86
|
-
"func-names": ["warn", "as-needed"],
|
|
87
|
-
"func-style": (
|
|
88
|
-
// if arrow function, we use the prefer-arrow-functions plugin
|
|
89
|
-
functionStyle === "off" || functionStyle === "arrow" ? "off" : ["warn", functionStyle, { allowArrowFunctions: true }]
|
|
90
|
-
),
|
|
91
|
-
/**
|
|
92
|
-
* Require grouped accessor pairs in object literals and classes.
|
|
93
|
-
*
|
|
94
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
95
|
-
*/
|
|
96
|
-
"grouped-accessor-pairs": "warn",
|
|
97
|
-
/**
|
|
98
|
-
* Require a capital letter for constructors.
|
|
99
|
-
*
|
|
100
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/new-cap
|
|
101
|
-
*/
|
|
102
|
-
"new-cap": ["warn", { capIsNew: false }],
|
|
103
|
-
/**
|
|
104
|
-
* Disallow use of `alert()`.
|
|
105
|
-
*
|
|
106
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-alert
|
|
107
|
-
*/
|
|
108
|
-
"no-alert": "warn",
|
|
109
|
-
"no-async-promise-executor": "warn",
|
|
110
|
-
/**
|
|
111
|
-
* Disallow use of bitwise operators.
|
|
112
|
-
*
|
|
113
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-bitwise
|
|
114
|
-
*/
|
|
115
|
-
"no-bitwise": "warn",
|
|
116
|
-
/**
|
|
117
|
-
* Disallow use of `caller`/`callee`.
|
|
118
|
-
*
|
|
119
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-caller
|
|
120
|
-
*/
|
|
121
|
-
"no-caller": "warn",
|
|
122
|
-
"no-case-declarations": "warn",
|
|
123
|
-
"no-compare-neg-zero": "warn",
|
|
124
|
-
"no-cond-assign": "warn",
|
|
125
|
-
/**
|
|
126
|
-
* Disallow the use of console.
|
|
127
|
-
*
|
|
128
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-console
|
|
129
|
-
*/
|
|
130
|
-
"no-console": ["warn", { allow: ["info", "warn", "error"] }],
|
|
131
|
-
/**
|
|
132
|
-
* Disallow expressions where the operation doesn't affect the value.
|
|
133
|
-
*
|
|
134
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-console
|
|
135
|
-
*/
|
|
136
|
-
"no-constant-binary-expression": "warn",
|
|
137
|
-
"no-constant-condition": "warn",
|
|
138
|
-
/**
|
|
139
|
-
* Disallow returning value in constructor.
|
|
140
|
-
*
|
|
141
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-constructor-return
|
|
142
|
-
*/
|
|
143
|
-
"no-constructor-return": "warn",
|
|
144
|
-
"no-control-regex": "warn",
|
|
145
|
-
"no-debugger": "warn",
|
|
146
|
-
"no-delete-var": "warn",
|
|
147
|
-
"no-dupe-else-if": "warn",
|
|
148
|
-
"no-duplicate-case": "warn",
|
|
149
|
-
/**
|
|
150
|
-
* Disallow using an `else` if the `if` block contains a return.
|
|
151
|
-
*
|
|
152
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-else-return
|
|
153
|
-
*/
|
|
154
|
-
"no-else-return": "warn",
|
|
155
|
-
"no-empty": "warn",
|
|
156
|
-
"no-empty-character-class": "warn",
|
|
157
|
-
"no-empty-pattern": "warn",
|
|
158
|
-
"no-empty-static-block": "warn",
|
|
159
|
-
/**
|
|
160
|
-
* Disallow `eval()`.
|
|
161
|
-
*
|
|
162
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-eval
|
|
163
|
-
*/
|
|
164
|
-
"no-eval": "warn",
|
|
165
|
-
"no-ex-assign": "warn",
|
|
166
|
-
/**
|
|
167
|
-
* Disallow extending native objects.
|
|
168
|
-
*
|
|
169
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-extend-native
|
|
170
|
-
*/
|
|
171
|
-
"no-extend-native": "warn",
|
|
172
|
-
/**
|
|
173
|
-
* Disallow unnecessary function binding.
|
|
174
|
-
*
|
|
175
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-extra-bind
|
|
176
|
-
*/
|
|
177
|
-
"no-extra-bind": "warn",
|
|
178
|
-
"no-extra-boolean-cast": "warn",
|
|
179
|
-
/**
|
|
180
|
-
* Disallow unnecessary labels.
|
|
181
|
-
*
|
|
182
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-extra-label
|
|
183
|
-
*/
|
|
184
|
-
"no-extra-label": "warn",
|
|
185
|
-
"no-fallthrough": "warn",
|
|
186
|
-
"no-global-assign": "warn",
|
|
187
|
-
/**
|
|
188
|
-
* Make people convert types explicitly e.g. `Boolean(foo)` instead of `!!foo`.
|
|
189
|
-
*
|
|
190
|
-
* 🔧 Partially Fixable - https://eslint.org/docs/rules/no-implicit-coercion
|
|
191
|
-
*/
|
|
192
|
-
"no-implicit-coercion": "warn",
|
|
193
|
-
"no-invalid-regexp": "warn",
|
|
194
|
-
"no-irregular-whitespace": "warn",
|
|
195
|
-
/**
|
|
196
|
-
* Disallow usage of `__iterator__` property.
|
|
197
|
-
*
|
|
198
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-iterator
|
|
199
|
-
*/
|
|
200
|
-
"no-iterator": "warn",
|
|
201
|
-
/**
|
|
202
|
-
* Disallow labels that share a name with a variable.
|
|
203
|
-
*
|
|
204
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-label-var
|
|
205
|
-
*/
|
|
206
|
-
"no-label-var": "warn",
|
|
207
|
-
/**
|
|
208
|
-
* Disallow use of labels for anything other than loops and switches.
|
|
209
|
-
*
|
|
210
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-labels
|
|
211
|
-
*/
|
|
212
|
-
"no-labels": ["warn"],
|
|
213
|
-
/**
|
|
214
|
-
* Disallow unnecessary nested blocks.
|
|
215
|
-
*
|
|
216
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-lone-blocks
|
|
217
|
-
*/
|
|
218
|
-
"no-lone-blocks": "warn",
|
|
219
|
-
/**
|
|
220
|
-
* Disallow if as the only statement in an else block.
|
|
221
|
-
*
|
|
222
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-lonely-if
|
|
223
|
-
*/
|
|
224
|
-
"no-lonely-if": "warn",
|
|
225
|
-
"no-loss-of-precision": "warn",
|
|
226
|
-
"no-misleading-character-class": "warn",
|
|
227
|
-
/**
|
|
228
|
-
* Disallow use of chained assignment expressions.
|
|
229
|
-
*
|
|
230
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-multi-assign
|
|
231
|
-
*/
|
|
232
|
-
"no-multi-assign": ["warn"],
|
|
233
|
-
/**
|
|
234
|
-
* Disallow `new` for side effects.
|
|
235
|
-
*
|
|
236
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new
|
|
237
|
-
*/
|
|
238
|
-
"no-new": "warn",
|
|
239
|
-
/**
|
|
240
|
-
* Disallow function constructors.
|
|
241
|
-
*
|
|
242
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new-func
|
|
243
|
-
*/
|
|
244
|
-
"no-new-func": "warn",
|
|
245
|
-
/**
|
|
246
|
-
* Disallow primitive wrapper instances, such as `new String('foo')`.
|
|
247
|
-
*
|
|
248
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new-wrappers
|
|
249
|
-
*/
|
|
250
|
-
"no-new-wrappers": "warn",
|
|
251
|
-
"no-nonoctal-decimal-escape": "warn",
|
|
252
|
-
"no-octal": "warn",
|
|
253
|
-
/**
|
|
254
|
-
* Disallow use of octal escape sequences in string literals.
|
|
255
|
-
*
|
|
256
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-octal-escape
|
|
257
|
-
*/
|
|
258
|
-
"no-octal-escape": "warn",
|
|
259
|
-
/**
|
|
260
|
-
* Disallow reassignment of function parameters.
|
|
261
|
-
*
|
|
262
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-param-reassign
|
|
263
|
-
*/
|
|
264
|
-
"no-param-reassign": "warn",
|
|
265
|
-
/**
|
|
266
|
-
* Disallow returning values from Promise executor functions.
|
|
267
|
-
*
|
|
268
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-promise-executor-return
|
|
269
|
-
*/
|
|
270
|
-
"no-promise-executor-return": "warn",
|
|
271
|
-
/**
|
|
272
|
-
* Disallow usage of the deprecated `__proto__` property.
|
|
273
|
-
*
|
|
274
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-proto
|
|
275
|
-
*/
|
|
276
|
-
"no-proto": "warn",
|
|
277
|
-
"no-prototype-builtins": "warn",
|
|
278
|
-
"no-regex-spaces": "warn",
|
|
279
|
-
/**
|
|
280
|
-
* Disallow assignment in `return` statement.
|
|
281
|
-
*
|
|
282
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign
|
|
283
|
-
*/
|
|
284
|
-
"no-return-assign": "warn",
|
|
285
|
-
/**
|
|
286
|
-
* Disallow use of `javascript:` urls.
|
|
287
|
-
*
|
|
288
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-script-url
|
|
289
|
-
*/
|
|
290
|
-
"no-script-url": "warn",
|
|
291
|
-
"no-self-assign": "warn",
|
|
292
|
-
/**
|
|
293
|
-
* Disallow comparisons where both sides are exactly the same.
|
|
294
|
-
*
|
|
295
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-self-compare
|
|
296
|
-
*/
|
|
297
|
-
"no-self-compare": "warn",
|
|
298
|
-
/**
|
|
299
|
-
* Disallow use of comma operator.
|
|
300
|
-
*
|
|
301
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-sequences
|
|
302
|
-
*/
|
|
303
|
-
"no-sequences": "warn",
|
|
304
|
-
"no-shadow-restricted-names": "warn",
|
|
305
|
-
"no-sparse-arrays": "warn",
|
|
306
|
-
/**
|
|
307
|
-
* Disallow template literal placeholder syntax in regular strings, as
|
|
308
|
-
* these are likely errors.
|
|
309
|
-
*
|
|
310
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-template-curly-in-string
|
|
311
|
-
*/
|
|
312
|
-
"no-template-curly-in-string": "warn",
|
|
313
|
-
/**
|
|
314
|
-
* Disallow initializing variables to `undefined`.
|
|
315
|
-
*
|
|
316
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-undef-init
|
|
317
|
-
*/
|
|
318
|
-
"no-undef-init": "warn",
|
|
319
|
-
"no-unexpected-multiline": "warn",
|
|
320
|
-
/**
|
|
321
|
-
* Disallow ternary operators when simpler alternatives exist.
|
|
322
|
-
*
|
|
323
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-unneeded-ternary
|
|
324
|
-
*/
|
|
325
|
-
"no-unneeded-ternary": "warn",
|
|
326
|
-
/**
|
|
327
|
-
* Disallow loops with a body that allows only one iteration.
|
|
328
|
-
*
|
|
329
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-unreachable-loop
|
|
330
|
-
*/
|
|
331
|
-
"no-unreachable-loop": "warn",
|
|
332
|
-
"no-unsafe-finally": "warn",
|
|
333
|
-
"no-unsafe-optional-chaining": "warn",
|
|
334
|
-
"no-unused-labels": "warn",
|
|
335
|
-
"no-unused-private-class-members": "warn",
|
|
336
|
-
"no-useless-backreference": "warn",
|
|
337
|
-
/**
|
|
338
|
-
* Disallow unnecessary `.call()` and `.apply()`.
|
|
339
|
-
*
|
|
340
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-call
|
|
341
|
-
*/
|
|
342
|
-
"no-useless-call": "warn",
|
|
343
|
-
"no-useless-catch": "warn",
|
|
344
|
-
/**
|
|
345
|
-
* Disallow useless computed property keys.
|
|
346
|
-
*
|
|
347
|
-
* � Fixable - https://eslint.org/docs/rules/no-useless-computed-key
|
|
348
|
-
*/
|
|
349
|
-
"no-useless-computed-key": "warn",
|
|
350
|
-
/**
|
|
351
|
-
* Disallow unnecessary concatenation of strings.
|
|
352
|
-
*
|
|
353
|
-
* � Not fixable - https://eslint.org/docs/rules/no-useless-concat
|
|
354
|
-
*/
|
|
355
|
-
"no-useless-concat": "warn",
|
|
356
|
-
"no-useless-escape": "warn",
|
|
357
|
-
/**
|
|
358
|
-
* Disallow renaming import, export, and destructured assignments to the
|
|
359
|
-
* same name.
|
|
360
|
-
*
|
|
361
|
-
* � Fixable - https://eslint.org/docs/rules/no-useless-rename
|
|
362
|
-
*/
|
|
363
|
-
"no-useless-rename": "warn",
|
|
364
|
-
/**
|
|
365
|
-
* Disallow redundant return statements.
|
|
366
|
-
*
|
|
367
|
-
* � Fixable - https://eslint.org/docs/rules/no-useless-return
|
|
368
|
-
*/
|
|
369
|
-
"no-useless-return": "warn",
|
|
370
|
-
/**
|
|
371
|
-
* Require `let` or `const` instead of `var`.
|
|
372
|
-
* ts transpiles let/const to var, so no need for vars any more
|
|
373
|
-
*
|
|
374
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-var
|
|
375
|
-
*/
|
|
376
|
-
"no-var": "warn",
|
|
377
|
-
"no-with": "warn",
|
|
378
|
-
/**
|
|
379
|
-
* Require object literal shorthand syntax.
|
|
380
|
-
*
|
|
381
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/object-shorthand
|
|
382
|
-
*/
|
|
383
|
-
"object-shorthand": "warn",
|
|
384
|
-
/**
|
|
385
|
-
* Require default to `const` instead of `let`.
|
|
386
|
-
* ts provides better types with const
|
|
387
|
-
*
|
|
388
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/prefer-const
|
|
389
|
-
*/
|
|
390
|
-
"prefer-const": "warn",
|
|
391
|
-
/**
|
|
392
|
-
* Require using named capture groups in regular expressions.
|
|
393
|
-
*
|
|
394
|
-
* � Not fixable - https://eslint.org/docs/rules/prefer-named-capture-group
|
|
395
|
-
*/
|
|
396
|
-
"prefer-named-capture-group": "warn",
|
|
397
|
-
/**
|
|
398
|
-
* Disallow parseInt() in favor of binary, octal, and hexadecimal literals.
|
|
399
|
-
*
|
|
400
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/prefer-numeric-literals
|
|
401
|
-
*/
|
|
402
|
-
"prefer-numeric-literals": "warn",
|
|
403
|
-
/**
|
|
404
|
-
* Require use of an object spread over Object.assign.
|
|
405
|
-
*
|
|
406
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/prefer-object-spread
|
|
407
|
-
*/
|
|
408
|
-
"prefer-object-spread": "warn",
|
|
409
|
-
/**
|
|
410
|
-
* Disallow use of the RegExp constructor in favor of regular expression
|
|
411
|
-
* literals.
|
|
412
|
-
*
|
|
413
|
-
* � Not fixable - https://eslint.org/docs/rules/prefer-regex-literals
|
|
414
|
-
*/
|
|
415
|
-
"prefer-regex-literals": "warn",
|
|
416
|
-
/**
|
|
417
|
-
* Require using rest parameters instead of `arguments`.
|
|
418
|
-
* ts provides better types with rest args over arguments
|
|
419
|
-
*
|
|
420
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/prefer-rest-params
|
|
421
|
-
*/
|
|
422
|
-
"prefer-rest-params": "warn",
|
|
423
|
-
/**
|
|
424
|
-
* Require using spread syntax instead of `.apply()`.
|
|
425
|
-
* ts transpiles spread to apply, so no need for manual apply
|
|
426
|
-
*
|
|
427
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/prefer-spread
|
|
428
|
-
*/
|
|
429
|
-
"prefer-spread": "warn",
|
|
430
|
-
/**
|
|
431
|
-
* Require using template literals instead of string concatenation.
|
|
432
|
-
*
|
|
433
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/prefer-template
|
|
434
|
-
*/
|
|
435
|
-
"prefer-template": "warn",
|
|
436
|
-
"require-yield": "warn",
|
|
437
|
-
/**
|
|
438
|
-
* Require a `Symbol` description.
|
|
439
|
-
*
|
|
440
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/symbol-description
|
|
441
|
-
*/
|
|
442
|
-
"symbol-description": "warn",
|
|
443
|
-
"use-isnan": "warn",
|
|
444
|
-
"valid-typeof": "warn",
|
|
445
|
-
/**
|
|
446
|
-
* Disallow "Yoda conditions", ensuring the comparison.
|
|
447
|
-
*
|
|
448
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/yoda
|
|
449
|
-
*/
|
|
450
|
-
yoda: "warn"
|
|
451
|
-
});
|
|
452
|
-
|
|
453
|
-
// src/eslint/base/config.ts
|
|
454
|
-
var baseEslintConfig = (functionStyle) => ({
|
|
455
|
-
languageOptions: {
|
|
456
|
-
ecmaVersion: 2022
|
|
457
|
-
},
|
|
458
|
-
linterOptions: { reportUnusedDisableDirectives: true },
|
|
459
|
-
name: configNames.base,
|
|
460
|
-
rules: baseEslintRules(functionStyle)
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
// src/eslint/ignores.ts
|
|
464
|
-
var ignoresConfig = ({
|
|
465
|
-
next = false,
|
|
466
|
-
storybook = false,
|
|
467
|
-
userIgnores = []
|
|
468
|
-
} = {}) => ({
|
|
469
|
-
ignores: [
|
|
470
|
-
"**/node_modules/",
|
|
471
|
-
"**/dist/",
|
|
472
|
-
".git/",
|
|
473
|
-
...next ? [".next"] : [],
|
|
474
|
-
...storybook ? ["!.storybook"] : [],
|
|
475
|
-
...userIgnores
|
|
476
|
-
],
|
|
477
|
-
name: configNames.ignores
|
|
478
|
-
});
|
|
479
|
-
|
|
480
|
-
// src/eslint/jsdoc/config.ts
|
|
481
|
-
import jsdoc from "eslint-plugin-jsdoc";
|
|
482
|
-
|
|
483
|
-
// src/eslint/jsdoc/rules.ts
|
|
484
|
-
var jsdocRules = (requireJsdoc = false, typescript = true) => ({
|
|
485
|
-
"jsdoc/check-access": "warn",
|
|
486
|
-
"jsdoc/check-alignment": "warn",
|
|
487
|
-
"jsdoc/check-param-names": [
|
|
488
|
-
"warn",
|
|
489
|
-
{
|
|
490
|
-
checkDestructured: true,
|
|
491
|
-
enableFixer: true
|
|
492
|
-
}
|
|
493
|
-
],
|
|
494
|
-
"jsdoc/check-property-names": "warn",
|
|
495
|
-
"jsdoc/check-tag-names": [
|
|
496
|
-
"warn",
|
|
497
|
-
{
|
|
498
|
-
typed: true
|
|
499
|
-
}
|
|
500
|
-
],
|
|
501
|
-
"jsdoc/check-types": "warn",
|
|
502
|
-
"jsdoc/check-values": "warn",
|
|
503
|
-
"jsdoc/empty-tags": "warn",
|
|
504
|
-
"jsdoc/implements-on-classes": "warn",
|
|
505
|
-
"jsdoc/multiline-blocks": "warn",
|
|
506
|
-
"jsdoc/no-blank-block-descriptions": "off",
|
|
507
|
-
"jsdoc/no-defaults": "warn",
|
|
508
|
-
"jsdoc/no-multi-asterisks": "warn",
|
|
509
|
-
"jsdoc/no-types": typescript ? "warn" : "off",
|
|
510
|
-
"jsdoc/no-undefined-types": typescript ? "off" : "warn",
|
|
511
|
-
"jsdoc/require-asterisk-prefix": "warn",
|
|
512
|
-
"jsdoc/require-description": requireJsdoc ? "warn" : "off",
|
|
513
|
-
"jsdoc/require-jsdoc": requireJsdoc ? [
|
|
514
|
-
"warn",
|
|
515
|
-
{
|
|
516
|
-
require: {
|
|
517
|
-
ArrowFunctionExpression: true,
|
|
518
|
-
ClassDeclaration: true,
|
|
519
|
-
ClassExpression: true,
|
|
520
|
-
FunctionDeclaration: true,
|
|
521
|
-
FunctionExpression: true,
|
|
522
|
-
MethodDefinition: true
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
] : "off",
|
|
526
|
-
"jsdoc/require-param": requireJsdoc ? "warn" : "off",
|
|
527
|
-
"jsdoc/require-param-description": "warn",
|
|
528
|
-
"jsdoc/require-param-name": "warn",
|
|
529
|
-
"jsdoc/require-property": requireJsdoc ? "warn" : "off",
|
|
530
|
-
"jsdoc/require-property-description": "warn",
|
|
531
|
-
"jsdoc/require-property-name": "warn",
|
|
532
|
-
"jsdoc/require-returns": requireJsdoc ? "warn" : "off",
|
|
533
|
-
"jsdoc/require-returns-check": "warn",
|
|
534
|
-
"jsdoc/require-returns-description": "warn",
|
|
535
|
-
"jsdoc/require-yields": "warn",
|
|
536
|
-
"jsdoc/require-yields-check": "warn",
|
|
537
|
-
"jsdoc/tag-lines": [
|
|
538
|
-
"warn",
|
|
539
|
-
"never",
|
|
540
|
-
{
|
|
541
|
-
startLines: 1,
|
|
542
|
-
// Allow 1 line between description and first tag
|
|
543
|
-
tags: {
|
|
544
|
-
param: { lines: "never" }
|
|
545
|
-
// Enforce no lines between param tags
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
],
|
|
549
|
-
"jsdoc/text-escaping": "off",
|
|
550
|
-
"jsdoc/valid-types": "warn"
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
// src/eslint/jsdoc/config.ts
|
|
554
|
-
var jsdocConfig = (requireJsdoc = false, typescript = true) => ({
|
|
555
|
-
files: ["**/*.{js,jsx,ts,tsx,cjs,mjs}"],
|
|
556
|
-
ignores: ["**/*.{test,spec}.{js,jsx,ts,tsx,cjs,mjs}"],
|
|
557
|
-
name: configNames.jsdoc,
|
|
558
|
-
plugins: {
|
|
559
|
-
jsdoc
|
|
560
|
-
},
|
|
561
|
-
rules: jsdocRules(requireJsdoc, typescript)
|
|
562
|
-
});
|
|
563
|
-
|
|
564
|
-
// src/eslint/nextjs/config.ts
|
|
565
|
-
import nextjs from "eslint-plugin-nextjs";
|
|
566
|
-
|
|
567
|
-
// src/eslint/nextjs/rules.ts
|
|
568
|
-
var nextjsRules = {
|
|
569
|
-
"nextjs/google-font-display": "warn",
|
|
570
|
-
"nextjs/google-font-preconnect": "warn",
|
|
571
|
-
"nextjs/inline-script-id": "warn",
|
|
572
|
-
"nextjs/next-script-for-ga": "warn",
|
|
573
|
-
"nextjs/no-assign-module-variable": "warn",
|
|
574
|
-
"nextjs/no-async-client-component": "warn",
|
|
575
|
-
"nextjs/no-before-interactive-script-outside-document": "warn",
|
|
576
|
-
"nextjs/no-css-tags": "warn",
|
|
577
|
-
"nextjs/no-document-import-in-page": "warn",
|
|
578
|
-
"nextjs/no-duplicate-head": "warn",
|
|
579
|
-
"nextjs/no-head-element": "warn",
|
|
580
|
-
"nextjs/no-head-import-in-document": "warn",
|
|
581
|
-
"nextjs/no-html-link-for-pages": "warn",
|
|
582
|
-
"nextjs/no-img-element": "warn",
|
|
583
|
-
"nextjs/no-page-custom-font": "warn",
|
|
584
|
-
"nextjs/no-script-component-in-head": "warn",
|
|
585
|
-
"nextjs/no-styled-jsx-in-document": "warn",
|
|
586
|
-
"nextjs/no-sync-scripts": "warn",
|
|
587
|
-
"nextjs/no-title-in-document-head": "warn",
|
|
588
|
-
"nextjs/no-typos": "warn",
|
|
589
|
-
"nextjs/no-unwanted-polyfillio": "warn"
|
|
590
|
-
};
|
|
591
|
-
|
|
592
|
-
// src/eslint/nextjs/config.ts
|
|
593
|
-
var nextjsConfig = () => ({
|
|
594
|
-
name: configNames.nextjs,
|
|
595
|
-
plugins: {
|
|
596
|
-
nextjs
|
|
597
|
-
},
|
|
598
|
-
rules: nextjsRules
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
// src/eslint/perfectionist/config.ts
|
|
602
|
-
import perfectionist from "eslint-plugin-perfectionist";
|
|
603
|
-
|
|
604
|
-
// src/eslint/perfectionist/rules.ts
|
|
605
|
-
var defaultOptions = {
|
|
606
|
-
order: "asc",
|
|
607
|
-
type: "natural"
|
|
608
|
-
};
|
|
609
|
-
var perfectionistRules = {
|
|
610
|
-
"perfectionist/sort-array-includes": ["warn", defaultOptions],
|
|
611
|
-
"perfectionist/sort-classes": ["warn", defaultOptions],
|
|
612
|
-
"perfectionist/sort-decorators": ["warn", defaultOptions],
|
|
613
|
-
"perfectionist/sort-enums": ["warn", defaultOptions],
|
|
614
|
-
"perfectionist/sort-exports": ["warn", defaultOptions],
|
|
615
|
-
"perfectionist/sort-heritage-clauses": ["warn", defaultOptions],
|
|
616
|
-
"perfectionist/sort-imports": ["warn", defaultOptions],
|
|
617
|
-
"perfectionist/sort-interfaces": ["warn", defaultOptions],
|
|
618
|
-
"perfectionist/sort-intersection-types": ["warn", defaultOptions],
|
|
619
|
-
"perfectionist/sort-jsx-props": ["warn", defaultOptions],
|
|
620
|
-
"perfectionist/sort-maps": ["warn", defaultOptions],
|
|
621
|
-
"perfectionist/sort-modules": ["off", defaultOptions],
|
|
622
|
-
"perfectionist/sort-named-exports": ["warn", defaultOptions],
|
|
623
|
-
"perfectionist/sort-named-imports": ["warn", defaultOptions],
|
|
624
|
-
"perfectionist/sort-object-types": ["warn", defaultOptions],
|
|
625
|
-
"perfectionist/sort-objects": ["warn", defaultOptions],
|
|
626
|
-
"perfectionist/sort-sets": ["warn", defaultOptions],
|
|
627
|
-
"perfectionist/sort-switch-case": ["warn", defaultOptions],
|
|
628
|
-
"perfectionist/sort-union-types": ["warn", defaultOptions],
|
|
629
|
-
"perfectionist/sort-variable-declarations": ["warn", defaultOptions]
|
|
630
|
-
};
|
|
631
|
-
|
|
632
|
-
// src/eslint/perfectionist/config.ts
|
|
633
|
-
var perfectionistConfig = {
|
|
634
|
-
name: configNames.perfectionist,
|
|
635
|
-
plugins: {
|
|
636
|
-
perfectionist
|
|
637
|
-
},
|
|
638
|
-
rules: perfectionistRules
|
|
639
|
-
};
|
|
640
|
-
|
|
641
|
-
// src/eslint/prefer-arrow-function/config.ts
|
|
642
|
-
import preferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
|
|
643
|
-
var preferArrowFunctionConfig = () => ({
|
|
644
|
-
name: configNames.preferArrowFunction,
|
|
645
|
-
plugins: {
|
|
646
|
-
"prefer-arrow-functions": preferArrowFunctions
|
|
647
|
-
},
|
|
648
|
-
rules: {
|
|
649
|
-
"prefer-arrow-functions/prefer-arrow-functions": [
|
|
650
|
-
"warn",
|
|
651
|
-
{
|
|
652
|
-
returnStyle: "unchanged",
|
|
653
|
-
singleReturnOnly: false
|
|
654
|
-
}
|
|
655
|
-
]
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
|
|
659
|
-
// src/eslint/react-compiler/config.ts
|
|
660
|
-
import reactCompiler from "eslint-plugin-react-compiler";
|
|
661
|
-
var reactCompilerEslintConfig = {
|
|
662
|
-
name: configNames.reactCompiler,
|
|
663
|
-
plugins: {
|
|
664
|
-
"react-compiler": reactCompiler
|
|
665
|
-
},
|
|
666
|
-
rules: {
|
|
667
|
-
"react-compiler/react-compiler": "warn"
|
|
668
|
-
}
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
// src/eslint/react-refresh/config.ts
|
|
672
|
-
import reactRefresh from "eslint-plugin-react-refresh";
|
|
673
|
-
|
|
674
|
-
// src/eslint/react-refresh/rules.ts
|
|
675
|
-
var reactRefreshRules = {
|
|
676
|
-
/**
|
|
677
|
-
* Validate that your components can safely be updated with Fast Refresh.
|
|
678
|
-
*
|
|
679
|
-
* This rule enforces that components are structured in a way that integrations
|
|
680
|
-
* like react-refresh expect.
|
|
681
|
-
*
|
|
682
|
-
* 🚫 Not fixable - https://github.com/ArnaudBarre/eslint-plugin-react-refresh
|
|
683
|
-
*/
|
|
684
|
-
"react-refresh/only-export-components": [
|
|
685
|
-
"warn",
|
|
686
|
-
{ allowConstantExport: true }
|
|
687
|
-
]
|
|
688
|
-
};
|
|
689
|
-
|
|
690
|
-
// src/eslint/react-refresh/config.ts
|
|
691
|
-
var reactRefreshEslintConfig = () => {
|
|
692
|
-
return {
|
|
693
|
-
name: configNames.reactRefresh,
|
|
694
|
-
plugins: {
|
|
695
|
-
"react-refresh": reactRefresh
|
|
696
|
-
},
|
|
697
|
-
rules: reactRefreshRules
|
|
698
|
-
};
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
// src/eslint/react/config.ts
|
|
702
|
-
import react from "eslint-plugin-react";
|
|
703
|
-
import pluginReactHooks from "eslint-plugin-react-hooks";
|
|
704
|
-
import globals from "globals";
|
|
705
|
-
|
|
706
|
-
// src/eslint/react/rules.ts
|
|
707
|
-
var reactRules = (functionStyle, typescript) => {
|
|
708
|
-
const functionStyleMap = {
|
|
709
|
-
arrow: "arrow-function",
|
|
710
|
-
declaration: "function-declaration",
|
|
711
|
-
expression: "function-expression"
|
|
712
|
-
};
|
|
713
|
-
return {
|
|
714
|
-
/**
|
|
715
|
-
* Disabled in favor of TypeScript for type checking
|
|
716
|
-
*/
|
|
717
|
-
...typescript ? {} : { "react/prop-types": "warn" },
|
|
718
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
719
|
-
"react-hooks/rules-of-hooks": "warn",
|
|
720
|
-
/**
|
|
721
|
-
* Require an explicit type when using button elements.
|
|
722
|
-
*
|
|
723
|
-
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
|
|
724
|
-
*/
|
|
725
|
-
"react/button-has-type": "warn",
|
|
726
|
-
"react/destructuring-assignment": ["warn", "always"],
|
|
727
|
-
"react/display-name": "warn",
|
|
728
|
-
/**
|
|
729
|
-
* Require consistent function type for function components.
|
|
730
|
-
*
|
|
731
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/HEAD/docs/rules/function-component-definition.md
|
|
732
|
-
*/
|
|
733
|
-
"react/function-component-definition": functionStyle === "off" ? "off" : [
|
|
734
|
-
"warn",
|
|
735
|
-
{
|
|
736
|
-
namedComponents: functionStyleMap[functionStyle],
|
|
737
|
-
unnamedComponents: functionStyle === "arrow" ? "arrow-function" : "function-expression"
|
|
738
|
-
}
|
|
739
|
-
],
|
|
740
|
-
/**
|
|
741
|
-
* Require destructuring and symmetric naming of `useState` hook value and setter variables.
|
|
742
|
-
*
|
|
743
|
-
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
744
|
-
*/
|
|
745
|
-
"react/hook-use-state": "warn",
|
|
746
|
-
/**
|
|
747
|
-
* Require consistent boolean attributes notation in JSX.
|
|
748
|
-
*
|
|
749
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
750
|
-
*/
|
|
751
|
-
"react/jsx-boolean-value": "warn",
|
|
752
|
-
/**
|
|
753
|
-
* Disallow unnecessary curly braces in JSX props and children.
|
|
754
|
-
*
|
|
755
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
756
|
-
*/
|
|
757
|
-
"react/jsx-curly-brace-presence": "warn",
|
|
758
|
-
/**
|
|
759
|
-
* Require using shorthand form for React fragments, unless required.
|
|
760
|
-
*
|
|
761
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
762
|
-
*/
|
|
763
|
-
"react/jsx-fragments": "warn",
|
|
764
|
-
"react/jsx-key": "warn",
|
|
765
|
-
"react/jsx-no-comment-textnodes": "warn",
|
|
766
|
-
"react/jsx-no-duplicate-props": "warn",
|
|
767
|
-
/**
|
|
768
|
-
* Prevent problematic leaked values from being rendered.
|
|
769
|
-
*
|
|
770
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
|
|
771
|
-
*/
|
|
772
|
-
"react/jsx-no-leaked-render": "warn",
|
|
773
|
-
/**
|
|
774
|
-
* Prevents usage of unsafe `target='_blank'`.
|
|
775
|
-
*
|
|
776
|
-
* This rule is a part of `react/recommended`, but we've modified it to
|
|
777
|
-
* allow referrer.
|
|
778
|
-
*
|
|
779
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
|
|
780
|
-
*/
|
|
781
|
-
"react/jsx-no-target-blank": [
|
|
782
|
-
"warn",
|
|
783
|
-
{
|
|
784
|
-
allowReferrer: true
|
|
785
|
-
}
|
|
786
|
-
],
|
|
787
|
-
"react/jsx-no-undef": "warn",
|
|
788
|
-
/**
|
|
789
|
-
* Disallow empty React fragments.
|
|
790
|
-
*
|
|
791
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
|
|
792
|
-
*/
|
|
793
|
-
"react/jsx-no-useless-fragment": ["warn", { allowExpressions: true }],
|
|
794
|
-
/**
|
|
795
|
-
* Require the use of PascalCase for user-defined JSX components.
|
|
796
|
-
*
|
|
797
|
-
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
798
|
-
*/
|
|
799
|
-
"react/jsx-pascal-case": "warn",
|
|
800
|
-
"react/jsx-uses-react": "warn",
|
|
801
|
-
"react/jsx-uses-vars": "warn",
|
|
802
|
-
/**
|
|
803
|
-
* Disallow usage of Array index in keys.
|
|
804
|
-
*
|
|
805
|
-
* � Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
806
|
-
*/
|
|
807
|
-
"react/no-array-index-key": "warn",
|
|
808
|
-
"react/no-children-prop": "warn",
|
|
809
|
-
"react/no-danger-with-children": "warn",
|
|
810
|
-
"react/no-deprecated": "warn",
|
|
811
|
-
"react/no-direct-mutation-state": "warn",
|
|
812
|
-
"react/no-find-dom-node": "warn",
|
|
813
|
-
"react/no-is-mounted": "warn",
|
|
814
|
-
"react/no-render-return-value": "warn",
|
|
815
|
-
"react/no-string-refs": "warn",
|
|
816
|
-
"react/no-unescaped-entities": "warn",
|
|
817
|
-
"react/no-unknown-property": "warn",
|
|
818
|
-
"react/no-unsafe": "warn",
|
|
819
|
-
/**
|
|
820
|
-
* Disallow creating unstable components inside components.
|
|
821
|
-
*
|
|
822
|
-
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
|
|
823
|
-
*/
|
|
824
|
-
"react/no-unstable-nested-components": "warn",
|
|
825
|
-
"react/require-render-return": "warn",
|
|
826
|
-
/**
|
|
827
|
-
* Disallow closing tags for components without children.
|
|
828
|
-
*
|
|
829
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
830
|
-
*/
|
|
831
|
-
"react/self-closing-comp": "warn"
|
|
832
|
-
};
|
|
833
|
-
};
|
|
834
|
-
|
|
835
|
-
// src/eslint/react/config.ts
|
|
836
|
-
var reactEslintConfig = (functionStyle, typescript) => {
|
|
837
|
-
return {
|
|
838
|
-
languageOptions: {
|
|
839
|
-
globals: {
|
|
840
|
-
...globals.browser
|
|
841
|
-
},
|
|
842
|
-
parserOptions: {
|
|
843
|
-
ecmaFeatures: {
|
|
844
|
-
jsx: true
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
},
|
|
848
|
-
name: configNames.react,
|
|
849
|
-
plugins: {
|
|
850
|
-
react,
|
|
851
|
-
"react-hooks": pluginReactHooks
|
|
852
|
-
},
|
|
853
|
-
rules: reactRules(functionStyle, typescript),
|
|
854
|
-
settings: {
|
|
855
|
-
react: {
|
|
856
|
-
version: "detect"
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
};
|
|
860
|
-
};
|
|
861
|
-
|
|
862
|
-
// src/eslint/storybook/config.ts
|
|
863
|
-
import storybookPlugin from "eslint-plugin-storybook";
|
|
864
|
-
var storybookConfig = [
|
|
865
|
-
{
|
|
866
|
-
files: [
|
|
867
|
-
"**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)",
|
|
868
|
-
"**/*.story.@(ts|tsx|js|jsx|mjs|cjs)"
|
|
869
|
-
],
|
|
870
|
-
name: configNames.storybook,
|
|
871
|
-
plugins: {
|
|
872
|
-
storybook: storybookPlugin
|
|
873
|
-
},
|
|
874
|
-
rules: {
|
|
875
|
-
"import/no-anonymous-default-export": "off",
|
|
876
|
-
"react-hooks/rules-of-hooks": "off",
|
|
877
|
-
"storybook/await-interactions": "warn",
|
|
878
|
-
"storybook/context-in-play-function": "warn",
|
|
879
|
-
"storybook/csf-component": "warn",
|
|
880
|
-
"storybook/default-exports": "warn",
|
|
881
|
-
"storybook/hierarchy-separator": "warn",
|
|
882
|
-
"storybook/meta-inline-properties": "warn",
|
|
883
|
-
"storybook/no-redundant-story-name": "warn",
|
|
884
|
-
"storybook/prefer-pascal-case": "warn",
|
|
885
|
-
"storybook/story-exports": "warn",
|
|
886
|
-
"storybook/use-storybook-expect": "warn",
|
|
887
|
-
"storybook/use-storybook-testing-library": "warn"
|
|
888
|
-
}
|
|
889
|
-
},
|
|
890
|
-
{
|
|
891
|
-
files: [".storybook/main.@(js|cjs|mjs|ts)"],
|
|
892
|
-
name: configNames.storybookConfig,
|
|
893
|
-
plugins: {
|
|
894
|
-
storybook: storybookPlugin
|
|
895
|
-
},
|
|
896
|
-
rules: {
|
|
897
|
-
"storybook/no-uninstalled-addons": "warn"
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
];
|
|
901
|
-
|
|
902
|
-
// src/eslint/testing/config.ts
|
|
903
|
-
import jest from "eslint-plugin-jest";
|
|
904
|
-
import vitest from "eslint-plugin-vitest";
|
|
905
|
-
|
|
906
|
-
// src/eslint/testing/jest-rules.ts
|
|
907
|
-
var jestRules = (itOrTest = "test") => ({
|
|
908
|
-
"jest/consistent-test-it": [
|
|
909
|
-
"warn",
|
|
910
|
-
{ fn: itOrTest, withinDescribe: itOrTest }
|
|
911
|
-
],
|
|
912
|
-
"jest/expect-expect": "warn",
|
|
913
|
-
"jest/no-commented-out-tests": "warn",
|
|
914
|
-
"jest/no-conditional-expect": "warn",
|
|
915
|
-
"jest/no-conditional-in-test": "warn",
|
|
916
|
-
"jest/no-disabled-tests": "warn",
|
|
917
|
-
"jest/no-duplicate-hooks": "warn",
|
|
918
|
-
"jest/no-focused-tests": "warn",
|
|
919
|
-
"jest/no-identical-title": "warn",
|
|
920
|
-
"jest/no-interpolation-in-snapshots": "warn",
|
|
921
|
-
"jest/no-large-snapshots": ["warn", { inlineMaxSize: 50, maxSize: 100 }],
|
|
922
|
-
"jest/no-mocks-import": "warn",
|
|
923
|
-
// Discourage manually importing from __mocks__
|
|
924
|
-
"jest/no-standalone-expect": "warn",
|
|
925
|
-
"jest/no-test-prefixes": "warn",
|
|
926
|
-
// Prefer .only and .skip over f and x
|
|
927
|
-
"jest/no-test-return-statement": "warn",
|
|
928
|
-
"jest/prefer-comparison-matcher": "warn",
|
|
929
|
-
"jest/prefer-equality-matcher": "warn",
|
|
930
|
-
"jest/prefer-expect-resolves": "warn",
|
|
931
|
-
"jest/prefer-hooks-in-order": "warn",
|
|
932
|
-
"jest/prefer-hooks-on-top": "warn",
|
|
933
|
-
"jest/prefer-lowercase-title": ["warn", { ignoreTopLevelDescribe: true }],
|
|
934
|
-
"jest/prefer-snapshot-hint": "warn",
|
|
935
|
-
"jest/prefer-spy-on": "warn",
|
|
936
|
-
"jest/prefer-strict-equal": "warn",
|
|
937
|
-
"jest/prefer-to-be": "warn",
|
|
938
|
-
"jest/prefer-to-contain": "warn",
|
|
939
|
-
"jest/prefer-to-have-length": "warn",
|
|
940
|
-
"jest/require-top-level-describe": "warn",
|
|
941
|
-
"jest/valid-describe-callback": "warn",
|
|
942
|
-
"jest/valid-expect": "warn",
|
|
943
|
-
"jest/valid-expect-in-promise": "warn",
|
|
944
|
-
"jest/valid-title": "warn"
|
|
945
|
-
});
|
|
946
|
-
|
|
947
|
-
// src/eslint/testing/vitest-rules.ts
|
|
948
|
-
var vitestRules = (itOrTest = "test") => ({
|
|
949
|
-
"vitest/consistent-test-it": [
|
|
950
|
-
"warn",
|
|
951
|
-
{ fn: itOrTest, withinDescribe: itOrTest }
|
|
952
|
-
],
|
|
953
|
-
"vitest/expect-expect": "warn",
|
|
954
|
-
"vitest/no-commented-out-tests": "warn",
|
|
955
|
-
"vitest/no-conditional-in-test": "warn",
|
|
956
|
-
"vitest/no-disabled-tests": "warn",
|
|
957
|
-
"vitest/no-duplicate-hooks": "warn",
|
|
958
|
-
"vitest/no-focused-tests": "warn",
|
|
959
|
-
"vitest/no-identical-title": "warn",
|
|
960
|
-
"vitest/no-import-node-test": "warn",
|
|
961
|
-
"vitest/no-interpolation-in-snapshots": "warn",
|
|
962
|
-
// Avoid dynamic snapshots
|
|
963
|
-
"vitest/no-large-snapshots": ["warn", { inlineMaxSize: 50, maxSize: 100 }],
|
|
964
|
-
// Keep snapshots manageable
|
|
965
|
-
"vitest/no-standalone-expect": "warn",
|
|
966
|
-
"vitest/no-test-return-statement": "warn",
|
|
967
|
-
// Tests shouldn't return values
|
|
968
|
-
"vitest/prefer-comparison-matcher": "warn",
|
|
969
|
-
// Use comparison matchers
|
|
970
|
-
"vitest/prefer-equality-matcher": "warn",
|
|
971
|
-
// Use equality matchers
|
|
972
|
-
"vitest/prefer-hooks-in-order": "warn",
|
|
973
|
-
// Keep hooks in a predictable order
|
|
974
|
-
"vitest/prefer-hooks-on-top": "warn",
|
|
975
|
-
// Keep hooks organized
|
|
976
|
-
"vitest/prefer-lowercase-title": ["warn", { ignoreTopLevelDescribe: true }],
|
|
977
|
-
// Consistent casing
|
|
978
|
-
"vitest/prefer-strict-equal": "warn",
|
|
979
|
-
// Prefer .toStrictEqual() over .toEqual()
|
|
980
|
-
"vitest/prefer-to-be": "warn",
|
|
981
|
-
// Use .toBe() for primitives
|
|
982
|
-
"vitest/prefer-to-contain": "warn",
|
|
983
|
-
// Use .toContain() for array/string includes
|
|
984
|
-
"vitest/prefer-to-have-length": "warn",
|
|
985
|
-
// Use .toHaveLength() for checking length
|
|
986
|
-
"vitest/require-local-test-context-for-concurrent-snapshots": "warn",
|
|
987
|
-
"vitest/require-top-level-describe": "warn",
|
|
988
|
-
// Group tests in describe blocks
|
|
989
|
-
"vitest/valid-describe-callback": "warn",
|
|
990
|
-
"vitest/valid-expect": "warn",
|
|
991
|
-
"vitest/valid-title": "warn"
|
|
992
|
-
});
|
|
993
|
-
|
|
994
|
-
// src/eslint/testing/config.ts
|
|
995
|
-
var testingConfig = ({
|
|
996
|
-
filenamePattern,
|
|
997
|
-
files,
|
|
998
|
-
formattingRules,
|
|
999
|
-
framework,
|
|
1000
|
-
itOrTest
|
|
1001
|
-
} = {
|
|
1002
|
-
filenamePattern: "test",
|
|
1003
|
-
formattingRules: true,
|
|
1004
|
-
framework: "vitest",
|
|
1005
|
-
itOrTest: "test"
|
|
1006
|
-
}) => ({
|
|
1007
|
-
files: files ?? ["**/*.{test,spec}.{ts,tsx,js,jsx}"],
|
|
1008
|
-
languageOptions: {
|
|
1009
|
-
globals: framework === "vitest" ? { ...vitest.environments.env.globals } : jest.environments.globals.globals
|
|
1010
|
-
},
|
|
1011
|
-
name: configNames.testing,
|
|
1012
|
-
plugins: {
|
|
1013
|
-
jest,
|
|
1014
|
-
vitest
|
|
1015
|
-
},
|
|
1016
|
-
rules: {
|
|
1017
|
-
// jest doesn't have a file name rule, so we'll use this one for both
|
|
1018
|
-
"@typescript-eslint/unbound-method": "off",
|
|
1019
|
-
"vitest/consistent-test-filename": [
|
|
1020
|
-
"warn",
|
|
1021
|
-
{
|
|
1022
|
-
allTestPattern: ".*\\.(test|spec)\\.[tj]sx?$",
|
|
1023
|
-
pattern: `.*\\.${filenamePattern}\\.[tj]sx?$`
|
|
1024
|
-
}
|
|
1025
|
-
],
|
|
1026
|
-
...framework === "vitest" ? vitestRules(itOrTest) : jestRules(itOrTest),
|
|
1027
|
-
...formattingRules ? {
|
|
1028
|
-
"jest/padding-around-after-all-blocks": "warn",
|
|
1029
|
-
"jest/padding-around-after-each-blocks": "warn",
|
|
1030
|
-
"jest/padding-around-before-all-blocks": "warn",
|
|
1031
|
-
"jest/padding-around-before-each-blocks": "warn",
|
|
1032
|
-
"jest/padding-around-describe-blocks": "warn",
|
|
1033
|
-
"jest/padding-around-expect-groups": "warn",
|
|
1034
|
-
"jest/padding-around-test-blocks": "warn"
|
|
1035
|
-
} : {}
|
|
1036
|
-
},
|
|
1037
|
-
...framework !== "jest" && framework !== "vitest" ? {
|
|
1038
|
-
settings: {
|
|
1039
|
-
jest: {
|
|
1040
|
-
globalPackage: framework === "node" ? "node:test" : "bun:test"
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
} : {}
|
|
1044
|
-
});
|
|
1045
|
-
|
|
1046
|
-
// src/eslint/turbo/config.ts
|
|
1047
|
-
import turbo from "eslint-plugin-turbo";
|
|
1048
|
-
var turboConfig = () => ({
|
|
1049
|
-
name: configNames.turbo,
|
|
1050
|
-
plugins: {
|
|
1051
|
-
turbo
|
|
1052
|
-
},
|
|
1053
|
-
rules: {
|
|
1054
|
-
"turbo/no-undeclared-env-vars": "warn"
|
|
1055
|
-
}
|
|
1056
|
-
});
|
|
1057
|
-
|
|
1058
|
-
// src/eslint/typescript/config.ts
|
|
1059
|
-
import tseslint from "typescript-eslint";
|
|
1060
|
-
|
|
1061
|
-
// src/eslint/typescript/rules.ts
|
|
1062
|
-
var tseslintRules = {
|
|
1063
|
-
"@typescript-eslint/adjacent-overload-signatures": "warn",
|
|
1064
|
-
"@typescript-eslint/array-type": "warn",
|
|
1065
|
-
"@typescript-eslint/await-thenable": "warn",
|
|
1066
|
-
"@typescript-eslint/ban-ts-comment": [
|
|
1067
|
-
"warn",
|
|
1068
|
-
{ minimumDescriptionLength: 10 }
|
|
1069
|
-
],
|
|
1070
|
-
"@typescript-eslint/ban-tslint-comment": "warn",
|
|
1071
|
-
"@typescript-eslint/class-literal-property-style": "warn",
|
|
1072
|
-
"@typescript-eslint/consistent-generic-constructors": "warn",
|
|
1073
|
-
"@typescript-eslint/consistent-indexed-object-style": "warn",
|
|
1074
|
-
"@typescript-eslint/consistent-type-assertions": "warn",
|
|
1075
|
-
"@typescript-eslint/consistent-type-definitions": "warn",
|
|
1076
|
-
"@typescript-eslint/consistent-type-exports": [
|
|
1077
|
-
"warn",
|
|
1078
|
-
{ fixMixedExportsWithInlineTypeSpecifier: true }
|
|
1079
|
-
],
|
|
1080
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
1081
|
-
"warn",
|
|
1082
|
-
{
|
|
1083
|
-
fixStyle: "inline-type-imports",
|
|
1084
|
-
prefer: "type-imports"
|
|
1085
|
-
}
|
|
1086
|
-
],
|
|
1087
|
-
"@typescript-eslint/dot-notation": "warn",
|
|
1088
|
-
"@typescript-eslint/no-array-constructor": "warn",
|
|
1089
|
-
"@typescript-eslint/no-array-delete": "warn",
|
|
1090
|
-
"@typescript-eslint/no-base-to-string": "warn",
|
|
1091
|
-
"@typescript-eslint/no-confusing-non-null-assertion": "warn",
|
|
1092
|
-
"@typescript-eslint/no-confusing-void-expression": "warn",
|
|
1093
|
-
"@typescript-eslint/no-deprecated": "warn",
|
|
1094
|
-
"@typescript-eslint/no-duplicate-enum-values": "warn",
|
|
1095
|
-
"@typescript-eslint/no-duplicate-type-constituents": "warn",
|
|
1096
|
-
"@typescript-eslint/no-dynamic-delete": "warn",
|
|
1097
|
-
"@typescript-eslint/no-empty-function": "warn",
|
|
1098
|
-
"@typescript-eslint/no-empty-object-type": "warn",
|
|
1099
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
1100
|
-
"@typescript-eslint/no-extra-non-null-assertion": "warn",
|
|
1101
|
-
"@typescript-eslint/no-extraneous-class": "warn",
|
|
1102
|
-
"@typescript-eslint/no-floating-promises": "warn",
|
|
1103
|
-
"@typescript-eslint/no-for-in-array": "warn",
|
|
1104
|
-
"@typescript-eslint/no-implied-eval": "warn",
|
|
1105
|
-
"@typescript-eslint/no-import-type-side-effects": "warn",
|
|
1106
|
-
"@typescript-eslint/no-inferrable-types": "warn",
|
|
1107
|
-
"@typescript-eslint/no-invalid-void-type": "warn",
|
|
1108
|
-
"@typescript-eslint/no-meaningless-void-operator": "warn",
|
|
1109
|
-
"@typescript-eslint/no-misused-new": "warn",
|
|
1110
|
-
"@typescript-eslint/no-misused-promises": "warn",
|
|
1111
|
-
"@typescript-eslint/no-mixed-enums": "warn",
|
|
1112
|
-
"@typescript-eslint/no-namespace": "warn",
|
|
1113
|
-
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "warn",
|
|
1114
|
-
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
|
|
1115
|
-
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
1116
|
-
"@typescript-eslint/no-redundant-type-constituents": "warn",
|
|
1117
|
-
"@typescript-eslint/no-require-imports": "warn",
|
|
1118
|
-
"@typescript-eslint/no-this-alias": "warn",
|
|
1119
|
-
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
|
|
1120
|
-
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
1121
|
-
"@typescript-eslint/no-unnecessary-template-expression": "warn",
|
|
1122
|
-
"@typescript-eslint/no-unnecessary-type-arguments": "warn",
|
|
1123
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
|
|
1124
|
-
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
|
|
1125
|
-
"@typescript-eslint/no-unnecessary-type-parameters": "warn",
|
|
1126
|
-
"@typescript-eslint/no-unsafe-declaration-merging": "warn",
|
|
1127
|
-
"@typescript-eslint/no-unsafe-enum-comparison": "warn",
|
|
1128
|
-
"@typescript-eslint/no-unsafe-function-type": "warn",
|
|
1129
|
-
"@typescript-eslint/no-unsafe-unary-minus": "warn",
|
|
1130
|
-
"@typescript-eslint/no-unused-expressions": "warn",
|
|
1131
|
-
"@typescript-eslint/no-unused-vars": [
|
|
1132
|
-
"warn",
|
|
1133
|
-
{
|
|
1134
|
-
args: "after-used",
|
|
1135
|
-
argsIgnorePattern: "^_",
|
|
1136
|
-
ignoreRestSiblings: false,
|
|
1137
|
-
vars: "all",
|
|
1138
|
-
varsIgnorePattern: "^_"
|
|
1139
|
-
}
|
|
1140
|
-
],
|
|
1141
|
-
"@typescript-eslint/no-useless-constructor": "warn",
|
|
1142
|
-
"@typescript-eslint/no-wrapper-object-types": "warn",
|
|
1143
|
-
// TODO: Investiate non-null vs type-cast rules
|
|
1144
|
-
"@typescript-eslint/non-nullable-type-assertion-style": "off",
|
|
1145
|
-
"@typescript-eslint/only-throw-error": "warn",
|
|
1146
|
-
"@typescript-eslint/prefer-as-const": "warn",
|
|
1147
|
-
"@typescript-eslint/prefer-find": "warn",
|
|
1148
|
-
"@typescript-eslint/prefer-for-of": "warn",
|
|
1149
|
-
"@typescript-eslint/prefer-function-type": "warn",
|
|
1150
|
-
"@typescript-eslint/prefer-includes": "warn",
|
|
1151
|
-
"@typescript-eslint/prefer-literal-enum-member": "warn",
|
|
1152
|
-
"@typescript-eslint/prefer-namespace-keyword": "warn",
|
|
1153
|
-
"@typescript-eslint/prefer-nullish-coalescing": "warn",
|
|
1154
|
-
"@typescript-eslint/prefer-optional-chain": "warn",
|
|
1155
|
-
"@typescript-eslint/prefer-promise-reject-errors": "warn",
|
|
1156
|
-
"@typescript-eslint/prefer-reduce-type-parameter": "warn",
|
|
1157
|
-
"@typescript-eslint/prefer-regexp-exec": "warn",
|
|
1158
|
-
"@typescript-eslint/prefer-return-this-type": "warn",
|
|
1159
|
-
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
|
|
1160
|
-
"@typescript-eslint/related-getter-setter-pairs": "warn",
|
|
1161
|
-
"@typescript-eslint/require-await": "warn",
|
|
1162
|
-
"@typescript-eslint/restrict-plus-operands": [
|
|
1163
|
-
"warn",
|
|
1164
|
-
{
|
|
1165
|
-
allowAny: false,
|
|
1166
|
-
allowBoolean: false,
|
|
1167
|
-
allowNullish: false,
|
|
1168
|
-
allowNumberAndString: false,
|
|
1169
|
-
allowRegExp: false
|
|
1170
|
-
}
|
|
1171
|
-
],
|
|
1172
|
-
"@typescript-eslint/restrict-template-expressions": [
|
|
1173
|
-
"warn",
|
|
1174
|
-
{
|
|
1175
|
-
allow: [{ from: "lib", name: ["Error", "URL", "URLSearchParams"] }],
|
|
1176
|
-
allowAny: true,
|
|
1177
|
-
allowBoolean: true,
|
|
1178
|
-
allowNullish: true,
|
|
1179
|
-
allowNumber: true,
|
|
1180
|
-
allowRegExp: true
|
|
1181
|
-
}
|
|
1182
|
-
],
|
|
1183
|
-
"@typescript-eslint/return-await": [
|
|
1184
|
-
"warn",
|
|
1185
|
-
"error-handling-correctness-only"
|
|
1186
|
-
],
|
|
1187
|
-
"@typescript-eslint/triple-slash-reference": "warn",
|
|
1188
|
-
"@typescript-eslint/unbound-method": "warn",
|
|
1189
|
-
"@typescript-eslint/unified-signatures": "warn",
|
|
1190
|
-
"@typescript-eslint/use-unknown-in-catch-callback-variable": "warn"
|
|
1191
|
-
};
|
|
1192
|
-
|
|
1193
|
-
// src/eslint/typescript/config.ts
|
|
1194
|
-
var tseslintConfig = (tsconfigPath) => {
|
|
1195
|
-
const userCwd = process.cwd();
|
|
1196
|
-
return tseslint.config(
|
|
1197
|
-
{
|
|
1198
|
-
files: ["**/*.{js,cjs,mjs,ts,jsx,tsx}"],
|
|
1199
|
-
languageOptions: {
|
|
1200
|
-
parser: tseslint.parser,
|
|
1201
|
-
parserOptions: {
|
|
1202
|
-
...tsconfigPath ? { project: tsconfigPath, tsconfigRootDir: userCwd } : { projectService: true, tsconfigRootDir: import.meta.dirname }
|
|
1203
|
-
}
|
|
1204
|
-
},
|
|
1205
|
-
name: configNames.typescript,
|
|
1206
|
-
plugins: {
|
|
1207
|
-
"@typescript-eslint": tseslint.plugin
|
|
1208
|
-
},
|
|
1209
|
-
rules: tseslintRules
|
|
1210
|
-
},
|
|
1211
|
-
{
|
|
1212
|
-
// disable type-aware linting on JS files
|
|
1213
|
-
extends: [tseslint.configs.disableTypeChecked],
|
|
1214
|
-
files: ["**/*.js"]
|
|
1215
|
-
}
|
|
1216
|
-
);
|
|
1217
|
-
};
|
|
1218
|
-
|
|
1219
|
-
// src/eslint/unicorn/config.ts
|
|
1220
|
-
import unicorn from "eslint-plugin-unicorn";
|
|
1221
|
-
|
|
1222
|
-
// src/eslint/unicorn/rules.ts
|
|
1223
|
-
var rules = {
|
|
1224
|
-
/**
|
|
1225
|
-
* Enforce better string content.
|
|
1226
|
-
*
|
|
1227
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-regex.md
|
|
1228
|
-
*/
|
|
1229
|
-
"unicorn/better-regex": "warn",
|
|
1230
|
-
/**
|
|
1231
|
-
* Enforce passing a message value when creating a built-in error.
|
|
1232
|
-
*
|
|
1233
|
-
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/error-message.md
|
|
1234
|
-
*/
|
|
1235
|
-
"unicorn/error-message": "warn",
|
|
1236
|
-
/**
|
|
1237
|
-
* Require consistent filename case for all linted files.
|
|
1238
|
-
*
|
|
1239
|
-
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
|
|
1240
|
-
*/
|
|
1241
|
-
"unicorn/filename-case": [
|
|
1242
|
-
"warn",
|
|
1243
|
-
{
|
|
1244
|
-
case: "kebabCase"
|
|
1245
|
-
}
|
|
1246
|
-
],
|
|
1247
|
-
/**
|
|
1248
|
-
* Enforce the use of new for all builtins, except String, Number, Boolean, Symbol and BigInt.
|
|
1249
|
-
*
|
|
1250
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/new-for-builtins.md
|
|
1251
|
-
*/
|
|
1252
|
-
"unicorn/new-for-builtins": "warn",
|
|
1253
|
-
"unicorn/no-console-spaces": "warn",
|
|
1254
|
-
/**
|
|
1255
|
-
* Enforce using for-loop instead of while-loop.
|
|
1256
|
-
*
|
|
1257
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-for-loop.md
|
|
1258
|
-
*/
|
|
1259
|
-
"unicorn/no-for-loop": "warn",
|
|
1260
|
-
/**
|
|
1261
|
-
* Enforce the use of addEventListener and removeEventListener over on-functions.
|
|
1262
|
-
*
|
|
1263
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-add-event-listener.md
|
|
1264
|
-
*/
|
|
1265
|
-
"unicorn/prefer-add-event-listener": "warn",
|
|
1266
|
-
/**
|
|
1267
|
-
* Require using the `node:` protocol when importing Node.js built-in modules.
|
|
1268
|
-
*
|
|
1269
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
1270
|
-
*/
|
|
1271
|
-
"unicorn/prefer-node-protocol": "warn",
|
|
1272
|
-
/**
|
|
1273
|
-
* Prefer String#replaceAll() over String#replace() with a global regExp.
|
|
1274
|
-
*
|
|
1275
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-replace-all.md
|
|
1276
|
-
*/
|
|
1277
|
-
"unicorn/prefer-string-replace-all": "warn",
|
|
1278
|
-
/**
|
|
1279
|
-
* Enforce throwing TypeError in type checking conditions.
|
|
1280
|
-
*
|
|
1281
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-type-error.md
|
|
1282
|
-
*/
|
|
1283
|
-
"unicorn/prefer-type-error": "warn",
|
|
1284
|
-
/**
|
|
1285
|
-
* Enforce consistent brace style for case clauses.
|
|
1286
|
-
*
|
|
1287
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/switch-case-braces.md
|
|
1288
|
-
*/
|
|
1289
|
-
"unicorn/switch-case-braces": ["warn", "always"],
|
|
1290
|
-
/**
|
|
1291
|
-
* Enforce consistent case for text encoding identifiers.
|
|
1292
|
-
*
|
|
1293
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/text-encoding-identifier-case.md
|
|
1294
|
-
*/
|
|
1295
|
-
"unicorn/text-encoding-identifier-case": "warn"
|
|
1296
|
-
};
|
|
1297
|
-
|
|
1298
|
-
// src/eslint/unicorn/config.ts
|
|
1299
|
-
var unicornConfig = {
|
|
1300
|
-
name: configNames.unicorn,
|
|
1301
|
-
plugins: {
|
|
1302
|
-
unicorn
|
|
1303
|
-
},
|
|
1304
|
-
rules
|
|
1305
|
-
};
|
|
1306
|
-
|
|
1307
|
-
// src/eslint/index.ts
|
|
1308
|
-
var eslintConfig = ({
|
|
1309
|
-
functionStyle = "arrow",
|
|
1310
|
-
ignores = [],
|
|
1311
|
-
jsdoc: jsdoc2 = { requireJsdoc: false },
|
|
1312
|
-
react: react2 = false,
|
|
1313
|
-
sorting = true,
|
|
1314
|
-
storybook = false,
|
|
1315
|
-
testing,
|
|
1316
|
-
/**
|
|
1317
|
-
* Some preceding documentation...
|
|
1318
|
-
*
|
|
1319
|
-
* @param options.turbo - Whether to include Turborepo rules. Defaults to false.
|
|
1320
|
-
*
|
|
1321
|
-
* Some following documentation...
|
|
1322
|
-
*/
|
|
1323
|
-
turbo: turbo2 = false,
|
|
1324
|
-
typescript = true,
|
|
1325
|
-
unicorn: unicorn2 = true
|
|
1326
|
-
} = {}, ...additionalConfigs) => {
|
|
1327
|
-
const configs = [
|
|
1328
|
-
ignoresConfig({
|
|
1329
|
-
next: isObject(react2) && (react2.framework === "next" || react2.next === true),
|
|
1330
|
-
storybook,
|
|
1331
|
-
userIgnores: ignores
|
|
1332
|
-
}),
|
|
1333
|
-
baseEslintConfig(functionStyle)
|
|
1334
|
-
];
|
|
1335
|
-
if (jsdoc2 !== false) {
|
|
1336
|
-
configs.push(jsdocConfig(jsdoc2.requireJsdoc ?? false));
|
|
1337
|
-
}
|
|
1338
|
-
if (typescript) {
|
|
1339
|
-
configs.push(
|
|
1340
|
-
...tseslintConfig(
|
|
1341
|
-
isString(typescript) ? typescript : void 0
|
|
1342
|
-
)
|
|
1343
|
-
);
|
|
1344
|
-
}
|
|
1345
|
-
if (react2) {
|
|
1346
|
-
configs.push(reactEslintConfig(functionStyle, Boolean(typescript)));
|
|
1347
|
-
const shouldUseReactCompiler = react2 === true || isObject(react2) && react2.reactCompiler !== false;
|
|
1348
|
-
if (shouldUseReactCompiler) {
|
|
1349
|
-
configs.push(reactCompilerEslintConfig);
|
|
1350
|
-
}
|
|
1351
|
-
const isNextFramework = isObject(react2) && (react2.framework === "next" || react2.next === true && react2.framework === void 0);
|
|
1352
|
-
if (isNextFramework) {
|
|
1353
|
-
configs.push(nextjsConfig());
|
|
1354
|
-
}
|
|
1355
|
-
const shouldUseReactRefresh = (
|
|
1356
|
-
// Explicit setting takes precedence
|
|
1357
|
-
isObject(react2) && react2.reactRefresh === true || // Framework-based default (vite/none use reactRefresh by default)
|
|
1358
|
-
isObject(react2) && (react2.framework === "vite" || react2.framework === "none") && react2.reactRefresh !== false
|
|
1359
|
-
);
|
|
1360
|
-
if (shouldUseReactRefresh) {
|
|
1361
|
-
configs.push(reactRefreshEslintConfig());
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
if (testing !== false) {
|
|
1365
|
-
const defaultTestingConfig = {
|
|
1366
|
-
filenamePattern: "test",
|
|
1367
|
-
files: ["**/*.{test,spec}.{ts,tsx,js,jsx}"],
|
|
1368
|
-
formattingRules: true,
|
|
1369
|
-
framework: "vitest",
|
|
1370
|
-
itOrTest: "it"
|
|
1371
|
-
};
|
|
1372
|
-
const mergedTestingConfig = {
|
|
1373
|
-
...defaultTestingConfig,
|
|
1374
|
-
...isObject(testing) ? testing : {}
|
|
1375
|
-
};
|
|
1376
|
-
const { filenamePattern, files, formattingRules, framework, itOrTest } = mergedTestingConfig;
|
|
1377
|
-
configs.push(
|
|
1378
|
-
testingConfig({
|
|
1379
|
-
filenamePattern,
|
|
1380
|
-
files,
|
|
1381
|
-
formattingRules,
|
|
1382
|
-
framework,
|
|
1383
|
-
itOrTest
|
|
1384
|
-
})
|
|
1385
|
-
);
|
|
1386
|
-
}
|
|
1387
|
-
if (sorting) {
|
|
1388
|
-
configs.push(perfectionistConfig);
|
|
1389
|
-
}
|
|
1390
|
-
if (unicorn2) {
|
|
1391
|
-
configs.push(unicornConfig);
|
|
1392
|
-
}
|
|
1393
|
-
if (functionStyle === "arrow") {
|
|
1394
|
-
configs.push(preferArrowFunctionConfig());
|
|
1395
|
-
}
|
|
1396
|
-
if (storybook) {
|
|
1397
|
-
configs.push(...storybookConfig);
|
|
1398
|
-
}
|
|
1399
|
-
if (turbo2) {
|
|
1400
|
-
configs.push(turboConfig());
|
|
1401
|
-
}
|
|
1402
|
-
if (additionalConfigs.length > 0) {
|
|
1403
|
-
configs.push(...additionalConfigs);
|
|
1404
|
-
}
|
|
1405
|
-
return configs;
|
|
1406
|
-
};
|
|
1407
|
-
export {
|
|
1408
|
-
eslintConfig
|
|
1409
|
-
};
|
|
1410
|
-
//# sourceMappingURL=index.js.map
|