@will-stone/ox-config 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.mjs +1421 -0
- package/package.json +72 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1421 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { defineConfig } from "oxfmt";
|
|
3
|
+
import restrictedGlobals from "confusing-browser-globals";
|
|
4
|
+
//#region src/oxfmt.ts
|
|
5
|
+
const oxfmtConfig = (options) => defineConfig({
|
|
6
|
+
/**
|
|
7
|
+
* Wraps prose if it exceeds the print width.
|
|
8
|
+
* @see https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html#prosewrap
|
|
9
|
+
*
|
|
10
|
+
* - This improves the reading experience of markdown files in the editor.
|
|
11
|
+
*/
|
|
12
|
+
proseWrap: "always",
|
|
13
|
+
/**
|
|
14
|
+
* Only add semicolons at the beginning of lines that may introduce ASI failures.
|
|
15
|
+
* @see https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html#semi
|
|
16
|
+
*
|
|
17
|
+
* - Helps keep git diff noise lower.
|
|
18
|
+
* - Less to type. If you're not typing them but letting the formatter add them,
|
|
19
|
+
* then you probably don't need them.
|
|
20
|
+
* - Semicolons allow for multiple statements on one line which could impact readability.
|
|
21
|
+
*/
|
|
22
|
+
semi: false,
|
|
23
|
+
/**
|
|
24
|
+
* No need to hold shift to insert a quote!
|
|
25
|
+
*/
|
|
26
|
+
singleQuote: true,
|
|
27
|
+
/**
|
|
28
|
+
* Sort import statements.
|
|
29
|
+
* @see https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html#sortimports
|
|
30
|
+
*/
|
|
31
|
+
sortImports: { groups: [
|
|
32
|
+
["side_effect", "side_effect_style"],
|
|
33
|
+
"type-import",
|
|
34
|
+
["value-builtin", "value-external"],
|
|
35
|
+
"type-internal",
|
|
36
|
+
"value-internal",
|
|
37
|
+
[
|
|
38
|
+
"type-parent",
|
|
39
|
+
"type-sibling",
|
|
40
|
+
"type-index"
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
"value-parent",
|
|
44
|
+
"value-sibling",
|
|
45
|
+
"value-index"
|
|
46
|
+
],
|
|
47
|
+
"unknown"
|
|
48
|
+
] },
|
|
49
|
+
...options?.tailwindcss ? {
|
|
50
|
+
/**
|
|
51
|
+
* Sort Tailwind CSS classes.
|
|
52
|
+
* @see https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html#sorttailwindcss
|
|
53
|
+
*/
|
|
54
|
+
sortTailwindcss: {
|
|
55
|
+
config: typeof options.tailwindcss === "object" ? options.tailwindcss.config : void 0,
|
|
56
|
+
functions: ["clsx"]
|
|
57
|
+
} } : {}
|
|
58
|
+
});
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/oxlint/model.ts
|
|
61
|
+
const emptyOxlintConfig = {
|
|
62
|
+
categories: {},
|
|
63
|
+
env: {},
|
|
64
|
+
globals: {},
|
|
65
|
+
ignorePatterns: [],
|
|
66
|
+
jsPlugins: [],
|
|
67
|
+
options: {},
|
|
68
|
+
overrides: [],
|
|
69
|
+
plugins: [],
|
|
70
|
+
rules: {},
|
|
71
|
+
settings: {}
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/oxlint/config.base.ts
|
|
75
|
+
const baseConfig = () => {
|
|
76
|
+
return {
|
|
77
|
+
...emptyOxlintConfig,
|
|
78
|
+
categories: { correctness: "off" },
|
|
79
|
+
env: {
|
|
80
|
+
browser: true,
|
|
81
|
+
builtin: true,
|
|
82
|
+
node: true
|
|
83
|
+
},
|
|
84
|
+
rules: {
|
|
85
|
+
"accessor-pairs": "error",
|
|
86
|
+
"array-callback-return": ["error", { allowImplicit: true }],
|
|
87
|
+
"arrow-body-style": "off",
|
|
88
|
+
"block-scoped-var": "error",
|
|
89
|
+
"capitalized-comments": "off",
|
|
90
|
+
"class-methods-use-this": "off",
|
|
91
|
+
complexity: "off",
|
|
92
|
+
"constructor-super": "error",
|
|
93
|
+
curly: "off",
|
|
94
|
+
"default-case": "error",
|
|
95
|
+
"default-case-last": "error",
|
|
96
|
+
"default-param-last": "error",
|
|
97
|
+
eqeqeq: "error",
|
|
98
|
+
"for-direction": "error",
|
|
99
|
+
"func-name-matching": "error",
|
|
100
|
+
"func-names": ["error", "as-needed"],
|
|
101
|
+
"func-style": [
|
|
102
|
+
"error",
|
|
103
|
+
"declaration",
|
|
104
|
+
{ allowArrowFunctions: true }
|
|
105
|
+
],
|
|
106
|
+
"getter-return": "error",
|
|
107
|
+
"grouped-accessor-pairs": "error",
|
|
108
|
+
"guard-for-in": "error",
|
|
109
|
+
"id-length": "off",
|
|
110
|
+
"id-match": "off",
|
|
111
|
+
"init-declarations": "off",
|
|
112
|
+
"logical-assignment-operators": "off",
|
|
113
|
+
"max-classes-per-file": "off",
|
|
114
|
+
"max-depth": "off",
|
|
115
|
+
"max-lines": "off",
|
|
116
|
+
"max-lines-per-function": "off",
|
|
117
|
+
"max-nested-callbacks": "error",
|
|
118
|
+
"max-params": "off",
|
|
119
|
+
"max-statements": "off",
|
|
120
|
+
"new-cap": ["error", { capIsNewExceptions: [
|
|
121
|
+
"After",
|
|
122
|
+
"AfterAll",
|
|
123
|
+
"AfterStep",
|
|
124
|
+
"Before",
|
|
125
|
+
"BeforeAll",
|
|
126
|
+
"BeforeStep",
|
|
127
|
+
"DataTable",
|
|
128
|
+
"Given",
|
|
129
|
+
"Then",
|
|
130
|
+
"When",
|
|
131
|
+
"World"
|
|
132
|
+
] }],
|
|
133
|
+
"no-alert": "error",
|
|
134
|
+
"no-array-constructor": "warn",
|
|
135
|
+
"no-async-promise-executor": "error",
|
|
136
|
+
"no-await-in-loop": "error",
|
|
137
|
+
"no-bitwise": "error",
|
|
138
|
+
"no-caller": "error",
|
|
139
|
+
"no-case-declarations": "error",
|
|
140
|
+
"no-class-assign": "error",
|
|
141
|
+
"no-compare-neg-zero": "error",
|
|
142
|
+
"no-cond-assign": "error",
|
|
143
|
+
"no-console": "error",
|
|
144
|
+
"no-const-assign": "error",
|
|
145
|
+
"no-constant-binary-expression": "error",
|
|
146
|
+
"no-constant-condition": "error",
|
|
147
|
+
"no-constructor-return": "error",
|
|
148
|
+
"no-continue": "error",
|
|
149
|
+
"no-control-regex": "error",
|
|
150
|
+
"no-debugger": "error",
|
|
151
|
+
"no-delete-var": "error",
|
|
152
|
+
"no-div-regex": "warn",
|
|
153
|
+
"no-dupe-class-members": "error",
|
|
154
|
+
"no-dupe-else-if": "error",
|
|
155
|
+
"no-dupe-keys": "error",
|
|
156
|
+
"no-duplicate-case": "error",
|
|
157
|
+
"no-duplicate-imports": "off",
|
|
158
|
+
"no-else-return": "error",
|
|
159
|
+
"no-empty": "error",
|
|
160
|
+
"no-empty-character-class": "error",
|
|
161
|
+
"no-empty-function": "error",
|
|
162
|
+
"no-empty-pattern": "error",
|
|
163
|
+
"no-empty-static-block": "error",
|
|
164
|
+
"no-eq-null": "error",
|
|
165
|
+
"no-eval": "error",
|
|
166
|
+
"no-ex-assign": "error",
|
|
167
|
+
"no-extend-native": "error",
|
|
168
|
+
"no-extra-bind": "error",
|
|
169
|
+
"no-extra-boolean-cast": "error",
|
|
170
|
+
"no-extra-label": "warn",
|
|
171
|
+
"no-fallthrough": ["error", { allowEmptyCase: true }],
|
|
172
|
+
"no-func-assign": "error",
|
|
173
|
+
"no-global-assign": "error",
|
|
174
|
+
"no-implicit-coercion": "warn",
|
|
175
|
+
"no-implicit-globals": "error",
|
|
176
|
+
"no-implied-eval": "error",
|
|
177
|
+
"no-import-assign": "error",
|
|
178
|
+
"no-inline-comments": "error",
|
|
179
|
+
"no-inner-declarations": "error",
|
|
180
|
+
"no-invalid-regexp": "error",
|
|
181
|
+
"no-irregular-whitespace": "error",
|
|
182
|
+
"no-iterator": "error",
|
|
183
|
+
"no-label-var": "error",
|
|
184
|
+
"no-labels": "error",
|
|
185
|
+
"no-lone-blocks": "error",
|
|
186
|
+
"no-lonely-if": "error",
|
|
187
|
+
"no-loop-func": "error",
|
|
188
|
+
"no-loss-of-precision": "error",
|
|
189
|
+
"no-magic-numbers": "off",
|
|
190
|
+
"no-misleading-character-class": "error",
|
|
191
|
+
"no-multi-assign": "error",
|
|
192
|
+
"no-multi-str": "error",
|
|
193
|
+
"no-negated-condition": "off",
|
|
194
|
+
"no-nested-ternary": "off",
|
|
195
|
+
"no-new": "error",
|
|
196
|
+
"no-new-func": "error",
|
|
197
|
+
"no-new-native-nonconstructor": "error",
|
|
198
|
+
"no-new-wrappers": "warn",
|
|
199
|
+
"no-nonoctal-decimal-escape": "error",
|
|
200
|
+
"no-obj-calls": "error",
|
|
201
|
+
"no-object-constructor": "error",
|
|
202
|
+
"no-param-reassign": "error",
|
|
203
|
+
"no-plusplus": "error",
|
|
204
|
+
"no-promise-executor-return": "error",
|
|
205
|
+
"no-proto": "error",
|
|
206
|
+
"no-prototype-builtins": "error",
|
|
207
|
+
"no-redeclare": "error",
|
|
208
|
+
"no-regex-spaces": "warn",
|
|
209
|
+
"no-restricted-exports": "off",
|
|
210
|
+
"no-restricted-globals": ["error", ...restrictedGlobals],
|
|
211
|
+
"no-restricted-imports": "off",
|
|
212
|
+
"no-restricted-properties": "off",
|
|
213
|
+
"no-return-assign": "error",
|
|
214
|
+
"no-script-url": "error",
|
|
215
|
+
"no-self-assign": "error",
|
|
216
|
+
"no-self-compare": "error",
|
|
217
|
+
"no-sequences": "error",
|
|
218
|
+
"no-setter-return": "error",
|
|
219
|
+
"no-shadow": "error",
|
|
220
|
+
"no-shadow-restricted-names": "error",
|
|
221
|
+
"no-sparse-arrays": "error",
|
|
222
|
+
"no-template-curly-in-string": "error",
|
|
223
|
+
"no-ternary": "off",
|
|
224
|
+
"no-this-before-super": "error",
|
|
225
|
+
"no-throw-literal": "error",
|
|
226
|
+
"no-unassigned-vars": "error",
|
|
227
|
+
"no-undef": "error",
|
|
228
|
+
"no-undefined": "off",
|
|
229
|
+
"no-underscore-dangle": "off",
|
|
230
|
+
"no-unexpected-multiline": "off",
|
|
231
|
+
"no-unmodified-loop-condition": "error",
|
|
232
|
+
"no-unneeded-ternary": "error",
|
|
233
|
+
"no-unreachable": "error",
|
|
234
|
+
"no-unreachable-loop": "error",
|
|
235
|
+
"no-unsafe-finally": "error",
|
|
236
|
+
"no-unsafe-negation": "warn",
|
|
237
|
+
"no-unsafe-optional-chaining": "error",
|
|
238
|
+
"no-unused-expressions": "error",
|
|
239
|
+
"no-unused-labels": "warn",
|
|
240
|
+
"no-unused-private-class-members": "error",
|
|
241
|
+
"no-unused-vars": ["error", {
|
|
242
|
+
argsIgnorePattern: "^_",
|
|
243
|
+
varsIgnorePattern: "[iI]gnored"
|
|
244
|
+
}],
|
|
245
|
+
"no-use-before-define": "error",
|
|
246
|
+
"no-useless-assignment": "error",
|
|
247
|
+
"no-useless-backreference": "off",
|
|
248
|
+
"no-useless-call": "error",
|
|
249
|
+
"no-useless-catch": "error",
|
|
250
|
+
"no-useless-computed-key": "error",
|
|
251
|
+
"no-useless-concat": "error",
|
|
252
|
+
"no-useless-constructor": "error",
|
|
253
|
+
"no-useless-escape": "warn",
|
|
254
|
+
"no-useless-rename": "warn",
|
|
255
|
+
"no-useless-return": "error",
|
|
256
|
+
"no-var": "error",
|
|
257
|
+
"no-void": "error",
|
|
258
|
+
"no-warning-comments": "off",
|
|
259
|
+
"no-with": "error",
|
|
260
|
+
"object-shorthand": [
|
|
261
|
+
"warn",
|
|
262
|
+
"always",
|
|
263
|
+
{ ignoreConstructors: true }
|
|
264
|
+
],
|
|
265
|
+
"operator-assignment": ["error", "never"],
|
|
266
|
+
"prefer-arrow-callback": ["warn", { allowNamedFunctions: true }],
|
|
267
|
+
"prefer-const": "error",
|
|
268
|
+
"prefer-destructuring": ["error", {
|
|
269
|
+
AssignmentExpression: {
|
|
270
|
+
array: false,
|
|
271
|
+
object: false
|
|
272
|
+
},
|
|
273
|
+
VariableDeclarator: {
|
|
274
|
+
array: false,
|
|
275
|
+
object: true
|
|
276
|
+
}
|
|
277
|
+
}],
|
|
278
|
+
"prefer-exponentiation-operator": "warn",
|
|
279
|
+
"prefer-named-capture-group": "off",
|
|
280
|
+
"prefer-numeric-literals": "error",
|
|
281
|
+
"prefer-object-has-own": "error",
|
|
282
|
+
"prefer-object-spread": "warn",
|
|
283
|
+
"prefer-promise-reject-errors": "error",
|
|
284
|
+
"prefer-regex-literals": "error",
|
|
285
|
+
"prefer-rest-params": "error",
|
|
286
|
+
"prefer-spread": "error",
|
|
287
|
+
"prefer-template": "warn",
|
|
288
|
+
"preserve-caught-error": "error",
|
|
289
|
+
radix: "error",
|
|
290
|
+
"require-await": "error",
|
|
291
|
+
"require-unicode-regexp": "error",
|
|
292
|
+
"require-yield": "error",
|
|
293
|
+
"sort-imports": "off",
|
|
294
|
+
"sort-keys": "off",
|
|
295
|
+
"sort-vars": "off",
|
|
296
|
+
"symbol-description": "error",
|
|
297
|
+
"unicode-bom": "off",
|
|
298
|
+
"use-isnan": "error",
|
|
299
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
300
|
+
"vars-on-top": "error",
|
|
301
|
+
yoda: "warn"
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/oxlint/config.import.ts
|
|
307
|
+
const importConfig = () => {
|
|
308
|
+
return {
|
|
309
|
+
...emptyOxlintConfig,
|
|
310
|
+
rules: {
|
|
311
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
312
|
+
"import/default": "error",
|
|
313
|
+
"import/export": "error",
|
|
314
|
+
"import/exports-last": "off",
|
|
315
|
+
"import/extensions": "off",
|
|
316
|
+
"import/first": "error",
|
|
317
|
+
"import/group-exports": "off",
|
|
318
|
+
"import/max-dependencies": "off",
|
|
319
|
+
"import/named": "error",
|
|
320
|
+
"import/namespace": "error",
|
|
321
|
+
"import/newline-after-import": "warn",
|
|
322
|
+
"import/no-absolute-path": "error",
|
|
323
|
+
"import/no-amd": "error",
|
|
324
|
+
"import/no-anonymous-default-export": "error",
|
|
325
|
+
"import/no-commonjs": "error",
|
|
326
|
+
"import/no-cycle": "error",
|
|
327
|
+
"import/no-default-export": "off",
|
|
328
|
+
"import/no-duplicates": "error",
|
|
329
|
+
"import/no-dynamic-require": "error",
|
|
330
|
+
"import/no-empty-named-blocks": "warn",
|
|
331
|
+
"import/no-mutable-exports": "error",
|
|
332
|
+
"import/no-named-as-default": "error",
|
|
333
|
+
"import/no-named-as-default-member": "error",
|
|
334
|
+
"import/no-named-default": "error",
|
|
335
|
+
"import/no-named-export": "off",
|
|
336
|
+
"import/no-namespace": "off",
|
|
337
|
+
"import/no-nodejs-modules": "off",
|
|
338
|
+
"import/no-relative-parent-imports": "off",
|
|
339
|
+
"import/no-self-import": "error",
|
|
340
|
+
"import/no-unassigned-import": "off",
|
|
341
|
+
"import/no-webpack-loader-syntax": "off",
|
|
342
|
+
"import/prefer-default-export": "off",
|
|
343
|
+
"import/unambiguous": "off"
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/oxlint/config.jsdoc.ts
|
|
349
|
+
const jsdocConfig = () => {
|
|
350
|
+
return {
|
|
351
|
+
...emptyOxlintConfig,
|
|
352
|
+
rules: {
|
|
353
|
+
"jsdoc/check-access": "off",
|
|
354
|
+
"jsdoc/check-property-names": "off",
|
|
355
|
+
"jsdoc/check-tag-names": ["error", {
|
|
356
|
+
definedTags: ["jest-environment"],
|
|
357
|
+
typed: false
|
|
358
|
+
}],
|
|
359
|
+
"jsdoc/empty-tags": "error",
|
|
360
|
+
"jsdoc/implements-on-classes": "off",
|
|
361
|
+
"jsdoc/no-defaults": "error",
|
|
362
|
+
"jsdoc/require-param": "off",
|
|
363
|
+
"jsdoc/require-param-description": "error",
|
|
364
|
+
"jsdoc/require-param-name": "error",
|
|
365
|
+
"jsdoc/require-param-type": "off",
|
|
366
|
+
"jsdoc/require-property": "off",
|
|
367
|
+
"jsdoc/require-property-description": "off",
|
|
368
|
+
"jsdoc/require-property-name": "off",
|
|
369
|
+
"jsdoc/require-property-type": "off",
|
|
370
|
+
"jsdoc/require-returns": "off",
|
|
371
|
+
"jsdoc/require-returns-description": "error",
|
|
372
|
+
"jsdoc/require-returns-type": "off",
|
|
373
|
+
"jsdoc/require-throws-description": "error",
|
|
374
|
+
"jsdoc/require-throws-type": "off",
|
|
375
|
+
"jsdoc/require-yields": "error",
|
|
376
|
+
"jsdoc/require-yields-description": "error",
|
|
377
|
+
"jsdoc/require-yields-type": "error"
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/oxlint/config.node.ts
|
|
383
|
+
const nodeConfig = () => {
|
|
384
|
+
return {
|
|
385
|
+
...emptyOxlintConfig,
|
|
386
|
+
rules: {
|
|
387
|
+
"node/callback-return": "error",
|
|
388
|
+
"node/global-require": "error",
|
|
389
|
+
"node/handle-callback-err": "error",
|
|
390
|
+
"node/no-exports-assign": "warn",
|
|
391
|
+
"node/no-mixed-requires": "error",
|
|
392
|
+
"node/no-new-require": "error",
|
|
393
|
+
"node/no-path-concat": "error",
|
|
394
|
+
"node/no-process-env": "off",
|
|
395
|
+
"node/no-sync": "off",
|
|
396
|
+
"node/no-top-level-await": "off"
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/oxlint/config.oxc.ts
|
|
402
|
+
const oxcConfig = () => {
|
|
403
|
+
return {
|
|
404
|
+
...emptyOxlintConfig,
|
|
405
|
+
rules: {
|
|
406
|
+
"oxc/approx-constant": "error",
|
|
407
|
+
"oxc/bad-array-method-on-arguments": "error",
|
|
408
|
+
"oxc/bad-bitwise-operator": "error",
|
|
409
|
+
"oxc/bad-char-at-comparison": "error",
|
|
410
|
+
"oxc/bad-comparison-sequence": "error",
|
|
411
|
+
"oxc/bad-min-max-func": "error",
|
|
412
|
+
"oxc/bad-object-literal-comparison": "error",
|
|
413
|
+
"oxc/bad-replace-all-arg": "error",
|
|
414
|
+
"oxc/branches-sharing-code": "error",
|
|
415
|
+
"oxc/const-comparisons": "error",
|
|
416
|
+
"oxc/double-comparisons": "warn",
|
|
417
|
+
"oxc/erasing-op": "error",
|
|
418
|
+
"oxc/misrefactored-assign-op": "error",
|
|
419
|
+
"oxc/missing-throw": "error",
|
|
420
|
+
"oxc/no-accumulating-spread": "error",
|
|
421
|
+
"oxc/no-async-await": "off",
|
|
422
|
+
"oxc/no-async-endpoint-handlers": "error",
|
|
423
|
+
"oxc/no-barrel-file": "error",
|
|
424
|
+
"oxc/no-const-enum": "off",
|
|
425
|
+
"oxc/no-map-spread": "error",
|
|
426
|
+
"oxc/no-optional-chaining": "off",
|
|
427
|
+
"oxc/no-rest-spread-properties": "off",
|
|
428
|
+
"oxc/no-this-in-exported-function": "error",
|
|
429
|
+
"oxc/number-arg-out-of-range": "error",
|
|
430
|
+
"oxc/only-used-in-recursion": "error",
|
|
431
|
+
"oxc/uninvoked-array-callback": "error"
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
//#endregion
|
|
436
|
+
//#region src/oxlint/config.perfectionist.ts
|
|
437
|
+
const sortOrder = [
|
|
438
|
+
{
|
|
439
|
+
customGroups: [
|
|
440
|
+
{
|
|
441
|
+
elementNamePattern: "^xs$",
|
|
442
|
+
groupName: "xs"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
elementNamePattern: "^default$",
|
|
446
|
+
groupName: "default"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
elementNamePattern: "^sm$",
|
|
450
|
+
groupName: "sm"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
elementNamePattern: "^md$",
|
|
454
|
+
groupName: "md"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
elementNamePattern: "^lg$",
|
|
458
|
+
groupName: "lg"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
elementNamePattern: "^xl$",
|
|
462
|
+
groupName: "xl"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
elementNamePattern: "^2xl$",
|
|
466
|
+
groupName: "2xl"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
elementNamePattern: "^xxl$",
|
|
470
|
+
groupName: "xxl"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
elementNamePattern: "^3xl$",
|
|
474
|
+
groupName: "3xl"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
elementNamePattern: "^xxxl$",
|
|
478
|
+
groupName: "xxxl"
|
|
479
|
+
}
|
|
480
|
+
],
|
|
481
|
+
groups: [
|
|
482
|
+
"xs",
|
|
483
|
+
"default",
|
|
484
|
+
"sm",
|
|
485
|
+
"md",
|
|
486
|
+
"lg",
|
|
487
|
+
"xl",
|
|
488
|
+
"2xl",
|
|
489
|
+
"xxl",
|
|
490
|
+
"3xl",
|
|
491
|
+
"xxxl"
|
|
492
|
+
],
|
|
493
|
+
useConfigurationIf: { allNamesMatchPattern: "^xs|default|sm|md|lg|xl|2xl|xxl|3xl|xxxl$" }
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
customGroups: [
|
|
497
|
+
{
|
|
498
|
+
elementNamePattern: "^type$",
|
|
499
|
+
groupName: "type"
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
elementNamePattern: "^payload$",
|
|
503
|
+
groupName: "payload"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
elementNamePattern: "^error$",
|
|
507
|
+
groupName: "error"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
elementNamePattern: "^meta$",
|
|
511
|
+
groupName: "meta"
|
|
512
|
+
}
|
|
513
|
+
],
|
|
514
|
+
groups: [
|
|
515
|
+
"type",
|
|
516
|
+
"payload",
|
|
517
|
+
"error",
|
|
518
|
+
"meta"
|
|
519
|
+
],
|
|
520
|
+
useConfigurationIf: { allNamesMatchPattern: "^type|payload|meta|error$" }
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
partitionByNewLine: true,
|
|
524
|
+
type: "natural"
|
|
525
|
+
}
|
|
526
|
+
];
|
|
527
|
+
const perfectionistConfig = () => {
|
|
528
|
+
return {
|
|
529
|
+
...emptyOxlintConfig,
|
|
530
|
+
rules: {
|
|
531
|
+
"perfectionist/sort-array-includes": "off",
|
|
532
|
+
"perfectionist/sort-arrays": "off",
|
|
533
|
+
"perfectionist/sort-classes": "off",
|
|
534
|
+
"perfectionist/sort-decorators": "off",
|
|
535
|
+
"perfectionist/sort-enums": "off",
|
|
536
|
+
"perfectionist/sort-export-attributes": ["error", { type: "natural" }],
|
|
537
|
+
"perfectionist/sort-exports": ["error", { type: "natural" }],
|
|
538
|
+
"perfectionist/sort-heritage-clauses": "off",
|
|
539
|
+
"perfectionist/sort-import-attributes": ["error", { type: "natural" }],
|
|
540
|
+
"perfectionist/sort-imports": "off",
|
|
541
|
+
"perfectionist/sort-interfaces": "off",
|
|
542
|
+
"perfectionist/sort-intersection-types": "off",
|
|
543
|
+
"perfectionist/sort-jsx-props": ["error", {
|
|
544
|
+
customGroups: [{
|
|
545
|
+
elementNamePattern: [
|
|
546
|
+
"^key$",
|
|
547
|
+
"^ref$",
|
|
548
|
+
"^children$",
|
|
549
|
+
"^dangerouslySetInnerHTML$"
|
|
550
|
+
],
|
|
551
|
+
groupName: "reserved"
|
|
552
|
+
}],
|
|
553
|
+
groups: ["reserved", "unknown"],
|
|
554
|
+
type: "natural"
|
|
555
|
+
}],
|
|
556
|
+
"perfectionist/sort-maps": "off",
|
|
557
|
+
"perfectionist/sort-modules": "off",
|
|
558
|
+
"perfectionist/sort-named-exports": ["error", { type: "natural" }],
|
|
559
|
+
"perfectionist/sort-named-imports": ["error", { type: "natural" }],
|
|
560
|
+
"perfectionist/sort-object-types": ["error", ...sortOrder],
|
|
561
|
+
"perfectionist/sort-objects": ["error", ...sortOrder],
|
|
562
|
+
"perfectionist/sort-sets": "off",
|
|
563
|
+
"perfectionist/sort-switch-case": "off",
|
|
564
|
+
"perfectionist/sort-union-types": "off",
|
|
565
|
+
"perfectionist/sort-variable-declarations": "off"
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
//#endregion
|
|
570
|
+
//#region src/oxlint/config.promise.ts
|
|
571
|
+
const promiseConfig = () => {
|
|
572
|
+
return {
|
|
573
|
+
...emptyOxlintConfig,
|
|
574
|
+
rules: {
|
|
575
|
+
"promise/always-return": "error",
|
|
576
|
+
"promise/avoid-new": "error",
|
|
577
|
+
"promise/catch-or-return": "error",
|
|
578
|
+
"promise/no-callback-in-promise": "error",
|
|
579
|
+
"promise/no-multiple-resolved": "error",
|
|
580
|
+
"promise/no-nesting": "error",
|
|
581
|
+
"promise/no-new-statics": "warn",
|
|
582
|
+
"promise/no-promise-in-callback": "error",
|
|
583
|
+
"promise/no-return-in-finally": "error",
|
|
584
|
+
"promise/no-return-wrap": "error",
|
|
585
|
+
"promise/param-names": "error",
|
|
586
|
+
"promise/prefer-await-to-callbacks": "error",
|
|
587
|
+
"promise/prefer-await-to-then": "error",
|
|
588
|
+
"promise/prefer-catch": "error",
|
|
589
|
+
"promise/spec-only": "error",
|
|
590
|
+
"promise/valid-params": "error"
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
};
|
|
594
|
+
//#endregion
|
|
595
|
+
//#region src/oxlint/ensure-installed.ts
|
|
596
|
+
const require = createRequire(import.meta.url);
|
|
597
|
+
function ensureInstalled(pkg) {
|
|
598
|
+
try {
|
|
599
|
+
require.resolve(pkg);
|
|
600
|
+
return pkg;
|
|
601
|
+
} catch (error) {
|
|
602
|
+
throw new Error(`${pkg} not installed`, { cause: error });
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region src/oxlint/config.react.ts
|
|
607
|
+
const reactConfig = (options) => {
|
|
608
|
+
if (!options?.react) return emptyOxlintConfig;
|
|
609
|
+
return {
|
|
610
|
+
...emptyOxlintConfig,
|
|
611
|
+
jsPlugins: [{
|
|
612
|
+
name: "react-js",
|
|
613
|
+
specifier: ensureInstalled("eslint-plugin-react")
|
|
614
|
+
}],
|
|
615
|
+
overrides: [{
|
|
616
|
+
files: ["**/*.{stories,test,spec}.{jsx,tsx,js,ts}"],
|
|
617
|
+
rules: { "react/jsx-props-no-spreading": "off" }
|
|
618
|
+
}],
|
|
619
|
+
plugins: ["react", "jsx-a11y"],
|
|
620
|
+
rules: {
|
|
621
|
+
"jsx_a11y/alt-text": "error",
|
|
622
|
+
"jsx_a11y/anchor-ambiguous-text": "error",
|
|
623
|
+
"jsx_a11y/anchor-has-content": "error",
|
|
624
|
+
"jsx_a11y/anchor-is-valid": "error",
|
|
625
|
+
"jsx_a11y/aria-activedescendant-has-tabindex": "error",
|
|
626
|
+
"jsx_a11y/aria-props": "error",
|
|
627
|
+
"jsx_a11y/aria-proptypes": "error",
|
|
628
|
+
"jsx_a11y/aria-role": "error",
|
|
629
|
+
"jsx_a11y/aria-unsupported-elements": "warn",
|
|
630
|
+
"jsx_a11y/autocomplete-valid": "error",
|
|
631
|
+
"jsx_a11y/click-events-have-key-events": "error",
|
|
632
|
+
"jsx_a11y/control-has-associated-label": ["off", {
|
|
633
|
+
ignoreElements: [
|
|
634
|
+
"audio",
|
|
635
|
+
"canvas",
|
|
636
|
+
"embed",
|
|
637
|
+
"input",
|
|
638
|
+
"textarea",
|
|
639
|
+
"tr",
|
|
640
|
+
"video"
|
|
641
|
+
],
|
|
642
|
+
ignoreRoles: [
|
|
643
|
+
"grid",
|
|
644
|
+
"listbox",
|
|
645
|
+
"menu",
|
|
646
|
+
"menubar",
|
|
647
|
+
"radiogroup",
|
|
648
|
+
"row",
|
|
649
|
+
"tablist",
|
|
650
|
+
"toolbar",
|
|
651
|
+
"tree",
|
|
652
|
+
"treegrid"
|
|
653
|
+
],
|
|
654
|
+
includeRoles: ["alert", "dialog"]
|
|
655
|
+
}],
|
|
656
|
+
"jsx_a11y/heading-has-content": "error",
|
|
657
|
+
"jsx_a11y/html-has-lang": "error",
|
|
658
|
+
"jsx_a11y/iframe-has-title": "error",
|
|
659
|
+
"jsx_a11y/img-redundant-alt": "error",
|
|
660
|
+
"jsx_a11y/interactive-supports-focus": ["error", { tabbable: [
|
|
661
|
+
"button",
|
|
662
|
+
"checkbox",
|
|
663
|
+
"link",
|
|
664
|
+
"searchbox",
|
|
665
|
+
"spinbutton",
|
|
666
|
+
"switch",
|
|
667
|
+
"textbox"
|
|
668
|
+
] }],
|
|
669
|
+
"jsx_a11y/label-has-associated-control": "error",
|
|
670
|
+
"jsx_a11y/lang": "error",
|
|
671
|
+
"jsx_a11y/media-has-caption": "error",
|
|
672
|
+
"jsx_a11y/mouse-events-have-key-events": "error",
|
|
673
|
+
"jsx_a11y/no-access-key": "error",
|
|
674
|
+
"jsx_a11y/no-aria-hidden-on-focusable": "warn",
|
|
675
|
+
"jsx_a11y/no-autofocus": ["error", { ignoreNonDOM: true }],
|
|
676
|
+
"jsx_a11y/no-distracting-elements": "error",
|
|
677
|
+
"jsx_a11y/no-interactive-element-to-noninteractive-role": ["error", {
|
|
678
|
+
canvas: ["img"],
|
|
679
|
+
tr: ["none", "presentation"]
|
|
680
|
+
}],
|
|
681
|
+
"jsx_a11y/no-noninteractive-element-interactions": ["error", {
|
|
682
|
+
alert: [
|
|
683
|
+
"onKeyUp",
|
|
684
|
+
"onKeyDown",
|
|
685
|
+
"onKeyPress"
|
|
686
|
+
],
|
|
687
|
+
body: ["onError", "onLoad"],
|
|
688
|
+
dialog: [
|
|
689
|
+
"onKeyUp",
|
|
690
|
+
"onKeyDown",
|
|
691
|
+
"onKeyPress"
|
|
692
|
+
],
|
|
693
|
+
handlers: [
|
|
694
|
+
"onClick",
|
|
695
|
+
"onError",
|
|
696
|
+
"onLoad",
|
|
697
|
+
"onMouseDown",
|
|
698
|
+
"onMouseUp",
|
|
699
|
+
"onKeyPress",
|
|
700
|
+
"onKeyDown",
|
|
701
|
+
"onKeyUp"
|
|
702
|
+
],
|
|
703
|
+
iframe: ["onError", "onLoad"],
|
|
704
|
+
img: ["onError", "onLoad"]
|
|
705
|
+
}],
|
|
706
|
+
"jsx_a11y/no-noninteractive-element-to-interactive-role": ["error", {
|
|
707
|
+
fieldset: ["radiogroup", "presentation"],
|
|
708
|
+
li: [
|
|
709
|
+
"menuitem",
|
|
710
|
+
"option",
|
|
711
|
+
"row",
|
|
712
|
+
"tab",
|
|
713
|
+
"treeitem"
|
|
714
|
+
],
|
|
715
|
+
ol: [
|
|
716
|
+
"listbox",
|
|
717
|
+
"menu",
|
|
718
|
+
"menubar",
|
|
719
|
+
"radiogroup",
|
|
720
|
+
"tablist",
|
|
721
|
+
"tree",
|
|
722
|
+
"treegrid"
|
|
723
|
+
],
|
|
724
|
+
table: ["grid"],
|
|
725
|
+
td: ["gridcell"],
|
|
726
|
+
ul: [
|
|
727
|
+
"listbox",
|
|
728
|
+
"menu",
|
|
729
|
+
"menubar",
|
|
730
|
+
"radiogroup",
|
|
731
|
+
"tablist",
|
|
732
|
+
"tree",
|
|
733
|
+
"treegrid"
|
|
734
|
+
]
|
|
735
|
+
}],
|
|
736
|
+
"jsx_a11y/no-noninteractive-tabindex": ["error", {
|
|
737
|
+
allowExpressionValues: true,
|
|
738
|
+
roles: ["tabpanel"],
|
|
739
|
+
tags: []
|
|
740
|
+
}],
|
|
741
|
+
"jsx_a11y/no-redundant-roles": "warn",
|
|
742
|
+
"jsx_a11y/no-static-element-interactions": ["error", {
|
|
743
|
+
allowExpressionValues: true,
|
|
744
|
+
handlers: [
|
|
745
|
+
"onClick",
|
|
746
|
+
"onMouseDown",
|
|
747
|
+
"onMouseUp",
|
|
748
|
+
"onKeyPress",
|
|
749
|
+
"onKeyDown",
|
|
750
|
+
"onKeyUp"
|
|
751
|
+
]
|
|
752
|
+
}],
|
|
753
|
+
"jsx_a11y/prefer-tag-over-role": "error",
|
|
754
|
+
"jsx_a11y/role-has-required-aria-props": "error",
|
|
755
|
+
"jsx_a11y/role-supports-aria-props": "error",
|
|
756
|
+
"jsx_a11y/scope": "warn",
|
|
757
|
+
"jsx_a11y/tabindex-no-positive": "error",
|
|
758
|
+
/**
|
|
759
|
+
* eslint-plugin-react rules
|
|
760
|
+
* https://npmx.dev/package/eslint-plugin-react
|
|
761
|
+
*/
|
|
762
|
+
"react-js/no-unused-prop-types": "error",
|
|
763
|
+
"react-js/boolean-prop-naming": "off",
|
|
764
|
+
"react-js/button-has-type": "off",
|
|
765
|
+
"react-js/checked-requires-onchange-or-readonly": "off",
|
|
766
|
+
"react-js/default-props-match-prop-types": "off",
|
|
767
|
+
"react-js/destructuring-assignment": "off",
|
|
768
|
+
"react-js/display-name": "off",
|
|
769
|
+
"react-js/forbid-component-props": "off",
|
|
770
|
+
"react-js/forbid-dom-props": "off",
|
|
771
|
+
"react-js/forbid-elements": "off",
|
|
772
|
+
"react-js/forbid-foreign-prop-types": "off",
|
|
773
|
+
"react-js/forbid-prop-types": "off",
|
|
774
|
+
"react-js/forward-ref-uses-ref": "off",
|
|
775
|
+
"react-js/function-component-definition": "off",
|
|
776
|
+
"react-js/hook-use-state": "off",
|
|
777
|
+
"react-js/iframe-missing-sandbox": "off",
|
|
778
|
+
"react-js/jsx-boolean-value": "off",
|
|
779
|
+
"react-js/jsx-child-element-spacing": "off",
|
|
780
|
+
"react-js/jsx-closing-bracket-location": "off",
|
|
781
|
+
"react-js/jsx-closing-tag-location": "off",
|
|
782
|
+
"react-js/jsx-curly-brace-presence": "off",
|
|
783
|
+
"react-js/jsx-curly-newline": "off",
|
|
784
|
+
"react-js/jsx-curly-spacing": "off",
|
|
785
|
+
"react-js/jsx-equals-spacing": "off",
|
|
786
|
+
"react-js/jsx-filename-extension": "off",
|
|
787
|
+
"react-js/jsx-first-prop-new-line": "off",
|
|
788
|
+
"react-js/jsx-fragments": "off",
|
|
789
|
+
"react-js/jsx-handler-names": "off",
|
|
790
|
+
"react-js/jsx-indent": "off",
|
|
791
|
+
"react-js/jsx-indent-props": "off",
|
|
792
|
+
"react-js/jsx-key": "off",
|
|
793
|
+
"react-js/jsx-max-depth": "off",
|
|
794
|
+
"react-js/jsx-max-props-per-line": "off",
|
|
795
|
+
"react-js/jsx-newline": "off",
|
|
796
|
+
"react-js/jsx-no-bind": "off",
|
|
797
|
+
"react-js/jsx-no-comment-textnodes": "off",
|
|
798
|
+
"react-js/jsx-no-constructed-context-values": "off",
|
|
799
|
+
"react-js/jsx-no-duplicate-props": "off",
|
|
800
|
+
"react-js/jsx-no-leaked-render": "off",
|
|
801
|
+
"react-js/jsx-no-literals": "off",
|
|
802
|
+
"react-js/jsx-no-script-url": "off",
|
|
803
|
+
"react-js/jsx-no-target-blank": "off",
|
|
804
|
+
"react-js/jsx-no-undef": "off",
|
|
805
|
+
"react-js/jsx-no-useless-fragment": "off",
|
|
806
|
+
"react-js/jsx-one-expression-per-line": "off",
|
|
807
|
+
"react-js/jsx-pascal-case": "off",
|
|
808
|
+
"react-js/jsx-props-no-multi-spaces": "off",
|
|
809
|
+
"react-js/jsx-props-no-spread-multi": "off",
|
|
810
|
+
"react-js/jsx-props-no-spreading": "off",
|
|
811
|
+
"react-js/jsx-sort-default-props": "off",
|
|
812
|
+
"react-js/jsx-sort-props": "off",
|
|
813
|
+
"react-js/jsx-space-before-closing": "off",
|
|
814
|
+
"react-js/jsx-tag-spacing": "off",
|
|
815
|
+
"react-js/jsx-uses-react": "off",
|
|
816
|
+
"react-js/jsx-uses-vars": "off",
|
|
817
|
+
"react-js/jsx-wrap-multilines": "off",
|
|
818
|
+
"react-js/no-access-state-in-setstate": "off",
|
|
819
|
+
"react-js/no-adjacent-inline-elements": "off",
|
|
820
|
+
"react-js/no-array-index-key": "off",
|
|
821
|
+
"react-js/no-arrow-function-lifecycle": "off",
|
|
822
|
+
"react-js/no-children-prop": "off",
|
|
823
|
+
"react-js/no-danger": "off",
|
|
824
|
+
"react-js/no-danger-with-children": "off",
|
|
825
|
+
"react-js/no-deprecated": "off",
|
|
826
|
+
"react-js/no-did-mount-set-state": "off",
|
|
827
|
+
"react-js/no-did-update-set-state": "off",
|
|
828
|
+
"react-js/no-direct-mutation-state": "off",
|
|
829
|
+
"react-js/no-find-dom-node": "off",
|
|
830
|
+
"react-js/no-invalid-html-attribute": "off",
|
|
831
|
+
"react-js/no-is-mounted": "off",
|
|
832
|
+
"react-js/no-multi-comp": "off",
|
|
833
|
+
"react-js/no-namespace": "off",
|
|
834
|
+
"react-js/no-object-type-as-default-prop": "off",
|
|
835
|
+
"react-js/no-redundant-should-component-update": "off",
|
|
836
|
+
"react-js/no-render-return-value": "off",
|
|
837
|
+
"react-js/no-set-state": "off",
|
|
838
|
+
"react-js/no-string-refs": "off",
|
|
839
|
+
"react-js/no-this-in-sfc": "off",
|
|
840
|
+
"react-js/no-typos": "off",
|
|
841
|
+
"react-js/no-unescaped-entities": "off",
|
|
842
|
+
"react-js/no-unknown-property": "off",
|
|
843
|
+
"react-js/no-unsafe": "off",
|
|
844
|
+
"react-js/no-unstable-nested-components": "off",
|
|
845
|
+
"react-js/no-unused-class-component-methods": "off",
|
|
846
|
+
"react-js/no-unused-state": "off",
|
|
847
|
+
"react-js/no-will-update-set-state": "off",
|
|
848
|
+
"react-js/prefer-es6-class": "off",
|
|
849
|
+
"react-js/prefer-exact-props": "off",
|
|
850
|
+
"react-js/prefer-read-only-props": "off",
|
|
851
|
+
"react-js/prefer-stateless-function": "off",
|
|
852
|
+
"react-js/prop-types": "off",
|
|
853
|
+
"react-js/react-in-jsx-scope": "off",
|
|
854
|
+
"react-js/require-default-props": "off",
|
|
855
|
+
"react-js/require-optimization": "off",
|
|
856
|
+
"react-js/require-render-return": "off",
|
|
857
|
+
"react-js/self-closing-comp": "off",
|
|
858
|
+
"react-js/sort-comp": "off",
|
|
859
|
+
"react-js/sort-default-props": "off",
|
|
860
|
+
"react-js/sort-prop-types": "off",
|
|
861
|
+
"react-js/state-in-constructor": "off",
|
|
862
|
+
"react-js/static-property-placement": "off",
|
|
863
|
+
"react-js/style-prop-object": "off",
|
|
864
|
+
"react-js/void-dom-elements-no-children": "off",
|
|
865
|
+
/**
|
|
866
|
+
* Built in React rules.
|
|
867
|
+
*/
|
|
868
|
+
"react/button-has-type": "error",
|
|
869
|
+
"react/checked-requires-onchange-or-readonly": "error",
|
|
870
|
+
"react/display-name": "error",
|
|
871
|
+
"react/exhaustive-deps": "error",
|
|
872
|
+
"react/forbid-component-props": "off",
|
|
873
|
+
"react/forbid-dom-props": "error",
|
|
874
|
+
"react/forbid-elements": "error",
|
|
875
|
+
"react/forward-ref-uses-ref": "error",
|
|
876
|
+
"react/function-component-definition": ["error", {
|
|
877
|
+
namedComponents: "arrow-function",
|
|
878
|
+
unnamedComponents: "arrow-function"
|
|
879
|
+
}],
|
|
880
|
+
"react/hook-use-state": "error",
|
|
881
|
+
"react/iframe-missing-sandbox": "error",
|
|
882
|
+
"react/jsx-boolean-value": "warn",
|
|
883
|
+
"react/jsx-curly-brace-presence": "warn",
|
|
884
|
+
"react/jsx-filename-extension": ["error", { extensions: [".jsx", ".tsx"] }],
|
|
885
|
+
"react/jsx-fragments": "warn",
|
|
886
|
+
"react/jsx-handler-names": "error",
|
|
887
|
+
"react/jsx-key": "error",
|
|
888
|
+
"react/jsx-max-depth": "off",
|
|
889
|
+
"react/jsx-no-comment-textnodes": "error",
|
|
890
|
+
"react/jsx-no-constructed-context-values": "error",
|
|
891
|
+
"react/jsx-no-duplicate-props": "error",
|
|
892
|
+
"react/jsx-no-literals": "off",
|
|
893
|
+
"react/jsx-no-script-url": "error",
|
|
894
|
+
"react/jsx-no-target-blank": "error",
|
|
895
|
+
"react/jsx-no-undef": "error",
|
|
896
|
+
"react/jsx-no-useless-fragment": ["error", { allowExpressions: true }],
|
|
897
|
+
"react/jsx-pascal-case": ["error", { allowAllCaps: true }],
|
|
898
|
+
"react/jsx-props-no-spread-multi": "warn",
|
|
899
|
+
"react/jsx-props-no-spreading": ["error", {
|
|
900
|
+
custom: "enforce",
|
|
901
|
+
explicitSpread: "ignore",
|
|
902
|
+
html: "enforce"
|
|
903
|
+
}],
|
|
904
|
+
"react/no-array-index-key": "error",
|
|
905
|
+
"react/no-children-prop": "error",
|
|
906
|
+
"react/no-clone-element": "error",
|
|
907
|
+
"react/no-danger": "error",
|
|
908
|
+
"react/no-danger-with-children": "error",
|
|
909
|
+
"react/no-did-mount-set-state": "error",
|
|
910
|
+
"react/no-did-update-set-state": "error",
|
|
911
|
+
"react/no-direct-mutation-state": "error",
|
|
912
|
+
"react/no-find-dom-node": "error",
|
|
913
|
+
"react/no-is-mounted": "error",
|
|
914
|
+
"react/no-multi-comp": "off",
|
|
915
|
+
"react/no-namespace": "error",
|
|
916
|
+
"react/no-object-type-as-default-prop": "error",
|
|
917
|
+
"react/no-react-children": "error",
|
|
918
|
+
"react/no-redundant-should-component-update": "error",
|
|
919
|
+
"react/no-render-return-value": "error",
|
|
920
|
+
"react/no-set-state": "error",
|
|
921
|
+
"react/no-string-refs": "error",
|
|
922
|
+
"react/no-this-in-sfc": "error",
|
|
923
|
+
"react/no-unescaped-entities": "error",
|
|
924
|
+
"react/no-unknown-property": "error",
|
|
925
|
+
"react/no-unsafe": "error",
|
|
926
|
+
"react/no-unstable-nested-components": ["error", { propNamePattern: "{popover,render*}" }],
|
|
927
|
+
"react/no-will-update-set-state": "error",
|
|
928
|
+
"react/only-export-components": "off",
|
|
929
|
+
"react/prefer-es6-class": "error",
|
|
930
|
+
"react/prefer-function-component": ["error", { allowJsxUtilityClass: true }],
|
|
931
|
+
"react/react-compiler": ["error", { reportAllBailouts: true }],
|
|
932
|
+
"react/react-in-jsx-scope": "off",
|
|
933
|
+
"react/require-render-return": "error",
|
|
934
|
+
"react/rules-of-hooks": "error",
|
|
935
|
+
"react/self-closing-comp": "warn",
|
|
936
|
+
"react/state-in-constructor": "error",
|
|
937
|
+
"react/style-prop-object": "error",
|
|
938
|
+
"react/void-dom-elements-no-children": "error"
|
|
939
|
+
},
|
|
940
|
+
settings: {}
|
|
941
|
+
};
|
|
942
|
+
};
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region src/oxlint/config.tailwind.ts
|
|
945
|
+
const tailwindConfig = (options) => {
|
|
946
|
+
if (!options?.tailwind) return emptyOxlintConfig;
|
|
947
|
+
return {
|
|
948
|
+
...emptyOxlintConfig,
|
|
949
|
+
jsPlugins: [{
|
|
950
|
+
name: "tailwind",
|
|
951
|
+
specifier: ensureInstalled("eslint-plugin-better-tailwindcss")
|
|
952
|
+
}],
|
|
953
|
+
rules: {
|
|
954
|
+
"tailwind/enforce-canonical-classes": "off",
|
|
955
|
+
"tailwind/enforce-consistent-class-order": "off",
|
|
956
|
+
"tailwind/enforce-consistent-important-position": "off",
|
|
957
|
+
"tailwind/enforce-consistent-line-wrapping": "off",
|
|
958
|
+
"tailwind/enforce-consistent-variable-syntax": "off",
|
|
959
|
+
"tailwind/enforce-consistent-variant-order": "off",
|
|
960
|
+
"tailwind/enforce-logical-properties": "off",
|
|
961
|
+
"tailwind/enforce-shorthand-classes": "off",
|
|
962
|
+
"tailwind/no-conflicting-classes": "off",
|
|
963
|
+
"tailwind/no-deprecated-classes": "off",
|
|
964
|
+
"tailwind/no-duplicate-classes": "off",
|
|
965
|
+
"tailwind/no-restricted-classes": "off",
|
|
966
|
+
"tailwind/no-unknown-classes": "off",
|
|
967
|
+
"tailwind/no-unnecessary-whitespace": "off"
|
|
968
|
+
},
|
|
969
|
+
settings: {}
|
|
970
|
+
};
|
|
971
|
+
};
|
|
972
|
+
//#endregion
|
|
973
|
+
//#region src/oxlint/config.typescript.ts
|
|
974
|
+
const typescriptConfig = () => {
|
|
975
|
+
return {
|
|
976
|
+
...emptyOxlintConfig,
|
|
977
|
+
rules: {
|
|
978
|
+
"typescript/adjacent-overload-signatures": "off",
|
|
979
|
+
"typescript/array-type": ["warn", { default: "array" }],
|
|
980
|
+
"typescript/await-thenable": "off",
|
|
981
|
+
"typescript/ban-ts-comment": "error",
|
|
982
|
+
"typescript/ban-tslint-comment": "warn",
|
|
983
|
+
"typescript/ban-types": "error",
|
|
984
|
+
"typescript/class-literal-property-style": "error",
|
|
985
|
+
"typescript/consistent-generic-constructors": "warn",
|
|
986
|
+
"typescript/consistent-indexed-object-style": "error",
|
|
987
|
+
"typescript/consistent-return": "off",
|
|
988
|
+
"typescript/consistent-type-assertions": "error",
|
|
989
|
+
"typescript/consistent-type-definitions": ["error", "type"],
|
|
990
|
+
"typescript/consistent-type-exports": "off",
|
|
991
|
+
"typescript/consistent-type-imports": ["error", { prefer: "type-imports" }],
|
|
992
|
+
"typescript/dot-notation": "off",
|
|
993
|
+
"typescript/explicit-function-return-type": "off",
|
|
994
|
+
"typescript/explicit-member-accessibility": "off",
|
|
995
|
+
"typescript/explicit-module-boundary-types": "error",
|
|
996
|
+
"typescript/method-signature-style": "error",
|
|
997
|
+
"typescript/no-array-delete": "off",
|
|
998
|
+
"typescript/no-base-to-string": "off",
|
|
999
|
+
"typescript/no-confusing-non-null-assertion": "error",
|
|
1000
|
+
"typescript/no-confusing-void-expression": "off",
|
|
1001
|
+
"typescript/no-deprecated": "off",
|
|
1002
|
+
"typescript/no-duplicate-enum-values": "error",
|
|
1003
|
+
"typescript/no-duplicate-type-constituents": "off",
|
|
1004
|
+
"typescript/no-dynamic-delete": "off",
|
|
1005
|
+
"typescript/no-empty-interface": "error",
|
|
1006
|
+
"typescript/no-empty-object-type": "error",
|
|
1007
|
+
"typescript/no-explicit-any": "error",
|
|
1008
|
+
"typescript/no-extra-non-null-assertion": "warn",
|
|
1009
|
+
"typescript/no-extraneous-class": "error",
|
|
1010
|
+
"typescript/no-floating-promises": "off",
|
|
1011
|
+
"typescript/no-for-in-array": "off",
|
|
1012
|
+
"typescript/no-implied-eval": "off",
|
|
1013
|
+
"typescript/no-import-type-side-effects": "warn",
|
|
1014
|
+
"typescript/no-inferrable-types": "error",
|
|
1015
|
+
"typescript/no-invalid-void-type": "error",
|
|
1016
|
+
"typescript/no-meaningless-void-operator": "off",
|
|
1017
|
+
"typescript/no-misused-new": "error",
|
|
1018
|
+
"typescript/no-misused-promises": "off",
|
|
1019
|
+
"typescript/no-misused-spread": "off",
|
|
1020
|
+
"typescript/no-mixed-enums": "off",
|
|
1021
|
+
"typescript/no-namespace": "error",
|
|
1022
|
+
"typescript/no-non-null-asserted-nullish-coalescing": "error",
|
|
1023
|
+
"typescript/no-non-null-asserted-optional-chain": "error",
|
|
1024
|
+
"typescript/no-non-null-assertion": "error",
|
|
1025
|
+
"typescript/no-redundant-type-constituents": "off",
|
|
1026
|
+
"typescript/no-require-imports": "error",
|
|
1027
|
+
"typescript/no-restricted-types": "off",
|
|
1028
|
+
"typescript/no-this-alias": "error",
|
|
1029
|
+
"typescript/no-unnecessary-boolean-literal-compare": "off",
|
|
1030
|
+
"typescript/no-unnecessary-condition": "off",
|
|
1031
|
+
"typescript/no-unnecessary-parameter-property-assignment": "error",
|
|
1032
|
+
"typescript/no-unnecessary-qualifier": "off",
|
|
1033
|
+
"typescript/no-unnecessary-template-expression": "off",
|
|
1034
|
+
"typescript/no-unnecessary-type-arguments": "off",
|
|
1035
|
+
"typescript/no-unnecessary-type-assertion": "off",
|
|
1036
|
+
"typescript/no-unnecessary-type-constraint": "error",
|
|
1037
|
+
"typescript/no-unnecessary-type-conversion": "off",
|
|
1038
|
+
"typescript/no-unnecessary-type-parameters": "off",
|
|
1039
|
+
"typescript/no-unsafe-argument": "off",
|
|
1040
|
+
"typescript/no-unsafe-assignment": "off",
|
|
1041
|
+
"typescript/no-unsafe-call": "off",
|
|
1042
|
+
"typescript/no-unsafe-declaration-merging": "error",
|
|
1043
|
+
"typescript/no-unsafe-enum-comparison": "off",
|
|
1044
|
+
"typescript/no-unsafe-function-type": "error",
|
|
1045
|
+
"typescript/no-unsafe-member-access": "off",
|
|
1046
|
+
"typescript/no-unsafe-return": "off",
|
|
1047
|
+
"typescript/no-unsafe-type-assertion": "off",
|
|
1048
|
+
"typescript/no-unsafe-unary-minus": "off",
|
|
1049
|
+
"typescript/no-useless-default-assignment": "off",
|
|
1050
|
+
"typescript/no-useless-empty-export": "warn",
|
|
1051
|
+
"typescript/no-var-requires": "error",
|
|
1052
|
+
"typescript/no-wrapper-object-types": "warn",
|
|
1053
|
+
"typescript/non-nullable-type-assertion-style": "off",
|
|
1054
|
+
"typescript/only-throw-error": "off",
|
|
1055
|
+
"typescript/parameter-properties": "off",
|
|
1056
|
+
"typescript/prefer-as-const": "error",
|
|
1057
|
+
"typescript/prefer-enum-initializers": "error",
|
|
1058
|
+
"typescript/prefer-find": "off",
|
|
1059
|
+
"typescript/prefer-for-of": "error",
|
|
1060
|
+
"typescript/prefer-function-type": "error",
|
|
1061
|
+
"typescript/prefer-includes": "off",
|
|
1062
|
+
"typescript/prefer-literal-enum-member": "error",
|
|
1063
|
+
"typescript/prefer-namespace-keyword": "warn",
|
|
1064
|
+
"typescript/prefer-nullish-coalescing": "off",
|
|
1065
|
+
"typescript/prefer-optional-chain": "off",
|
|
1066
|
+
"typescript/prefer-promise-reject-errors": "off",
|
|
1067
|
+
"typescript/prefer-readonly": "off",
|
|
1068
|
+
"typescript/prefer-readonly-parameter-types": "off",
|
|
1069
|
+
"typescript/prefer-reduce-type-parameter": "off",
|
|
1070
|
+
"typescript/prefer-regexp-exec": "off",
|
|
1071
|
+
"typescript/prefer-return-this-type": "off",
|
|
1072
|
+
"typescript/prefer-string-starts-ends-with": "off",
|
|
1073
|
+
"typescript/prefer-ts-expect-error": "warn",
|
|
1074
|
+
"typescript/promise-function-async": "off",
|
|
1075
|
+
"typescript/related-getter-setter-pairs": "off",
|
|
1076
|
+
"typescript/require-array-sort-compare": "off",
|
|
1077
|
+
"typescript/require-await": "off",
|
|
1078
|
+
"typescript/restrict-plus-operands": "off",
|
|
1079
|
+
"typescript/restrict-template-expressions": "off",
|
|
1080
|
+
"typescript/return-await": "off",
|
|
1081
|
+
"typescript/strict-boolean-expressions": "off",
|
|
1082
|
+
"typescript/strict-void-return": "off",
|
|
1083
|
+
"typescript/switch-exhaustiveness-check": "off",
|
|
1084
|
+
"typescript/triple-slash-reference": "off",
|
|
1085
|
+
"typescript/unbound-method": "off",
|
|
1086
|
+
"typescript/unified-signatures": "error",
|
|
1087
|
+
"typescript/use-unknown-in-catch-callback-variable": "off"
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
};
|
|
1091
|
+
//#endregion
|
|
1092
|
+
//#region src/oxlint/config.unicorn.ts
|
|
1093
|
+
const unicornConfig = () => {
|
|
1094
|
+
return {
|
|
1095
|
+
...emptyOxlintConfig,
|
|
1096
|
+
rules: {
|
|
1097
|
+
"unicorn/catch-error-name": "warn",
|
|
1098
|
+
"unicorn/consistent-assert": "warn",
|
|
1099
|
+
"unicorn/consistent-date-clone": "warn",
|
|
1100
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
1101
|
+
"unicorn/consistent-existence-index-check": "warn",
|
|
1102
|
+
"unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
|
|
1103
|
+
"unicorn/consistent-template-literal-escape": "warn",
|
|
1104
|
+
"unicorn/custom-error-definition": "error",
|
|
1105
|
+
"unicorn/empty-brace-spaces": "warn",
|
|
1106
|
+
"unicorn/error-message": "error",
|
|
1107
|
+
"unicorn/escape-case": "warn",
|
|
1108
|
+
"unicorn/explicit-length-check": "off",
|
|
1109
|
+
"unicorn/explicit-timer-delay": "warn",
|
|
1110
|
+
"unicorn/filename-case": ["error", { cases: {
|
|
1111
|
+
kebabCase: true,
|
|
1112
|
+
pascalCase: true
|
|
1113
|
+
} }],
|
|
1114
|
+
"unicorn/import-style": "off",
|
|
1115
|
+
"unicorn/max-nested-calls": "off",
|
|
1116
|
+
"unicorn/new-for-builtins": "error",
|
|
1117
|
+
"unicorn/no-abusive-eslint-disable": "error",
|
|
1118
|
+
"unicorn/no-accessor-recursion": "error",
|
|
1119
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
1120
|
+
"unicorn/no-array-callback-reference": "off",
|
|
1121
|
+
"unicorn/no-array-fill-with-reference-type": "error",
|
|
1122
|
+
"unicorn/no-array-for-each": "error",
|
|
1123
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
1124
|
+
"unicorn/no-array-reduce": "error",
|
|
1125
|
+
"unicorn/no-array-reverse": "warn",
|
|
1126
|
+
"unicorn/no-array-sort": "warn",
|
|
1127
|
+
"unicorn/no-await-expression-member": "error",
|
|
1128
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
1129
|
+
"unicorn/no-confusing-array-with": "error",
|
|
1130
|
+
"unicorn/no-console-spaces": "warn",
|
|
1131
|
+
"unicorn/no-document-cookie": "error",
|
|
1132
|
+
"unicorn/no-empty-file": "error",
|
|
1133
|
+
"unicorn/no-hex-escape": "warn",
|
|
1134
|
+
"unicorn/no-immediate-mutation": "error",
|
|
1135
|
+
"unicorn/no-instanceof-array": "warn",
|
|
1136
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
1137
|
+
"unicorn/no-invalid-fetch-options": "error",
|
|
1138
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1139
|
+
"unicorn/no-length-as-slice-end": "warn",
|
|
1140
|
+
"unicorn/no-lonely-if": "error",
|
|
1141
|
+
"unicorn/no-magic-array-flat-depth": "error",
|
|
1142
|
+
"unicorn/no-negated-condition": "warn",
|
|
1143
|
+
"unicorn/no-negation-in-equality-check": "error",
|
|
1144
|
+
"unicorn/no-nested-ternary": "off",
|
|
1145
|
+
"unicorn/no-new-array": "error",
|
|
1146
|
+
"unicorn/no-new-buffer": "error",
|
|
1147
|
+
"unicorn/no-null": "off",
|
|
1148
|
+
"unicorn/no-object-as-default-parameter": "error",
|
|
1149
|
+
"unicorn/no-process-exit": "error",
|
|
1150
|
+
"unicorn/no-single-promise-in-promise-methods": "error",
|
|
1151
|
+
"unicorn/no-static-only-class": "error",
|
|
1152
|
+
"unicorn/no-thenable": "error",
|
|
1153
|
+
"unicorn/no-this-assignment": "error",
|
|
1154
|
+
"unicorn/no-typeof-undefined": "error",
|
|
1155
|
+
"unicorn/no-unnecessary-array-flat-depth": "error",
|
|
1156
|
+
"unicorn/no-unnecessary-array-splice-count": "warn",
|
|
1157
|
+
"unicorn/no-unnecessary-await": "error",
|
|
1158
|
+
"unicorn/no-unnecessary-slice-end": "warn",
|
|
1159
|
+
"unicorn/no-unreadable-array-destructuring": "error",
|
|
1160
|
+
"unicorn/no-unreadable-iife": "error",
|
|
1161
|
+
"unicorn/no-useless-collection-argument": "error",
|
|
1162
|
+
"unicorn/no-useless-error-capture-stack-trace": "error",
|
|
1163
|
+
"unicorn/no-useless-fallback-in-spread": "error",
|
|
1164
|
+
"unicorn/no-useless-iterator-to-array": "error",
|
|
1165
|
+
"unicorn/no-useless-length-check": "error",
|
|
1166
|
+
"unicorn/no-useless-promise-resolve-reject": "warn",
|
|
1167
|
+
"unicorn/no-useless-spread": "error",
|
|
1168
|
+
"unicorn/no-useless-switch-case": "error",
|
|
1169
|
+
"unicorn/no-useless-undefined": "warn",
|
|
1170
|
+
"unicorn/no-zero-fractions": "warn",
|
|
1171
|
+
"unicorn/number-literal-case": "warn",
|
|
1172
|
+
"unicorn/numeric-separators-style": "warn",
|
|
1173
|
+
"unicorn/prefer-add-event-listener": "error",
|
|
1174
|
+
"unicorn/prefer-array-find": "error",
|
|
1175
|
+
"unicorn/prefer-array-flat": "error",
|
|
1176
|
+
"unicorn/prefer-array-flat-map": "warn",
|
|
1177
|
+
"unicorn/prefer-array-index-of": "error",
|
|
1178
|
+
"unicorn/prefer-array-some": "error",
|
|
1179
|
+
"unicorn/prefer-at": "error",
|
|
1180
|
+
"unicorn/prefer-bigint-literals": "warn",
|
|
1181
|
+
"unicorn/prefer-blob-reading-methods": "error",
|
|
1182
|
+
"unicorn/prefer-class-fields": "error",
|
|
1183
|
+
"unicorn/prefer-classlist-toggle": "warn",
|
|
1184
|
+
"unicorn/prefer-code-point": "warn",
|
|
1185
|
+
"unicorn/prefer-date-now": "warn",
|
|
1186
|
+
"unicorn/prefer-default-parameters": "warn",
|
|
1187
|
+
"unicorn/prefer-dom-node-append": "warn",
|
|
1188
|
+
"unicorn/prefer-dom-node-dataset": "error",
|
|
1189
|
+
"unicorn/prefer-dom-node-remove": "error",
|
|
1190
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1191
|
+
"unicorn/prefer-event-target": "error",
|
|
1192
|
+
"unicorn/prefer-export-from": "error",
|
|
1193
|
+
"unicorn/prefer-global-this": "off",
|
|
1194
|
+
"unicorn/prefer-import-meta-properties": "warn",
|
|
1195
|
+
"unicorn/prefer-includes": "error",
|
|
1196
|
+
"unicorn/prefer-keyboard-event-key": "warn",
|
|
1197
|
+
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
1198
|
+
"unicorn/prefer-math-min-max": "warn",
|
|
1199
|
+
"unicorn/prefer-math-trunc": "error",
|
|
1200
|
+
"unicorn/prefer-modern-dom-apis": "error",
|
|
1201
|
+
"unicorn/prefer-modern-math-apis": "error",
|
|
1202
|
+
"unicorn/prefer-module": "off",
|
|
1203
|
+
"unicorn/prefer-native-coercion-functions": "error",
|
|
1204
|
+
"unicorn/prefer-negative-index": "warn",
|
|
1205
|
+
"unicorn/prefer-node-protocol": "warn",
|
|
1206
|
+
"unicorn/prefer-number-coercion": "error",
|
|
1207
|
+
"unicorn/prefer-number-properties": "error",
|
|
1208
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
1209
|
+
"unicorn/prefer-optional-catch-binding": "warn",
|
|
1210
|
+
"unicorn/prefer-prototype-methods": "warn",
|
|
1211
|
+
"unicorn/prefer-query-selector": "error",
|
|
1212
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
1213
|
+
"unicorn/prefer-regexp-test": "warn",
|
|
1214
|
+
"unicorn/prefer-response-static-json": "error",
|
|
1215
|
+
"unicorn/prefer-set-has": "error",
|
|
1216
|
+
"unicorn/prefer-set-size": "warn",
|
|
1217
|
+
"unicorn/prefer-single-call": "warn",
|
|
1218
|
+
"unicorn/prefer-spread": "error",
|
|
1219
|
+
"unicorn/prefer-string-raw": "off",
|
|
1220
|
+
"unicorn/prefer-string-replace-all": "off",
|
|
1221
|
+
"unicorn/prefer-string-slice": "error",
|
|
1222
|
+
"unicorn/prefer-string-starts-ends-with": "warn",
|
|
1223
|
+
"unicorn/prefer-string-trim-start-end": "warn",
|
|
1224
|
+
"unicorn/prefer-structured-clone": "off",
|
|
1225
|
+
"unicorn/prefer-ternary": ["error", "only-single-line"],
|
|
1226
|
+
"unicorn/prefer-top-level-await": "off",
|
|
1227
|
+
"unicorn/prefer-type-error": "warn",
|
|
1228
|
+
"unicorn/relative-url-style": "error",
|
|
1229
|
+
"unicorn/require-array-join-separator": "error",
|
|
1230
|
+
"unicorn/require-module-attributes": "error",
|
|
1231
|
+
"unicorn/require-module-specifiers": "warn",
|
|
1232
|
+
"unicorn/require-number-to-fixed-digits-argument": "warn",
|
|
1233
|
+
"unicorn/require-post-message-target-origin": "error",
|
|
1234
|
+
"unicorn/switch-case-braces": ["warn", "avoid"],
|
|
1235
|
+
"unicorn/switch-case-break-position": "error",
|
|
1236
|
+
"unicorn/text-encoding-identifier-case": "warn",
|
|
1237
|
+
"unicorn/throw-new-error": "warn"
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
};
|
|
1241
|
+
//#endregion
|
|
1242
|
+
//#region src/oxlint/config.vitest.ts
|
|
1243
|
+
const vitestConfig = () => {
|
|
1244
|
+
return {
|
|
1245
|
+
...emptyOxlintConfig,
|
|
1246
|
+
overrides: [{
|
|
1247
|
+
files: ["**/*.{spec,test}.{js,cjs,mjs,jsx,ts,tsx}"],
|
|
1248
|
+
rules: {
|
|
1249
|
+
"no-console": "off",
|
|
1250
|
+
"vitest/consistent-each-for": "off",
|
|
1251
|
+
"vitest/consistent-test-filename": "error",
|
|
1252
|
+
"vitest/consistent-test-it": "warn",
|
|
1253
|
+
"vitest/consistent-vitest-vi": "warn",
|
|
1254
|
+
"vitest/expect-expect": "off",
|
|
1255
|
+
"vitest/hoisted-apis-on-top": "error",
|
|
1256
|
+
"vitest/max-expects": "off",
|
|
1257
|
+
"vitest/max-nested-describe": "error",
|
|
1258
|
+
"vitest/no-alias-methods": "warn",
|
|
1259
|
+
"vitest/no-commented-out-tests": "error",
|
|
1260
|
+
"vitest/no-conditional-expect": "error",
|
|
1261
|
+
"vitest/no-conditional-in-test": "error",
|
|
1262
|
+
"vitest/no-conditional-tests": "error",
|
|
1263
|
+
"vitest/no-disabled-tests": "error",
|
|
1264
|
+
"vitest/no-duplicate-hooks": "error",
|
|
1265
|
+
"vitest/no-focused-tests": "error",
|
|
1266
|
+
"vitest/no-hooks": "off",
|
|
1267
|
+
"vitest/no-identical-title": "error",
|
|
1268
|
+
"vitest/no-import-node-test": "error",
|
|
1269
|
+
"vitest/no-importing-vitest-globals": "off",
|
|
1270
|
+
"vitest/no-interpolation-in-snapshots": "error",
|
|
1271
|
+
"vitest/no-large-snapshots": "error",
|
|
1272
|
+
"vitest/no-mocks-import": "error",
|
|
1273
|
+
"vitest/no-restricted-matchers": "off",
|
|
1274
|
+
"vitest/no-restricted-vi-methods": "off",
|
|
1275
|
+
"vitest/no-standalone-expect": ["error", { additionalTestBlockFunctions: ["test.extend"] }],
|
|
1276
|
+
"vitest/no-test-prefixes": "warn",
|
|
1277
|
+
"vitest/no-test-return-statement": "error",
|
|
1278
|
+
"vitest/no-unneeded-async-expect-function": "warn",
|
|
1279
|
+
"vitest/padding-around-after-all-blocks": "warn",
|
|
1280
|
+
"vitest/padding-around-test-blocks": "warn",
|
|
1281
|
+
"vitest/prefer-called-exactly-once-with": "error",
|
|
1282
|
+
"vitest/prefer-called-once": "warn",
|
|
1283
|
+
"vitest/prefer-called-times": "off",
|
|
1284
|
+
"vitest/prefer-called-with": "off",
|
|
1285
|
+
"vitest/prefer-comparison-matcher": "warn",
|
|
1286
|
+
"vitest/prefer-describe-function-title": "warn",
|
|
1287
|
+
"vitest/prefer-each": "error",
|
|
1288
|
+
"vitest/prefer-equality-matcher": "error",
|
|
1289
|
+
"vitest/prefer-expect-assertions": "off",
|
|
1290
|
+
"vitest/prefer-expect-resolves": "warn",
|
|
1291
|
+
"vitest/prefer-expect-type-of": "warn",
|
|
1292
|
+
"vitest/prefer-hooks-in-order": "error",
|
|
1293
|
+
"vitest/prefer-hooks-on-top": "error",
|
|
1294
|
+
"vitest/prefer-import-in-mock": "warn",
|
|
1295
|
+
"vitest/prefer-importing-vitest-globals": "warn",
|
|
1296
|
+
"vitest/prefer-lowercase-title": "warn",
|
|
1297
|
+
"vitest/prefer-mock-promise-shorthand": "error",
|
|
1298
|
+
"vitest/prefer-mock-return-shorthand": "warn",
|
|
1299
|
+
"vitest/prefer-snapshot-hint": "error",
|
|
1300
|
+
"vitest/prefer-spy-on": "error",
|
|
1301
|
+
"vitest/prefer-strict-boolean-matchers": "warn",
|
|
1302
|
+
"vitest/prefer-strict-equal": "warn",
|
|
1303
|
+
"vitest/prefer-to-be": "warn",
|
|
1304
|
+
"vitest/prefer-to-be-falsy": "off",
|
|
1305
|
+
"vitest/prefer-to-be-object": "warn",
|
|
1306
|
+
"vitest/prefer-to-be-truthy": "off",
|
|
1307
|
+
"vitest/prefer-to-contain": "warn",
|
|
1308
|
+
"vitest/prefer-to-have-been-called-times": "warn",
|
|
1309
|
+
"vitest/prefer-to-have-length": "warn",
|
|
1310
|
+
"vitest/prefer-todo": "warn",
|
|
1311
|
+
"vitest/require-awaited-expect-poll": "error",
|
|
1312
|
+
"vitest/require-hook": "error",
|
|
1313
|
+
"vitest/require-local-test-context-for-concurrent-snapshots": "error",
|
|
1314
|
+
"vitest/require-mock-type-parameters": "off",
|
|
1315
|
+
"vitest/require-test-timeout": "off",
|
|
1316
|
+
"vitest/require-to-throw-message": "error",
|
|
1317
|
+
"vitest/require-top-level-describe": "off",
|
|
1318
|
+
"vitest/valid-describe-callback": "error",
|
|
1319
|
+
"vitest/valid-expect": "error",
|
|
1320
|
+
"vitest/valid-expect-in-promise": "error",
|
|
1321
|
+
"vitest/valid-title": ["error", { ignoreTypeOfDescribeName: true }],
|
|
1322
|
+
"vitest/warn-todo": "off"
|
|
1323
|
+
}
|
|
1324
|
+
}]
|
|
1325
|
+
};
|
|
1326
|
+
};
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region src/oxlint/oxlint.ts
|
|
1329
|
+
const configs = [
|
|
1330
|
+
baseConfig,
|
|
1331
|
+
importConfig,
|
|
1332
|
+
jsdocConfig,
|
|
1333
|
+
nodeConfig,
|
|
1334
|
+
oxcConfig,
|
|
1335
|
+
perfectionistConfig,
|
|
1336
|
+
promiseConfig,
|
|
1337
|
+
typescriptConfig,
|
|
1338
|
+
vitestConfig,
|
|
1339
|
+
unicornConfig,
|
|
1340
|
+
reactConfig,
|
|
1341
|
+
tailwindConfig
|
|
1342
|
+
];
|
|
1343
|
+
function oxlintConfig(options) {
|
|
1344
|
+
const categories = {};
|
|
1345
|
+
const env = {};
|
|
1346
|
+
const jsPlugins = [];
|
|
1347
|
+
const overrides = [];
|
|
1348
|
+
const plugins = [];
|
|
1349
|
+
const rules = {};
|
|
1350
|
+
const settings = {};
|
|
1351
|
+
for (const configFn of configs) {
|
|
1352
|
+
const config = configFn(options);
|
|
1353
|
+
Object.assign(categories, config.categories);
|
|
1354
|
+
Object.assign(env, config.env);
|
|
1355
|
+
jsPlugins.push(...config.jsPlugins);
|
|
1356
|
+
overrides.push(...config.overrides);
|
|
1357
|
+
plugins.push(...config.plugins);
|
|
1358
|
+
Object.assign(rules, config.rules);
|
|
1359
|
+
Object.assign(settings, config.settings);
|
|
1360
|
+
}
|
|
1361
|
+
return {
|
|
1362
|
+
categories,
|
|
1363
|
+
env,
|
|
1364
|
+
globals: {},
|
|
1365
|
+
ignorePatterns: [
|
|
1366
|
+
"**/node_modules",
|
|
1367
|
+
"**/dist",
|
|
1368
|
+
"**/package-lock.json",
|
|
1369
|
+
"**/yarn.lock",
|
|
1370
|
+
"**/pnpm-lock.yaml",
|
|
1371
|
+
"**/bun.lockb",
|
|
1372
|
+
"**/output",
|
|
1373
|
+
"**/coverage",
|
|
1374
|
+
"**/temp",
|
|
1375
|
+
"**/.vitepress/cache",
|
|
1376
|
+
"**/.nuxt",
|
|
1377
|
+
"**/.next",
|
|
1378
|
+
"**/.vercel",
|
|
1379
|
+
"**/.changeset",
|
|
1380
|
+
"**/.idea",
|
|
1381
|
+
"**/.cache",
|
|
1382
|
+
"**/.output",
|
|
1383
|
+
"**/.vite-inspect",
|
|
1384
|
+
"**/CHANGELOG*.md",
|
|
1385
|
+
"**/*.min.*",
|
|
1386
|
+
"**/LICENSE*",
|
|
1387
|
+
"**/__snapshots__",
|
|
1388
|
+
"**/auto-import?(s).d.ts",
|
|
1389
|
+
"**/components.d.ts",
|
|
1390
|
+
"**/mockServiceWorker.js",
|
|
1391
|
+
"**/dist/",
|
|
1392
|
+
"**/.DS_Store",
|
|
1393
|
+
"**/.vscode",
|
|
1394
|
+
"**/.swc",
|
|
1395
|
+
"**/tsconfig.vitest-temp.json",
|
|
1396
|
+
"dependency-check-report.html"
|
|
1397
|
+
],
|
|
1398
|
+
jsPlugins: ["eslint-plugin-perfectionist", ...jsPlugins],
|
|
1399
|
+
options: {
|
|
1400
|
+
reportUnusedDisableDirectives: "error",
|
|
1401
|
+
respectEslintDisableDirectives: true
|
|
1402
|
+
},
|
|
1403
|
+
overrides,
|
|
1404
|
+
plugins: [
|
|
1405
|
+
"eslint",
|
|
1406
|
+
"import",
|
|
1407
|
+
"jsdoc",
|
|
1408
|
+
"node",
|
|
1409
|
+
"oxc",
|
|
1410
|
+
"promise",
|
|
1411
|
+
"typescript",
|
|
1412
|
+
"unicorn",
|
|
1413
|
+
"vitest",
|
|
1414
|
+
...plugins
|
|
1415
|
+
],
|
|
1416
|
+
rules,
|
|
1417
|
+
settings
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1420
|
+
//#endregion
|
|
1421
|
+
export { oxfmtConfig, oxlintConfig };
|