@debbl/eslint-config 2.4.1 → 3.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/dist/index.js CHANGED
@@ -1,1591 +1 @@
1
- // src/configs/comments.ts
2
- async function comments() {
3
- const pluginComments = await interopDefault(
4
- // @ts-expect-error missing types
5
- import("eslint-plugin-eslint-comments")
6
- );
7
- return [
8
- {
9
- name: "eslint:eslint-comments",
10
- plugins: {
11
- "eslint-comments": pluginComments
12
- },
13
- rules: {
14
- "eslint-comments/no-aggregating-enable": "error",
15
- "eslint-comments/no-duplicate-disable": "error",
16
- "eslint-comments/no-unlimited-disable": "error",
17
- "eslint-comments/no-unused-enable": "error"
18
- }
19
- }
20
- ];
21
- }
22
-
23
- // src/configs/ignores.ts
24
- import fs from "fs";
25
- import path from "path";
26
-
27
- // src/globs.ts
28
- var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
29
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
30
- var GLOB_JS = "**/*.?([cm])js";
31
- var GLOB_JSX = "**/*.?([cm])jsx";
32
- var GLOB_TS = "**/*.?([cm])ts";
33
- var GLOB_TSX = "**/*.?([cm])tsx";
34
- var GLOB_STYLE = "**/*.{c,le,sc}ss";
35
- var GLOB_CSS = "**/*.css";
36
- var GLOB_POSTCSS = "**/*.{p,post}css";
37
- var GLOB_LESS = "**/*.less";
38
- var GLOB_SCSS = "**/*.scss";
39
- var GLOB_JSON = "**/*.json";
40
- var GLOB_JSON5 = "**/*.json5";
41
- var GLOB_JSONC = "**/*.jsonc";
42
- var GLOB_MARKDOWN = "**/*.md";
43
- var GLOB_MDX = "**/*.mdx";
44
- var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
45
- var GLOB_VUE = "**/*.vue";
46
- var GLOB_YAML = "**/*.y?(a)ml";
47
- var GLOB_TOML = "**/*.toml";
48
- var GLOB_HTML = "**/*.htm?(l)";
49
- var GLOB_TESTS = [
50
- `**/__tests__/**/*.${GLOB_SRC_EXT}`,
51
- `**/*.spec.${GLOB_SRC_EXT}`,
52
- `**/*.test.${GLOB_SRC_EXT}`,
53
- `**/*.bench.${GLOB_SRC_EXT}`,
54
- `**/*.benchmark.${GLOB_SRC_EXT}`
55
- ];
56
- var GLOB_ALL_SRC = [
57
- GLOB_SRC,
58
- GLOB_STYLE,
59
- GLOB_JSON,
60
- GLOB_JSON5,
61
- GLOB_MARKDOWN,
62
- GLOB_VUE,
63
- GLOB_YAML,
64
- GLOB_HTML
65
- ];
66
- var GLOB_EXCLUDE = [
67
- "**/node_modules",
68
- "**/dist",
69
- "**/package-lock.json",
70
- "**/yarn.lock",
71
- "**/pnpm-lock.yaml",
72
- "**/bun.lockb",
73
- "**/output",
74
- "**/coverage",
75
- "**/temp",
76
- "**/.vitepress/cache",
77
- "**/.nuxt",
78
- "**/.next",
79
- "**/.vercel",
80
- "**/.changeset",
81
- "**/.idea",
82
- "**/.cache",
83
- "**/.output",
84
- "**/.vite-inspect",
85
- "**/CHANGELOG*.md",
86
- "**/*.min.*",
87
- "**/LICENSE*",
88
- "**/__snapshots__",
89
- "**/auto-import?(s).d.ts",
90
- "**/components.d.ts"
91
- ];
92
-
93
- // src/configs/ignores.ts
94
- var REGEX_SPLIT_ALL_CRLF = /\r?\n/g;
95
- var splitPattern = (pattern) => pattern.split(REGEX_SPLIT_ALL_CRLF);
96
- async function ignores(options) {
97
- const { enableGitignore } = options;
98
- if (enableGitignore) {
99
- let ignorePath = ".gitignore";
100
- if (typeof enableGitignore !== "boolean") {
101
- ignorePath = enableGitignore.ignorePath;
102
- }
103
- const gitignorePath = path.join(process.cwd(), ignorePath);
104
- let ignoreList = [];
105
- if (fs.existsSync(gitignorePath)) {
106
- ignoreList = splitPattern(fs.readFileSync(gitignorePath).toString()).filter((i) => !(i.startsWith("#") || i.length === 0)).map((i) => i.startsWith("/") ? i.slice(1) : i);
107
- return [
108
- {
109
- ignores: [...ignoreList, ...GLOB_EXCLUDE]
110
- }
111
- ];
112
- }
113
- }
114
- return [
115
- {
116
- ignores: GLOB_EXCLUDE
117
- }
118
- ];
119
- }
120
-
121
- // src/utils.ts
122
- async function combine(...configs) {
123
- const resolved = await Promise.all(configs);
124
- return resolved.flat();
125
- }
126
- async function interopDefault(m) {
127
- const resolved = await m;
128
- return resolved.default || resolved;
129
- }
130
-
131
- // src/configs/imports.ts
132
- async function imports() {
133
- const pluginImport = await interopDefault(import("eslint-plugin-i"));
134
- return [
135
- {
136
- name: "eslint:imports",
137
- plugins: {
138
- import: pluginImport
139
- },
140
- rules: {
141
- "import/first": "error",
142
- "import/no-duplicates": "error",
143
- "import/no-mutable-exports": "error",
144
- "import/no-named-default": "error",
145
- "import/no-self-import": "error",
146
- "import/no-webpack-loader-syntax": "error",
147
- "import/order": "error",
148
- "import/newline-after-import": [
149
- "error",
150
- { considerComments: true, count: 1 }
151
- ]
152
- }
153
- }
154
- ];
155
- }
156
-
157
- // src/configs/javascript.ts
158
- import globals from "globals";
159
- async function javascript() {
160
- const pluginUnusedImports = await interopDefault(
161
- // @ts-expect-error missing types
162
- import("eslint-plugin-unused-imports")
163
- );
164
- return [
165
- {
166
- name: "eslint:javascript",
167
- languageOptions: {
168
- ecmaVersion: 2022,
169
- globals: {
170
- ...globals.browser,
171
- ...globals.es2021,
172
- ...globals.node,
173
- document: "readonly",
174
- navigator: "readonly",
175
- window: "readonly"
176
- },
177
- parserOptions: {
178
- ecmaFeatures: {
179
- jsx: true
180
- },
181
- ecmaVersion: 2022,
182
- sourceType: "module"
183
- },
184
- sourceType: "module"
185
- },
186
- linterOptions: {
187
- reportUnusedDisableDirectives: true
188
- },
189
- plugins: {
190
- "unused-imports": pluginUnusedImports
191
- },
192
- rules: {
193
- "accessor-pairs": [
194
- "error",
195
- { enforceForClassMembers: true, setWithoutGet: true }
196
- ],
197
- "array-callback-return": "error",
198
- "block-scoped-var": "error",
199
- "constructor-super": "error",
200
- "default-case-last": "error",
201
- "dot-notation": ["error", { allowKeywords: true }],
202
- "eqeqeq": ["error", "smart"],
203
- "new-cap": [
204
- "error",
205
- { capIsNew: false, newIsCap: true, properties: true }
206
- ],
207
- "no-alert": "error",
208
- "no-array-constructor": "error",
209
- "no-async-promise-executor": "error",
210
- "no-caller": "error",
211
- "no-case-declarations": "error",
212
- "no-class-assign": "error",
213
- "no-compare-neg-zero": "error",
214
- "no-cond-assign": ["error", "always"],
215
- "no-console": ["error", { allow: ["warn", "error"] }],
216
- "no-const-assign": "error",
217
- "no-control-regex": "error",
218
- "no-debugger": "error",
219
- "no-delete-var": "error",
220
- "no-dupe-args": "error",
221
- "no-dupe-class-members": "error",
222
- "no-dupe-keys": "error",
223
- "no-duplicate-case": "error",
224
- "no-empty": ["error", { allowEmptyCatch: true }],
225
- "no-empty-character-class": "error",
226
- "no-empty-pattern": "error",
227
- "no-eval": "error",
228
- "no-ex-assign": "error",
229
- "no-extend-native": "error",
230
- "no-extra-bind": "error",
231
- "no-extra-boolean-cast": "error",
232
- "no-fallthrough": "error",
233
- "no-func-assign": "error",
234
- "no-global-assign": "error",
235
- "no-implied-eval": "error",
236
- "no-import-assign": "error",
237
- "no-invalid-regexp": "error",
238
- "no-invalid-this": "error",
239
- "no-irregular-whitespace": "error",
240
- "no-iterator": "error",
241
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
242
- "no-lone-blocks": "error",
243
- "no-loss-of-precision": "error",
244
- "no-misleading-character-class": "error",
245
- "no-multi-str": "error",
246
- "no-new": "error",
247
- "no-new-func": "error",
248
- "no-new-object": "error",
249
- "no-new-symbol": "error",
250
- "no-new-wrappers": "error",
251
- "no-obj-calls": "error",
252
- "no-octal": "error",
253
- "no-octal-escape": "error",
254
- "no-proto": "error",
255
- "no-prototype-builtins": "error",
256
- "no-redeclare": ["error", { builtinGlobals: false }],
257
- "no-regex-spaces": "error",
258
- "no-restricted-globals": [
259
- "error",
260
- { message: "Use `globalThis` instead.", name: "global" },
261
- { message: "Use `globalThis` instead.", name: "self" }
262
- ],
263
- "no-restricted-properties": [
264
- "error",
265
- {
266
- message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
267
- property: "__proto__"
268
- },
269
- {
270
- message: "Use `Object.defineProperty` instead.",
271
- property: "__defineGetter__"
272
- },
273
- {
274
- message: "Use `Object.defineProperty` instead.",
275
- property: "__defineSetter__"
276
- },
277
- {
278
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
279
- property: "__lookupGetter__"
280
- },
281
- {
282
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
283
- property: "__lookupSetter__"
284
- }
285
- ],
286
- "no-restricted-syntax": [
287
- "error",
288
- "DebuggerStatement",
289
- "LabeledStatement",
290
- "WithStatement",
291
- "TSEnumDeclaration[const=true]",
292
- "TSExportAssignment"
293
- ],
294
- "no-self-assign": ["error", { props: true }],
295
- "no-self-compare": "error",
296
- "no-sequences": "error",
297
- "no-shadow-restricted-names": "error",
298
- "no-sparse-arrays": "error",
299
- "no-template-curly-in-string": "error",
300
- "no-this-before-super": "error",
301
- "no-throw-literal": "error",
302
- "no-undef": "error",
303
- "no-undef-init": "error",
304
- "no-unexpected-multiline": "error",
305
- "no-unmodified-loop-condition": "error",
306
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
307
- "no-unreachable": "error",
308
- "no-unreachable-loop": "error",
309
- "no-unsafe-finally": "error",
310
- "no-unsafe-negation": "error",
311
- "no-unused-expressions": [
312
- "error",
313
- {
314
- allowShortCircuit: true,
315
- allowTaggedTemplates: true,
316
- allowTernary: true
317
- }
318
- ],
319
- "no-unused-vars": [
320
- "error",
321
- {
322
- args: "none",
323
- caughtErrors: "none",
324
- ignoreRestSiblings: true,
325
- vars: "all"
326
- }
327
- ],
328
- "no-use-before-define": [
329
- "error",
330
- { classes: false, functions: false, variables: true }
331
- ],
332
- "no-useless-backreference": "error",
333
- "no-useless-call": "error",
334
- "no-useless-catch": "error",
335
- "no-useless-computed-key": "error",
336
- "no-useless-constructor": "error",
337
- "no-useless-rename": "error",
338
- "no-useless-return": "error",
339
- "no-var": "error",
340
- "no-with": "error",
341
- "object-shorthand": [
342
- "error",
343
- "always",
344
- {
345
- avoidQuotes: true,
346
- ignoreConstructors: false
347
- }
348
- ],
349
- "one-var": ["error", { initialized: "never" }],
350
- "prefer-arrow-callback": [
351
- "error",
352
- {
353
- allowNamedFunctions: false,
354
- allowUnboundThis: true
355
- }
356
- ],
357
- "prefer-const": [
358
- "error",
359
- {
360
- destructuring: "all",
361
- ignoreReadBeforeAssign: true
362
- }
363
- ],
364
- "prefer-exponentiation-operator": "error",
365
- "prefer-promise-reject-errors": "error",
366
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
367
- "prefer-rest-params": "error",
368
- "prefer-spread": "error",
369
- "prefer-template": "error",
370
- "sort-imports": [
371
- "error",
372
- {
373
- allowSeparatedGroups: false,
374
- ignoreCase: false,
375
- ignoreDeclarationSort: true,
376
- ignoreMemberSort: false,
377
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
378
- }
379
- ],
380
- "symbol-description": "error",
381
- "unicode-bom": ["error", "never"],
382
- "unused-imports/no-unused-imports": "warn",
383
- "unused-imports/no-unused-vars": [
384
- "error",
385
- {
386
- args: "after-used",
387
- argsIgnorePattern: "^_",
388
- vars: "all",
389
- varsIgnorePattern: "^_"
390
- }
391
- ],
392
- "use-isnan": [
393
- "error",
394
- { enforceForIndexOf: true, enforceForSwitchCase: true }
395
- ],
396
- "valid-typeof": ["error", { requireStringLiterals: true }],
397
- "vars-on-top": "error",
398
- "yoda": ["error", "never"]
399
- }
400
- },
401
- {
402
- name: "eslint:scripts-overrides",
403
- files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
404
- rules: {
405
- "no-console": "off"
406
- }
407
- }
408
- ];
409
- }
410
-
411
- // src/configs/jsdoc.ts
412
- async function jsdoc() {
413
- return [
414
- {
415
- name: "eslint:jsdoc",
416
- plugins: {
417
- // @ts-expect-error missing types
418
- jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
419
- },
420
- rules: {
421
- "jsdoc/check-access": "warn",
422
- "jsdoc/check-param-names": "warn",
423
- "jsdoc/check-property-names": "warn",
424
- "jsdoc/check-types": "warn",
425
- "jsdoc/empty-tags": "warn",
426
- "jsdoc/implements-on-classes": "warn",
427
- "jsdoc/no-defaults": "warn",
428
- "jsdoc/no-multi-asterisks": "warn",
429
- "jsdoc/require-param-name": "warn",
430
- "jsdoc/require-property": "warn",
431
- "jsdoc/require-property-description": "warn",
432
- "jsdoc/require-property-name": "warn",
433
- "jsdoc/require-returns-check": "warn",
434
- "jsdoc/require-returns-description": "warn",
435
- "jsdoc/require-yields-check": "warn",
436
- "jsdoc/check-alignment": "warn",
437
- "jsdoc/multiline-blocks": "warn"
438
- }
439
- }
440
- ];
441
- }
442
-
443
- // src/configs/jsonc.ts
444
- async function jsonc() {
445
- const [pluginJsonc, parserJsonc] = await Promise.all([
446
- interopDefault(import("eslint-plugin-jsonc")),
447
- interopDefault(import("jsonc-eslint-parser"))
448
- ]);
449
- return [
450
- {
451
- name: "eslint:jsonc:setup",
452
- plugins: {
453
- jsonc: pluginJsonc
454
- }
455
- },
456
- {
457
- name: "eslint:jsonc:rules",
458
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
459
- languageOptions: {
460
- parser: parserJsonc
461
- },
462
- rules: {
463
- "jsonc/no-bigint-literals": "error",
464
- "jsonc/no-binary-expression": "error",
465
- "jsonc/no-binary-numeric-literals": "error",
466
- "jsonc/no-dupe-keys": "error",
467
- "jsonc/no-escape-sequence-in-identifier": "error",
468
- "jsonc/no-floating-decimal": "error",
469
- "jsonc/no-hexadecimal-numeric-literals": "error",
470
- "jsonc/no-infinity": "error",
471
- "jsonc/no-multi-str": "error",
472
- "jsonc/no-nan": "error",
473
- "jsonc/no-number-props": "error",
474
- "jsonc/no-numeric-separators": "error",
475
- "jsonc/no-octal": "error",
476
- "jsonc/no-octal-escape": "error",
477
- "jsonc/no-octal-numeric-literals": "error",
478
- "jsonc/no-parenthesized": "error",
479
- "jsonc/no-plus-sign": "error",
480
- "jsonc/no-regexp-literals": "error",
481
- "jsonc/no-sparse-arrays": "error",
482
- "jsonc/no-template-literals": "error",
483
- "jsonc/no-undefined-value": "error",
484
- "jsonc/no-unicode-codepoint-escapes": "error",
485
- "jsonc/no-useless-escape": "error",
486
- "jsonc/space-unary-ops": "error",
487
- "jsonc/valid-json-number": "error",
488
- "jsonc/vue-custom-block/no-parsing-error": "error",
489
- "jsonc/array-bracket-spacing": ["error", "never"],
490
- "jsonc/comma-dangle": ["error", "never"],
491
- "jsonc/comma-style": ["error", "last"],
492
- "jsonc/indent": ["error", 2],
493
- "jsonc/key-spacing": [
494
- "error",
495
- { afterColon: true, beforeColon: false }
496
- ],
497
- "jsonc/object-curly-newline": [
498
- "error",
499
- { consistent: true, multiline: true }
500
- ],
501
- "jsonc/object-curly-spacing": ["error", "always"],
502
- "jsonc/object-property-newline": [
503
- "error",
504
- { allowMultiplePropertiesPerLine: true }
505
- ],
506
- "jsonc/quote-props": "error",
507
- "jsonc/quotes": "error"
508
- }
509
- }
510
- ];
511
- }
512
-
513
- // src/configs/markdown.ts
514
- async function markdown(options = {}) {
515
- const { componentExts = [] } = options;
516
- const [pluginMdx, parserMdx] = await Promise.all([
517
- interopDefault(import("eslint-plugin-mdx")),
518
- interopDefault(import("eslint-mdx"))
519
- ]);
520
- return [
521
- {
522
- name: "eslint:markdown:setup",
523
- plugins: {
524
- mdx: pluginMdx
525
- }
526
- },
527
- {
528
- name: "eslint:markdown:processor",
529
- files: [GLOB_MARKDOWN, GLOB_MDX],
530
- languageOptions: {
531
- ecmaVersion: "latest",
532
- parser: parserMdx,
533
- sourceType: "module"
534
- },
535
- processor: "mdx/remark",
536
- settings: {
537
- "mdx/code-blocks": true
538
- }
539
- },
540
- {
541
- name: "eslint:markdown:rules",
542
- files: [
543
- GLOB_MARKDOWN_CODE,
544
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
545
- ],
546
- languageOptions: {
547
- parserOptions: {
548
- ecmaFeatures: {
549
- impliedStrict: true
550
- }
551
- }
552
- },
553
- rules: {
554
- "no-alert": "off",
555
- "no-console": "off",
556
- "no-undef": "off",
557
- "no-unused-expressions": "off",
558
- "no-unused-vars": "off",
559
- "node/prefer-global/process": "off",
560
- "style/comma-dangle": "off",
561
- "style/eol-last": "off",
562
- "@typescript-eslint/consistent-type-imports": "off",
563
- "@typescript-eslint/no-namespace": "off",
564
- "@typescript-eslint/no-redeclare": "off",
565
- "@typescript-eslint/no-require-imports": "off",
566
- "@typescript-eslint/no-unused-vars": "off",
567
- "@typescript-eslint/no-use-before-define": "off",
568
- "@typescript-eslint/no-var-requires": "off",
569
- "unicode-bom": "off",
570
- "unused-imports/no-unused-imports": "off",
571
- "unused-imports/no-unused-vars": "off",
572
- // Type aware rules
573
- ...{
574
- "@typescript-eslint/await-thenable": "off",
575
- "@typescript-eslint/dot-notation": "off",
576
- "@typescript-eslint/no-floating-promises": "off",
577
- "@typescript-eslint/no-for-in-array": "off",
578
- "@typescript-eslint/no-implied-eval": "off",
579
- "@typescript-eslint/no-misused-promises": "off",
580
- "@typescript-eslint/no-throw-literal": "off",
581
- "@typescript-eslint/no-unnecessary-type-assertion": "off",
582
- "@typescript-eslint/no-unsafe-argument": "off",
583
- "@typescript-eslint/no-unsafe-assignment": "off",
584
- "@typescript-eslint/no-unsafe-call": "off",
585
- "@typescript-eslint/no-unsafe-member-access": "off",
586
- "@typescript-eslint/no-unsafe-return": "off",
587
- "@typescript-eslint/restrict-plus-operands": "off",
588
- "@typescript-eslint/restrict-template-expressions": "off",
589
- "@typescript-eslint/unbound-method": "off"
590
- }
591
- }
592
- }
593
- ];
594
- }
595
-
596
- // src/configs/node.ts
597
- async function node() {
598
- const pluginNode = await interopDefault(import("eslint-plugin-n"));
599
- return [
600
- {
601
- name: "eslint:node",
602
- plugins: {
603
- n: pluginNode
604
- },
605
- rules: {
606
- "n/handle-callback-err": ["error", "^(err|error)$"],
607
- "n/no-deprecated-api": "error",
608
- "n/no-exports-assign": "error",
609
- "n/no-new-require": "error",
610
- "n/no-path-concat": "error",
611
- "n/prefer-global/buffer": ["error", "never"],
612
- "n/prefer-global/process": ["error", "never"],
613
- "n/process-exit-as-throw": "error"
614
- }
615
- }
616
- ];
617
- }
618
-
619
- // src/configs/sort.ts
620
- async function sortPackageJson() {
621
- return [
622
- {
623
- name: "eslint:sort-package-json",
624
- files: ["**/package.json"],
625
- rules: {
626
- "jsonc/sort-array-values": [
627
- "error",
628
- {
629
- order: { type: "asc" },
630
- pathPattern: "^files$"
631
- }
632
- ],
633
- "jsonc/sort-keys": [
634
- "error",
635
- {
636
- order: [
637
- "publisher",
638
- "name",
639
- "displayName",
640
- "type",
641
- "version",
642
- "private",
643
- "packageManager",
644
- "description",
645
- "author",
646
- "license",
647
- "funding",
648
- "homepage",
649
- "repository",
650
- "bugs",
651
- "keywords",
652
- "categories",
653
- "sideEffects",
654
- "exports",
655
- "main",
656
- "module",
657
- "unpkg",
658
- "jsdelivr",
659
- "types",
660
- "typesVersions",
661
- "bin",
662
- "icon",
663
- "files",
664
- "engines",
665
- "activationEvents",
666
- "contributes",
667
- "scripts",
668
- "peerDependencies",
669
- "peerDependenciesMeta",
670
- "dependencies",
671
- "optionalDependencies",
672
- "devDependencies",
673
- "pnpm",
674
- "overrides",
675
- "resolutions",
676
- "husky",
677
- "simple-git-hooks",
678
- "lint-staged",
679
- "eslintConfig"
680
- ],
681
- pathPattern: "^$"
682
- },
683
- {
684
- order: { type: "asc" },
685
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
686
- },
687
- {
688
- order: { type: "asc" },
689
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
690
- },
691
- {
692
- order: ["types", "import", "require", "default"],
693
- pathPattern: "^exports.*$"
694
- }
695
- ]
696
- }
697
- }
698
- ];
699
- }
700
- async function sortTsconfig() {
701
- return [
702
- {
703
- name: "eslint:sort-tsconfig",
704
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
705
- rules: {
706
- "jsonc/sort-keys": [
707
- "error",
708
- {
709
- order: [
710
- "extends",
711
- "compilerOptions",
712
- "references",
713
- "files",
714
- "include",
715
- "exclude"
716
- ],
717
- pathPattern: "^$"
718
- },
719
- {
720
- order: [
721
- /* Projects */
722
- "incremental",
723
- "composite",
724
- "tsBuildInfoFile",
725
- "disableSourceOfProjectReferenceRedirect",
726
- "disableSolutionSearching",
727
- "disableReferencedProjectLoad",
728
- /* Language and Environment */
729
- "target",
730
- "jsx",
731
- "jsxFactory",
732
- "jsxFragmentFactory",
733
- "jsxImportSource",
734
- "lib",
735
- "moduleDetection",
736
- "noLib",
737
- "reactNamespace",
738
- "useDefineForClassFields",
739
- "emitDecoratorMetadata",
740
- "experimentalDecorators",
741
- /* Modules */
742
- "baseUrl",
743
- "rootDir",
744
- "rootDirs",
745
- "customConditions",
746
- "module",
747
- "moduleResolution",
748
- "moduleSuffixes",
749
- "noResolve",
750
- "paths",
751
- "resolveJsonModule",
752
- "resolvePackageJsonExports",
753
- "resolvePackageJsonImports",
754
- "typeRoots",
755
- "types",
756
- "allowArbitraryExtensions",
757
- "allowImportingTsExtensions",
758
- "allowUmdGlobalAccess",
759
- /* JavaScript Support */
760
- "allowJs",
761
- "checkJs",
762
- "maxNodeModuleJsDepth",
763
- /* Type Checking */
764
- "strict",
765
- "strictBindCallApply",
766
- "strictFunctionTypes",
767
- "strictNullChecks",
768
- "strictPropertyInitialization",
769
- "allowUnreachableCode",
770
- "allowUnusedLabels",
771
- "alwaysStrict",
772
- "exactOptionalPropertyTypes",
773
- "noFallthroughCasesInSwitch",
774
- "noImplicitAny",
775
- "noImplicitOverride",
776
- "noImplicitReturns",
777
- "noImplicitThis",
778
- "noPropertyAccessFromIndexSignature",
779
- "noUncheckedIndexedAccess",
780
- "noUnusedLocals",
781
- "noUnusedParameters",
782
- "useUnknownInCatchVariables",
783
- /* Emit */
784
- "declaration",
785
- "declarationDir",
786
- "declarationMap",
787
- "downlevelIteration",
788
- "emitBOM",
789
- "emitDeclarationOnly",
790
- "importHelpers",
791
- "importsNotUsedAsValues",
792
- "inlineSourceMap",
793
- "inlineSources",
794
- "mapRoot",
795
- "newLine",
796
- "noEmit",
797
- "noEmitHelpers",
798
- "noEmitOnError",
799
- "outDir",
800
- "outFile",
801
- "preserveConstEnums",
802
- "preserveValueImports",
803
- "removeComments",
804
- "sourceMap",
805
- "sourceRoot",
806
- "stripInternal",
807
- /* Interop Constraints */
808
- "allowSyntheticDefaultImports",
809
- "esModuleInterop",
810
- "forceConsistentCasingInFileNames",
811
- "isolatedModules",
812
- "preserveSymlinks",
813
- "verbatimModuleSyntax",
814
- /* Completeness */
815
- "skipDefaultLibCheck",
816
- "skipLibCheck"
817
- ],
818
- pathPattern: "^compilerOptions$"
819
- }
820
- ]
821
- }
822
- }
823
- ];
824
- }
825
-
826
- // src/configs/typescript.ts
827
- import process2 from "process";
828
- var typeAwareRules = {
829
- "dot-notation": "off",
830
- "no-implied-eval": "off",
831
- "no-throw-literal": "off",
832
- "@typescript-eslint/await-thenable": "error",
833
- "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
834
- "@typescript-eslint/no-floating-promises": "error",
835
- "@typescript-eslint/no-for-in-array": "error",
836
- "@typescript-eslint/no-implied-eval": "error",
837
- "@typescript-eslint/no-misused-promises": "error",
838
- "@typescript-eslint/no-throw-literal": "error",
839
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
840
- "@typescript-eslint/no-unsafe-argument": "error",
841
- "@typescript-eslint/no-unsafe-assignment": "error",
842
- "@typescript-eslint/no-unsafe-call": "error",
843
- "@typescript-eslint/no-unsafe-member-access": "error",
844
- "@typescript-eslint/no-unsafe-return": "error",
845
- "@typescript-eslint/restrict-plus-operands": "error",
846
- "@typescript-eslint/restrict-template-expressions": "error",
847
- "@typescript-eslint/unbound-method": "error"
848
- };
849
- async function typescript(options) {
850
- const {
851
- componentExts = [],
852
- parserOptions = {},
853
- tsconfigPath
854
- } = options ?? {};
855
- const [pluginTs, parserTs] = await Promise.all([
856
- interopDefault(import("@typescript-eslint/eslint-plugin")),
857
- interopDefault(import("@typescript-eslint/parser"))
858
- ]);
859
- return [
860
- {
861
- // Install the plugins without globs, so they can be configured separately.
862
- name: "eslint:typescript:setup",
863
- plugins: {
864
- "@typescript-eslint": pluginTs
865
- }
866
- },
867
- {
868
- name: "eslint:typescript:rules",
869
- files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
870
- languageOptions: {
871
- parser: parserTs,
872
- parserOptions: {
873
- extraFileExtensions: componentExts.map((ext) => `.${ext}`),
874
- sourceType: "module",
875
- ...tsconfigPath ? {
876
- project: [tsconfigPath],
877
- tsconfigRootDir: process2.cwd()
878
- } : {},
879
- ...parserOptions
880
- }
881
- },
882
- rules: {
883
- ...pluginTs.configs["eslint-recommended"].overrides[0].rules,
884
- ...pluginTs.configs.strict.rules,
885
- "no-dupe-class-members": "off",
886
- "no-invalid-this": "off",
887
- "no-loss-of-precision": "off",
888
- "no-redeclare": "off",
889
- "no-use-before-define": "off",
890
- "no-useless-constructor": "off",
891
- "@typescript-eslint/ban-ts-comment": [
892
- "error",
893
- { "ts-ignore": "allow-with-description" }
894
- ],
895
- "@typescript-eslint/ban-types": [
896
- "error",
897
- { types: { Function: false } }
898
- ],
899
- "@typescript-eslint/consistent-type-definitions": [
900
- "error",
901
- "interface"
902
- ],
903
- "@typescript-eslint/consistent-type-imports": [
904
- "error",
905
- { disallowTypeAnnotations: false, prefer: "type-imports" }
906
- ],
907
- "@typescript-eslint/no-dupe-class-members": "error",
908
- "@typescript-eslint/no-dynamic-delete": "off",
909
- "@typescript-eslint/no-explicit-any": "off",
910
- "@typescript-eslint/no-extraneous-class": "off",
911
- "@typescript-eslint/no-import-type-side-effects": "error",
912
- "@typescript-eslint/no-invalid-this": "error",
913
- "@typescript-eslint/no-invalid-void-type": "off",
914
- "@typescript-eslint/no-loss-of-precision": "error",
915
- "@typescript-eslint/no-non-null-assertion": "off",
916
- "@typescript-eslint/no-redeclare": "error",
917
- "@typescript-eslint/no-require-imports": "error",
918
- "@typescript-eslint/no-unused-vars": "off",
919
- "@typescript-eslint/no-use-before-define": [
920
- "error",
921
- { classes: false, functions: false, variables: true }
922
- ],
923
- "@typescript-eslint/no-useless-constructor": "off",
924
- "@typescript-eslint/prefer-ts-expect-error": "error",
925
- "@typescript-eslint/triple-slash-reference": "off",
926
- "@typescript-eslint/unified-signatures": "off",
927
- ...tsconfigPath ? typeAwareRules : {}
928
- }
929
- },
930
- {
931
- name: "eslint:typescript:dts-overrides",
932
- files: ["**/*.d.ts"],
933
- rules: {
934
- "eslint-comments/no-unlimited-disable": "off",
935
- "import/no-duplicates": "off",
936
- "no-restricted-syntax": "off",
937
- "unused-imports/no-unused-vars": "off"
938
- }
939
- },
940
- {
941
- name: "eslint:typescript:tests-overrides",
942
- files: ["**/*.{test,spec}.ts?(x)"],
943
- rules: {
944
- "no-unused-expressions": "off"
945
- }
946
- },
947
- {
948
- files: ["**/*.js", "**/*.cjs"],
949
- name: "eslint:typescript:javascript-overrides",
950
- rules: {
951
- "@typescript-eslint/no-require-imports": "off",
952
- "@typescript-eslint/no-var-requires": "off"
953
- }
954
- }
955
- ];
956
- }
957
-
958
- // src/configs/unicorn.ts
959
- async function unicorn() {
960
- const pluginUnicorn = await interopDefault(import("eslint-plugin-unicorn"));
961
- return [
962
- {
963
- name: "eslint:unicorn",
964
- plugins: {
965
- unicorn: pluginUnicorn
966
- },
967
- rules: {
968
- // Pass error message when throwing errors
969
- "unicorn/error-message": "error",
970
- // Uppercase regex escapes
971
- "unicorn/escape-case": "error",
972
- // Array.isArray instead of instanceof
973
- "unicorn/no-instanceof-array": "error",
974
- // Ban `new Array` as `Array` constructor's params are ambiguous
975
- "unicorn/no-new-array": "error",
976
- // Prevent deprecated `new Buffer()`
977
- "unicorn/no-new-buffer": "error",
978
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
979
- "unicorn/number-literal-case": "error",
980
- // textContent instead of innerText
981
- "unicorn/prefer-dom-node-text-content": "error",
982
- // includes over indexOf when checking for existence
983
- "unicorn/prefer-includes": "error",
984
- // Prefer using the node: protocol
985
- "unicorn/prefer-node-protocol": "error",
986
- // Prefer using number properties like `Number.isNaN` rather than `isNaN`
987
- "unicorn/prefer-number-properties": "error",
988
- // String methods startsWith/endsWith instead of more complicated stuff
989
- "unicorn/prefer-string-starts-ends-with": "error",
990
- // Enforce throwing type error when throwing error while checking typeof
991
- "unicorn/prefer-type-error": "error",
992
- // Use new when throwing error
993
- "unicorn/throw-new-error": "error"
994
- }
995
- }
996
- ];
997
- }
998
-
999
- // src/configs/vue.ts
1000
- async function vue(options = {}) {
1001
- const [pluginVue, parserVue] = await Promise.all([
1002
- // @ts-expect-error missing types
1003
- interopDefault(import("eslint-plugin-vue")),
1004
- interopDefault(import("vue-eslint-parser"))
1005
- ]);
1006
- return [
1007
- {
1008
- name: "eslint:vue:setup",
1009
- plugins: {
1010
- vue: pluginVue
1011
- }
1012
- },
1013
- {
1014
- name: "eslint:vue:rules",
1015
- files: [GLOB_VUE],
1016
- languageOptions: {
1017
- parser: parserVue,
1018
- parserOptions: {
1019
- ecmaFeatures: {
1020
- jsx: true
1021
- },
1022
- extraFileExtensions: [".vue"],
1023
- parser: options.typescript ? await interopDefault(
1024
- import("@typescript-eslint/parser")
1025
- ) : null,
1026
- sourceType: "module"
1027
- }
1028
- },
1029
- processor: pluginVue.processors[".vue"],
1030
- rules: {
1031
- ...pluginVue.configs.base.rules,
1032
- ...pluginVue.configs["vue3-essential"].rules,
1033
- ...pluginVue.configs["vue3-strongly-recommended"].rules,
1034
- ...pluginVue.configs["vue3-recommended"].rules,
1035
- "node/prefer-global/process": "off",
1036
- "vue/block-order": [
1037
- "error",
1038
- {
1039
- order: ["script", "template", "style"]
1040
- }
1041
- ],
1042
- "vue/component-name-in-template-casing": [
1043
- "error",
1044
- "PascalCase",
1045
- {
1046
- registeredComponentsOnly: false
1047
- }
1048
- ],
1049
- "vue/component-options-name-casing": ["error", "PascalCase"],
1050
- "vue/custom-event-name-casing": ["error", "camelCase"],
1051
- "vue/define-macros-order": [
1052
- "error",
1053
- {
1054
- order: [
1055
- "defineOptions",
1056
- "defineProps",
1057
- "defineEmits",
1058
- "defineSlots"
1059
- ]
1060
- }
1061
- ],
1062
- "vue/dot-location": ["error", "property"],
1063
- "vue/dot-notation": ["error", { allowKeywords: true }],
1064
- "vue/eqeqeq": ["error", "smart"],
1065
- "vue/html-indent": ["error", 2],
1066
- "vue/html-quotes": ["error", "double"],
1067
- "vue/max-attributes-per-line": "off",
1068
- "vue/multi-word-component-names": "off",
1069
- "vue/no-dupe-keys": "off",
1070
- "vue/no-empty-pattern": "error",
1071
- "vue/no-extra-parens": ["error", "functions"],
1072
- "vue/no-irregular-whitespace": "error",
1073
- "vue/no-loss-of-precision": "error",
1074
- "vue/no-restricted-syntax": [
1075
- "error",
1076
- "DebuggerStatement",
1077
- "LabeledStatement",
1078
- "WithStatement"
1079
- ],
1080
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
1081
- "vue/no-setup-props-reactivity-loss": "off",
1082
- "vue/no-sparse-arrays": "error",
1083
- "vue/no-unused-refs": "error",
1084
- "vue/no-useless-v-bind": "error",
1085
- "vue/no-v-html": "off",
1086
- "vue/object-shorthand": [
1087
- "error",
1088
- "always",
1089
- {
1090
- avoidQuotes: true,
1091
- ignoreConstructors: false
1092
- }
1093
- ],
1094
- "vue/prefer-separate-static-class": "error",
1095
- "vue/prefer-template": "error",
1096
- "vue/require-default-prop": "off",
1097
- "vue/require-prop-types": "off",
1098
- "vue/space-infix-ops": "error",
1099
- "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
1100
- "vue/array-bracket-spacing": ["error", "never"],
1101
- "vue/arrow-spacing": ["error", { after: true, before: true }],
1102
- "vue/block-spacing": ["error", "always"],
1103
- "vue/block-tag-newline": [
1104
- "error",
1105
- {
1106
- multiline: "always",
1107
- singleline: "always"
1108
- }
1109
- ],
1110
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
1111
- "vue/comma-dangle": ["error", "always-multiline"],
1112
- "vue/comma-spacing": ["error", { after: true, before: false }],
1113
- "vue/comma-style": ["error", "last"],
1114
- "vue/html-comment-content-spacing": [
1115
- "error",
1116
- "always",
1117
- {
1118
- exceptions: ["-"]
1119
- }
1120
- ],
1121
- "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1122
- "vue/keyword-spacing": ["error", { after: true, before: true }],
1123
- "vue/object-curly-newline": "off",
1124
- "vue/object-curly-spacing": ["error", "always"],
1125
- "vue/object-property-newline": [
1126
- "error",
1127
- { allowMultiplePropertiesPerLine: true }
1128
- ],
1129
- "vue/operator-linebreak": ["error", "before"],
1130
- "vue/padding-line-between-blocks": ["error", "always"],
1131
- "vue/quote-props": ["error", "consistent-as-needed"],
1132
- "vue/space-in-parens": ["error", "never"],
1133
- "vue/template-curly-spacing": "error"
1134
- }
1135
- }
1136
- ];
1137
- }
1138
-
1139
- // src/configs/yml.ts
1140
- async function yml() {
1141
- const [pluginYml, parserYml] = await Promise.all([
1142
- interopDefault(import("eslint-plugin-yml")),
1143
- interopDefault(import("yaml-eslint-parser"))
1144
- ]);
1145
- return [
1146
- {
1147
- name: "eslint:yaml:setup",
1148
- plugins: {
1149
- yml: pluginYml
1150
- }
1151
- },
1152
- {
1153
- name: "eslint:yaml:rules",
1154
- files: [GLOB_YAML],
1155
- languageOptions: {
1156
- parser: parserYml
1157
- },
1158
- rules: {
1159
- ...pluginYml.configs.standard.rules,
1160
- ...pluginYml.configs.prettier.rules,
1161
- "yml/block-mapping": "error",
1162
- "yml/block-sequence": "error",
1163
- "yml/no-empty-key": "error",
1164
- "yml/no-empty-sequence-entry": "error",
1165
- "yml/no-irregular-whitespace": "error",
1166
- "yml/plain-scalar": "error",
1167
- "yml/vue-custom-block/no-parsing-error": "error",
1168
- "yml/spaced-comment": "error"
1169
- }
1170
- }
1171
- ];
1172
- }
1173
-
1174
- // src/configs/toml.ts
1175
- async function toml() {
1176
- const [pluginToml, parserToml] = await Promise.all([
1177
- interopDefault(import("eslint-plugin-toml")),
1178
- interopDefault(import("toml-eslint-parser"))
1179
- ]);
1180
- return [
1181
- {
1182
- name: "eslint:toml:setup",
1183
- plugins: {
1184
- toml: pluginToml
1185
- }
1186
- },
1187
- {
1188
- name: "eslint:toml:rules",
1189
- files: [GLOB_TOML],
1190
- languageOptions: {
1191
- parser: parserToml
1192
- },
1193
- rules: {
1194
- "style/spaced-comment": "off",
1195
- "toml/comma-style": "error",
1196
- "toml/keys-order": "error",
1197
- "toml/no-space-dots": "error",
1198
- "toml/no-unreadable-number-separator": "error",
1199
- "toml/precision-of-fractional-seconds": "error",
1200
- "toml/precision-of-integer": "error",
1201
- "toml/tables-order": "error",
1202
- "toml/vue-custom-block/no-parsing-error": "error",
1203
- "toml/array-bracket-newline": "error",
1204
- "toml/array-bracket-spacing": "error",
1205
- "toml/array-element-newline": "error",
1206
- "toml/indent": ["error", 2],
1207
- "toml/inline-table-curly-spacing": "error",
1208
- "toml/key-spacing": "error",
1209
- "toml/padding-line-between-pairs": "error",
1210
- "toml/padding-line-between-tables": "error",
1211
- "toml/quoted-keys": "error",
1212
- "toml/spaced-comment": "error",
1213
- "toml/table-bracket-spacing": "error"
1214
- }
1215
- }
1216
- ];
1217
- }
1218
-
1219
- // src/configs/test.ts
1220
- async function test() {
1221
- const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
1222
- interopDefault(import("eslint-plugin-vitest")),
1223
- // @ts-expect-error missing types
1224
- interopDefault(import("eslint-plugin-no-only-tests"))
1225
- ]);
1226
- return [
1227
- {
1228
- name: "eslint:test:setup",
1229
- plugins: {
1230
- test: {
1231
- ...pluginVitest,
1232
- rules: {
1233
- ...pluginVitest.rules,
1234
- // extend `test/no-only-tests` rule
1235
- ...pluginNoOnlyTests.rules
1236
- }
1237
- }
1238
- }
1239
- },
1240
- {
1241
- name: "eslint:test:rules",
1242
- files: GLOB_TESTS,
1243
- rules: {
1244
- "test/consistent-test-it": [
1245
- "error",
1246
- { fn: "it", withinDescribe: "it" }
1247
- ],
1248
- "test/no-identical-title": "error",
1249
- "test/no-only-tests": "error",
1250
- "test/prefer-hooks-in-order": "error",
1251
- "test/prefer-lowercase-title": "error"
1252
- }
1253
- }
1254
- ];
1255
- }
1256
-
1257
- // src/configs/perfectionist.ts
1258
- async function perfectionist() {
1259
- const pluginPerfectionist = await interopDefault(
1260
- // @ts-expect-error missing types
1261
- import("eslint-plugin-perfectionist")
1262
- );
1263
- return [
1264
- {
1265
- name: "eslint:perfectionist",
1266
- plugins: {
1267
- perfectionist: pluginPerfectionist
1268
- }
1269
- }
1270
- ];
1271
- }
1272
-
1273
- // src/configs/prettier.ts
1274
- async function prettier(options) {
1275
- const [pluginPrettier, configPrettier, parserPlain] = await Promise.all([
1276
- interopDefault(import("eslint-plugin-prettier")),
1277
- // @ts-expect-error missing types
1278
- interopDefault(import("eslint-config-prettier")),
1279
- interopDefault(import("eslint-parser-plain"))
1280
- ]);
1281
- const PlainFileRules = [
1282
- {
1283
- name: "eslint:prettier:markdown",
1284
- files: [GLOB_MARKDOWN],
1285
- parser: "markdown"
1286
- },
1287
- {
1288
- name: "eslint:prettier:mdx",
1289
- files: [GLOB_MDX],
1290
- parser: "mdx"
1291
- },
1292
- {
1293
- name: "eslint:prettier:html",
1294
- files: ["**/*.html"],
1295
- parser: "html"
1296
- },
1297
- {
1298
- name: "eslint:prettier:css",
1299
- files: [GLOB_CSS, GLOB_POSTCSS],
1300
- parser: "css"
1301
- },
1302
- {
1303
- name: "eslint:prettier:scss",
1304
- files: [GLOB_SCSS],
1305
- parser: "scss"
1306
- },
1307
- {
1308
- name: "eslint:prettier:less",
1309
- files: [GLOB_LESS],
1310
- parser: "less"
1311
- },
1312
- {
1313
- name: "eslint:prettier:yaml",
1314
- files: [GLOB_YAML],
1315
- parser: "yaml"
1316
- },
1317
- {
1318
- name: "eslint:prettier:graphql",
1319
- files: ["**/*.graphql"],
1320
- parser: "graphql"
1321
- }
1322
- ].map((rule) => ({
1323
- name: rule.name,
1324
- files: rule.files,
1325
- languageOptions: {
1326
- parser: parserPlain
1327
- },
1328
- rules: {
1329
- "prettier/prettier": [
1330
- "warn",
1331
- {
1332
- quoteProps: "consistent",
1333
- parser: rule.parser,
1334
- ...options
1335
- }
1336
- ]
1337
- }
1338
- }));
1339
- return [
1340
- {
1341
- name: "eslint:prettier:setup",
1342
- plugins: {
1343
- prettier: pluginPrettier
1344
- }
1345
- },
1346
- {
1347
- name: "eslint:prettier:rules",
1348
- ignores: [GLOB_TOML],
1349
- rules: {
1350
- ...configPrettier.rules,
1351
- ...pluginPrettier.configs.recommended.rules,
1352
- "prettier/prettier": [
1353
- "warn",
1354
- {
1355
- quoteProps: "consistent",
1356
- ...options
1357
- }
1358
- ]
1359
- }
1360
- },
1361
- ...PlainFileRules
1362
- ];
1363
- }
1364
-
1365
- // src/configs/react.ts
1366
- async function next() {
1367
- const pluginNext = await interopDefault(import("@next/eslint-plugin-next"));
1368
- return [
1369
- {
1370
- name: "eslint:next:setup",
1371
- plugins: {
1372
- "@next/next": pluginNext
1373
- }
1374
- },
1375
- {
1376
- name: "eslint:next:rules",
1377
- files: [GLOB_TSX, GLOB_JSX],
1378
- languageOptions: {
1379
- parserOptions: {
1380
- sourceType: "module",
1381
- ecmaFeatures: {
1382
- jsx: true
1383
- }
1384
- }
1385
- },
1386
- settings: {
1387
- react: {
1388
- version: "detect"
1389
- }
1390
- },
1391
- rules: {
1392
- ...pluginNext.configs.recommended.rules,
1393
- ...pluginNext.configs["core-web-vitals"].rules
1394
- }
1395
- }
1396
- ];
1397
- }
1398
- async function react(options = {}) {
1399
- const { next: enableNext = false } = options;
1400
- const [pluginReact, pluginReactHooks] = await Promise.all([
1401
- // @ts-expect-error missing types
1402
- interopDefault(import("eslint-plugin-react")),
1403
- // @ts-expect-error missing types
1404
- interopDefault(import("eslint-plugin-react-hooks"))
1405
- ]);
1406
- const _react = [
1407
- {
1408
- name: "eslint:react:setup",
1409
- plugins: {
1410
- "react": pluginReact,
1411
- "react-hooks": pluginReactHooks
1412
- }
1413
- },
1414
- {
1415
- name: "eslint:react:rules",
1416
- files: [GLOB_TSX, GLOB_JSX],
1417
- languageOptions: {
1418
- parserOptions: {
1419
- sourceType: "module",
1420
- ecmaFeatures: {
1421
- jsx: true
1422
- }
1423
- }
1424
- },
1425
- settings: {
1426
- react: {
1427
- version: "detect"
1428
- }
1429
- },
1430
- rules: {
1431
- ...pluginReact.configs.recommended.rules,
1432
- ...pluginReactHooks.configs.recommended.rules,
1433
- "jsx-quotes": ["error", "prefer-double"],
1434
- "react/react-in-jsx-scope": "off",
1435
- "react/jsx-indent": [1, 2],
1436
- "react/jsx-indent-props": [1, 2],
1437
- "react/jsx-closing-bracket-location": [
1438
- 1,
1439
- { selfClosing: "tag-aligned", nonEmpty: "tag-aligned" }
1440
- ]
1441
- }
1442
- }
1443
- ];
1444
- return combine(_react, enableNext ? next() : []);
1445
- }
1446
-
1447
- // src/configs/tailwindcss.ts
1448
- async function tailwindcss() {
1449
- const pluginTailwindcss = await interopDefault(
1450
- // @ts-expect-error missing types
1451
- import("eslint-plugin-tailwindcss")
1452
- );
1453
- return [
1454
- {
1455
- name: "eslint:tailwindcss",
1456
- plugins: {
1457
- tailwindcss: pluginTailwindcss
1458
- },
1459
- rules: {
1460
- ...pluginTailwindcss.configs.recommended.rules
1461
- }
1462
- }
1463
- ];
1464
- }
1465
-
1466
- // src/factory.ts
1467
- function config(options = {}) {
1468
- const {
1469
- vue: enableVue,
1470
- react: enableReact,
1471
- typescript: enableTypeScript,
1472
- gitignore: enableGitignore = true,
1473
- tailwindcss: enableTailwindcss,
1474
- componentExts = []
1475
- } = options;
1476
- const configs = [];
1477
- configs.push(
1478
- ignores({
1479
- enableGitignore
1480
- }),
1481
- javascript(),
1482
- comments(),
1483
- node(),
1484
- jsdoc(),
1485
- imports(),
1486
- unicorn(),
1487
- perfectionist()
1488
- );
1489
- if (enableVue)
1490
- componentExts.push("vue");
1491
- if (enableTypeScript) {
1492
- configs.push(
1493
- typescript({
1494
- ...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
1495
- componentExts
1496
- })
1497
- );
1498
- }
1499
- if (options.test ?? true) {
1500
- configs.push(test());
1501
- }
1502
- if (enableVue) {
1503
- configs.push(
1504
- vue({
1505
- typescript: !!enableTypeScript
1506
- })
1507
- );
1508
- }
1509
- if (enableReact) {
1510
- configs.push(react(typeof enableReact !== "boolean" ? enableReact : {}));
1511
- }
1512
- if (options.jsonc ?? true) {
1513
- configs.push(jsonc(), sortPackageJson(), sortTsconfig());
1514
- }
1515
- if (options.yml ?? true) {
1516
- configs.push(yml());
1517
- }
1518
- if (options.toml ?? true) {
1519
- configs.push(toml());
1520
- }
1521
- if (options.markdown ?? true) {
1522
- configs.push(
1523
- markdown({
1524
- componentExts
1525
- })
1526
- );
1527
- }
1528
- if (enableTailwindcss) {
1529
- configs.push(tailwindcss());
1530
- }
1531
- if (options.prettier ?? true) {
1532
- configs.push(
1533
- prettier({
1534
- ...typeof options.prettier !== "boolean" ? options.prettier : {}
1535
- })
1536
- );
1537
- }
1538
- const merged = combine(...configs, options.customConfig ?? []);
1539
- return merged;
1540
- }
1541
-
1542
- // src/index.ts
1543
- var src_default = config;
1544
- export {
1545
- GLOB_ALL_SRC,
1546
- GLOB_CSS,
1547
- GLOB_EXCLUDE,
1548
- GLOB_HTML,
1549
- GLOB_JS,
1550
- GLOB_JSON,
1551
- GLOB_JSON5,
1552
- GLOB_JSONC,
1553
- GLOB_JSX,
1554
- GLOB_LESS,
1555
- GLOB_MARKDOWN,
1556
- GLOB_MARKDOWN_CODE,
1557
- GLOB_MDX,
1558
- GLOB_POSTCSS,
1559
- GLOB_SCSS,
1560
- GLOB_SRC,
1561
- GLOB_SRC_EXT,
1562
- GLOB_STYLE,
1563
- GLOB_TESTS,
1564
- GLOB_TOML,
1565
- GLOB_TS,
1566
- GLOB_TSX,
1567
- GLOB_VUE,
1568
- GLOB_YAML,
1569
- combine,
1570
- comments,
1571
- config,
1572
- src_default as default,
1573
- ignores,
1574
- imports,
1575
- interopDefault,
1576
- javascript,
1577
- jsdoc,
1578
- jsonc,
1579
- markdown,
1580
- node,
1581
- perfectionist,
1582
- prettier,
1583
- sortPackageJson,
1584
- sortTsconfig,
1585
- test,
1586
- toml,
1587
- typescript,
1588
- unicorn,
1589
- vue,
1590
- yml
1591
- };
1
+ async function k(){return[{name:"eslint:eslint-comments",plugins:{"eslint-comments":await r(import("eslint-plugin-eslint-comments"))},rules:{"eslint-comments/no-aggregating-enable":"error","eslint-comments/no-duplicate-disable":"error","eslint-comments/no-unlimited-disable":"error","eslint-comments/no-unused-enable":"error"}}]}import B from"fs";import te from"path";var u="?([cm])[jt]s?(x)",d="**/*.?([cm])[jt]s?(x)",fe="**/*.?([cm])js",v="**/*.?([cm])jsx",de="**/*.?([cm])ts",C="**/*.?([cm])tsx",re="**/*.{c,le,sc}ss",P="**/*.css",T="**/*.{p,post}css",_="**/*.less",L="**/*.scss",w="**/*.json",O="**/*.json5",G="**/*.jsonc",f="**/*.md",y="**/*.mdx",I=`${f}/${d}`,h="**/*.vue",g="**/*.y?(a)ml",x="**/*.toml",oe="**/*.htm?(l)",D=[`**/__tests__/**/*.${u}`,`**/*.spec.${u}`,`**/*.test.${u}`,`**/*.bench.${u}`,`**/*.benchmark.${u}`],ge=[d,re,w,O,f,h,g,oe],j=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];var ne=/\r?\n/g,se=e=>e.split(ne),E=async e=>{let{enableGitignore:o=!0,files:t=[]}=e,n=[];if(o){let l=".gitignore";typeof o!="boolean"&&(l=o.ignorePath);let m=te.join(process.cwd(),l);B.existsSync(m)&&(n=se(B.readFileSync(m).toString()).filter(p=>!(p.startsWith("#")||p.length===0)).map(p=>p.startsWith("/")?p.slice(1):p))}let a=[...j,...n];return typeof t=="function"?a=t(a):a=[...a,...t],[{ignores:[...j,...a]}]};async function b(...e){return(await Promise.all(e)).flat()}async function r(e){let o=await e;return o.default||o}async function F(){return[{name:"eslint:imports",plugins:{import:await r(import("eslint-plugin-i"))},rules:{"import/first":"error","import/no-duplicates":"error","import/no-mutable-exports":"error","import/no-named-default":"error","import/no-self-import":"error","import/no-webpack-loader-syntax":"error","import/order":"error","import/newline-after-import":["error",{considerComments:!0,count:1}]}}]}import S from"globals";var R=async e=>{let{overrides:o={}}=e,t=await r(import("eslint-plugin-unused-imports"));return[{name:"eslint:javascript",languageOptions:{ecmaVersion:2022,globals:{...S.browser,...S.es2021,...S.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:!0},plugins:{"unused-imports":t},rules:{"accessor-pairs":["error",{enforceForClassMembers:!0,setWithoutGet:!0}],"array-callback-return":"error","block-scoped-var":"error","constructor-super":"error","default-case-last":"error","dot-notation":["error",{allowKeywords:!0}],eqeqeq:["error","smart"],"new-cap":["error",{capIsNew:!1,newIsCap:!0,properties:!0}],"no-alert":"error","no-array-constructor":"error","no-async-promise-executor":"error","no-caller":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":["error","always"],"no-console":["error",{allow:["warn","error"]}],"no-const-assign":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":["error",{allowEmptyCatch:!0}],"no-empty-character-class":"error","no-empty-pattern":"error","no-eval":"error","no-ex-assign":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-implied-eval":"error","no-import-assign":"error","no-invalid-regexp":"error","no-invalid-this":"error","no-irregular-whitespace":"error","no-iterator":"error","no-labels":["error",{allowLoop:!1,allowSwitch:!1}],"no-lone-blocks":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-multi-str":"error","no-new":"error","no-new-func":"error","no-new-object":"error","no-new-symbol":"error","no-new-wrappers":"error","no-obj-calls":"error","no-octal":"error","no-octal-escape":"error","no-proto":"error","no-prototype-builtins":"error","no-redeclare":["error",{builtinGlobals:!1}],"no-regex-spaces":"error","no-restricted-globals":["error",{message:"Use `globalThis` instead.",name:"global"},{message:"Use `globalThis` instead.",name:"self"}],"no-restricted-properties":["error",{message:"Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",property:"__proto__"},{message:"Use `Object.defineProperty` instead.",property:"__defineGetter__"},{message:"Use `Object.defineProperty` instead.",property:"__defineSetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupGetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupSetter__"}],"no-restricted-syntax":["error","DebuggerStatement","LabeledStatement","WithStatement","TSEnumDeclaration[const=true]","TSExportAssignment"],"no-self-assign":["error",{props:!0}],"no-self-compare":"error","no-sequences":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-template-curly-in-string":"error","no-this-before-super":"error","no-throw-literal":"error","no-undef":"error","no-undef-init":"error","no-unexpected-multiline":"error","no-unmodified-loop-condition":"error","no-unneeded-ternary":["error",{defaultAssignment:!1}],"no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unused-expressions":["error",{allowShortCircuit:!0,allowTaggedTemplates:!0,allowTernary:!0}],"no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:!0,vars:"all"}],"no-use-before-define":["error",{classes:!1,functions:!1,variables:!0}],"no-useless-backreference":"error","no-useless-call":"error","no-useless-catch":"error","no-useless-computed-key":"error","no-useless-constructor":"error","no-useless-rename":"error","no-useless-return":"error","no-var":"error","no-with":"error","object-shorthand":["error","always",{avoidQuotes:!0,ignoreConstructors:!1}],"one-var":["error",{initialized:"never"}],"prefer-arrow-callback":["error",{allowNamedFunctions:!1,allowUnboundThis:!0}],"prefer-const":["error",{destructuring:"all",ignoreReadBeforeAssign:!0}],"prefer-exponentiation-operator":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":["error",{disallowRedundantWrapping:!0}],"prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error","sort-imports":["error",{allowSeparatedGroups:!1,ignoreCase:!1,ignoreDeclarationSort:!0,ignoreMemberSort:!1,memberSyntaxSortOrder:["none","all","multiple","single"]}],"symbol-description":"error","unicode-bom":["error","never"],"unused-imports/no-unused-imports":"warn","unused-imports/no-unused-vars":["error",{args:"after-used",argsIgnorePattern:"^_",vars:"all",varsIgnorePattern:"^_"}],"use-isnan":["error",{enforceForIndexOf:!0,enforceForSwitchCase:!0}],"valid-typeof":["error",{requireStringLiterals:!0}],"vars-on-top":"error",yoda:["error","never"],...o}},{name:"eslint:scripts-overrides",files:[`scripts/${d}`,`cli.${u}`],rules:{"no-console":"off"}}]};async function q(){return[{name:"eslint:jsdoc",plugins:{jsdoc:await r(import("eslint-plugin-jsdoc"))},rules:{"jsdoc/check-access":"warn","jsdoc/check-param-names":"warn","jsdoc/check-property-names":"warn","jsdoc/check-types":"warn","jsdoc/empty-tags":"warn","jsdoc/implements-on-classes":"warn","jsdoc/no-defaults":"warn","jsdoc/no-multi-asterisks":"warn","jsdoc/require-param-name":"warn","jsdoc/require-property":"warn","jsdoc/require-property-description":"warn","jsdoc/require-property-name":"warn","jsdoc/require-returns-check":"warn","jsdoc/require-returns-description":"warn","jsdoc/require-yields-check":"warn","jsdoc/check-alignment":"warn","jsdoc/multiline-blocks":"warn"}}]}var M=async e=>{let{overrides:o={}}=e,[t,n]=await Promise.all([r(import("eslint-plugin-jsonc")),r(import("jsonc-eslint-parser"))]);return[{name:"eslint:jsonc:setup",plugins:{jsonc:t}},{name:"eslint:jsonc:rules",files:[w,O,G],languageOptions:{parser:n},rules:{"jsonc/no-bigint-literals":"error","jsonc/no-binary-expression":"error","jsonc/no-binary-numeric-literals":"error","jsonc/no-dupe-keys":"error","jsonc/no-escape-sequence-in-identifier":"error","jsonc/no-floating-decimal":"error","jsonc/no-hexadecimal-numeric-literals":"error","jsonc/no-infinity":"error","jsonc/no-multi-str":"error","jsonc/no-nan":"error","jsonc/no-number-props":"error","jsonc/no-numeric-separators":"error","jsonc/no-octal":"error","jsonc/no-octal-escape":"error","jsonc/no-octal-numeric-literals":"error","jsonc/no-parenthesized":"error","jsonc/no-plus-sign":"error","jsonc/no-regexp-literals":"error","jsonc/no-sparse-arrays":"error","jsonc/no-template-literals":"error","jsonc/no-undefined-value":"error","jsonc/no-unicode-codepoint-escapes":"error","jsonc/no-useless-escape":"error","jsonc/space-unary-ops":"error","jsonc/valid-json-number":"error","jsonc/vue-custom-block/no-parsing-error":"error","jsonc/array-bracket-spacing":["error","never"],"jsonc/comma-dangle":["error","never"],"jsonc/comma-style":["error","last"],"jsonc/indent":["error",2],"jsonc/key-spacing":["error",{afterColon:!0,beforeColon:!1}],"jsonc/object-curly-newline":["error",{consistent:!0,multiline:!0}],"jsonc/object-curly-spacing":["error","always"],"jsonc/object-property-newline":["error",{allowMultiplePropertiesPerLine:!0}],"jsonc/quote-props":"error","jsonc/quotes":"error",...o}}]};var A=async e=>{let{componentExts:o=[],overrides:t={}}=e,[n,a]=await Promise.all([r(import("eslint-plugin-mdx")),r(import("eslint-mdx"))]);return[{name:"eslint:markdown:setup",plugins:{mdx:n}},{name:"eslint:markdown:processor",files:[f,y],languageOptions:{ecmaVersion:"latest",parser:a,sourceType:"module"},processor:"mdx/remark",settings:{"mdx/code-blocks":!0}},{name:"eslint:markdown:rules",files:[I,...o.map(l=>`${f}/**/*.${l}`)],languageOptions:{parserOptions:{ecmaFeatures:{impliedStrict:!0}}},rules:{"no-alert":"off","no-console":"off","no-undef":"off","no-unused-expressions":"off","no-unused-vars":"off","node/prefer-global/process":"off","style/comma-dangle":"off","style/eol-last":"off","@typescript-eslint/consistent-type-imports":"off","@typescript-eslint/no-namespace":"off","@typescript-eslint/no-redeclare":"off","@typescript-eslint/no-require-imports":"off","@typescript-eslint/no-unused-vars":"off","@typescript-eslint/no-use-before-define":"off","@typescript-eslint/no-var-requires":"off","unicode-bom":"off","unused-imports/no-unused-imports":"off","unused-imports/no-unused-vars":"off","@typescript-eslint/await-thenable":"off","@typescript-eslint/dot-notation":"off","@typescript-eslint/no-floating-promises":"off","@typescript-eslint/no-for-in-array":"off","@typescript-eslint/no-implied-eval":"off","@typescript-eslint/no-misused-promises":"off","@typescript-eslint/no-throw-literal":"off","@typescript-eslint/no-unnecessary-type-assertion":"off","@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off","@typescript-eslint/no-unsafe-call":"off","@typescript-eslint/no-unsafe-member-access":"off","@typescript-eslint/no-unsafe-return":"off","@typescript-eslint/restrict-plus-operands":"off","@typescript-eslint/restrict-template-expressions":"off","@typescript-eslint/unbound-method":"off",...t}}]};async function J(){return[{name:"eslint:node",plugins:{n:await r(import("eslint-plugin-n"))},rules:{"n/handle-callback-err":["error","^(err|error)$"],"n/no-deprecated-api":"error","n/no-exports-assign":"error","n/no-new-require":"error","n/no-path-concat":"error","n/prefer-global/buffer":["error","never"],"n/prefer-global/process":["error","never"],"n/process-exit-as-throw":"error"}}]}async function U(){return[{name:"eslint:sort-package-json",files:["**/package.json"],rules:{"jsonc/sort-array-values":["error",{order:{type:"asc"},pathPattern:"^files$"}],"jsonc/sort-keys":["error",{order:["publisher","name","displayName","type","version","private","packageManager","description","author","license","funding","homepage","repository","bugs","keywords","categories","sideEffects","exports","main","module","unpkg","jsdelivr","types","typesVersions","bin","icon","files","engines","activationEvents","contributes","scripts","peerDependencies","peerDependenciesMeta","dependencies","optionalDependencies","devDependencies","pnpm","overrides","resolutions","husky","simple-git-hooks","lint-staged","eslintConfig"],pathPattern:"^$"},{order:{type:"asc"},pathPattern:"^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"},{order:{type:"asc"},pathPattern:"^(?:resolutions|overrides|pnpm.overrides)$"},{order:["types","import","require","default"],pathPattern:"^exports.*$"}]}}]}async function N(){return[{name:"eslint:sort-tsconfig",files:["**/tsconfig.json","**/tsconfig.*.json"],rules:{"jsonc/sort-keys":["error",{order:["extends","compilerOptions","references","files","include","exclude"],pathPattern:"^$"},{order:["incremental","composite","tsBuildInfoFile","disableSourceOfProjectReferenceRedirect","disableSolutionSearching","disableReferencedProjectLoad","target","jsx","jsxFactory","jsxFragmentFactory","jsxImportSource","lib","moduleDetection","noLib","reactNamespace","useDefineForClassFields","emitDecoratorMetadata","experimentalDecorators","baseUrl","rootDir","rootDirs","customConditions","module","moduleResolution","moduleSuffixes","noResolve","paths","resolveJsonModule","resolvePackageJsonExports","resolvePackageJsonImports","typeRoots","types","allowArbitraryExtensions","allowImportingTsExtensions","allowUmdGlobalAccess","allowJs","checkJs","maxNodeModuleJsDepth","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","allowUnreachableCode","allowUnusedLabels","alwaysStrict","exactOptionalPropertyTypes","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noPropertyAccessFromIndexSignature","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","useUnknownInCatchVariables","declaration","declarationDir","declarationMap","downlevelIteration","emitBOM","emitDeclarationOnly","importHelpers","importsNotUsedAsValues","inlineSourceMap","inlineSources","mapRoot","newLine","noEmit","noEmitHelpers","noEmitOnError","outDir","outFile","preserveConstEnums","preserveValueImports","removeComments","sourceMap","sourceRoot","stripInternal","allowSyntheticDefaultImports","esModuleInterop","forceConsistentCasingInFileNames","isolatedModules","preserveSymlinks","verbatimModuleSyntax","skipDefaultLibCheck","skipLibCheck"],pathPattern:"^compilerOptions$"}]}}]}import ie from"process";var ae={"dot-notation":"off","no-implied-eval":"off","no-throw-literal":"off","@typescript-eslint/await-thenable":"error","@typescript-eslint/dot-notation":["error",{allowKeywords:!0}],"@typescript-eslint/no-floating-promises":"error","@typescript-eslint/no-for-in-array":"error","@typescript-eslint/no-implied-eval":"error","@typescript-eslint/no-misused-promises":"error","@typescript-eslint/no-throw-literal":"error","@typescript-eslint/no-unnecessary-type-assertion":"error","@typescript-eslint/no-unsafe-argument":"error","@typescript-eslint/no-unsafe-assignment":"error","@typescript-eslint/no-unsafe-call":"error","@typescript-eslint/no-unsafe-member-access":"error","@typescript-eslint/no-unsafe-return":"error","@typescript-eslint/restrict-plus-operands":"error","@typescript-eslint/restrict-template-expressions":"error","@typescript-eslint/unbound-method":"error"},$=async e=>{let{overrides:o={},componentExts:t=[],parserOptions:n={},tsconfigPath:a}=e??{},[l,m]=await Promise.all([r(import("@typescript-eslint/eslint-plugin")),r(import("@typescript-eslint/parser"))]);return[{name:"eslint:typescript:setup",plugins:{"@typescript-eslint":l}},{name:"eslint:typescript:rules",files:[d,...t.map(p=>`**/*.${p}`)],languageOptions:{parser:m,parserOptions:{extraFileExtensions:t.map(p=>`.${p}`),sourceType:"module",...a?{project:[a],tsconfigRootDir:ie.cwd()}:{},...n}},rules:{...l.configs["eslint-recommended"].overrides[0].rules,...l.configs.strict.rules,"no-dupe-class-members":"off","no-invalid-this":"off","no-loss-of-precision":"off","no-redeclare":"off","no-use-before-define":"off","no-useless-constructor":"off","@typescript-eslint/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"@typescript-eslint/ban-types":["error",{types:{Function:!1}}],"@typescript-eslint/consistent-type-definitions":["error","interface"],"@typescript-eslint/consistent-type-imports":["error",{disallowTypeAnnotations:!1,prefer:"type-imports"}],"@typescript-eslint/no-dupe-class-members":"error","@typescript-eslint/no-dynamic-delete":"off","@typescript-eslint/no-explicit-any":"off","@typescript-eslint/no-extraneous-class":"off","@typescript-eslint/no-import-type-side-effects":"error","@typescript-eslint/no-invalid-this":"error","@typescript-eslint/no-invalid-void-type":"off","@typescript-eslint/no-loss-of-precision":"error","@typescript-eslint/no-non-null-assertion":"off","@typescript-eslint/no-redeclare":"error","@typescript-eslint/no-require-imports":"error","@typescript-eslint/no-unused-vars":"off","@typescript-eslint/no-use-before-define":["error",{classes:!1,functions:!1,variables:!0}],"@typescript-eslint/no-useless-constructor":"off","@typescript-eslint/prefer-ts-expect-error":"error","@typescript-eslint/triple-slash-reference":"off","@typescript-eslint/unified-signatures":"off",...a?ae:{},...o}},{name:"eslint:typescript:dts-overrides",files:["**/*.d.ts"],rules:{"eslint-comments/no-unlimited-disable":"off","import/no-duplicates":"off","no-restricted-syntax":"off","unused-imports/no-unused-vars":"off"}},{name:"eslint:typescript:tests-overrides",files:["**/*.{test,spec}.ts?(x)"],rules:{"no-unused-expressions":"off"}},{files:["**/*.js","**/*.cjs"],name:"eslint:typescript:javascript-overrides",rules:{"@typescript-eslint/no-require-imports":"off","@typescript-eslint/no-var-requires":"off"}}]};async function V(){return[{name:"eslint:unicorn",plugins:{unicorn:await r(import("eslint-plugin-unicorn"))},rules:{"unicorn/error-message":"error","unicorn/escape-case":"error","unicorn/no-instanceof-array":"error","unicorn/no-new-array":"error","unicorn/no-new-buffer":"error","unicorn/number-literal-case":"error","unicorn/prefer-dom-node-text-content":"error","unicorn/prefer-includes":"error","unicorn/prefer-node-protocol":"error","unicorn/prefer-number-properties":"error","unicorn/prefer-string-starts-ends-with":"error","unicorn/prefer-type-error":"error","unicorn/throw-new-error":"error"}}]}var W=async(e={})=>{let{overrides:o={},typescript:t}=e,[n,a]=await Promise.all([r(import("eslint-plugin-vue")),r(import("vue-eslint-parser"))]);return[{name:"eslint:vue:setup",plugins:{vue:n}},{name:"eslint:vue:rules",files:[h],languageOptions:{parser:a,parserOptions:{ecmaFeatures:{jsx:!0},extraFileExtensions:[".vue"],parser:t?await r(import("@typescript-eslint/parser")):null,sourceType:"module"}},processor:n.processors[".vue"],rules:{...n.configs.base.rules,...n.configs["vue3-essential"].rules,...n.configs["vue3-strongly-recommended"].rules,...n.configs["vue3-recommended"].rules,"node/prefer-global/process":"off","vue/block-order":["error",{order:["script","template","style"]}],"vue/component-name-in-template-casing":["error","PascalCase",{registeredComponentsOnly:!1}],"vue/component-options-name-casing":["error","PascalCase"],"vue/custom-event-name-casing":["error","camelCase"],"vue/define-macros-order":["error",{order:["defineOptions","defineProps","defineEmits","defineSlots"]}],"vue/dot-location":["error","property"],"vue/dot-notation":["error",{allowKeywords:!0}],"vue/eqeqeq":["error","smart"],"vue/html-indent":["error",2],"vue/html-quotes":["error","double"],"vue/max-attributes-per-line":"off","vue/multi-word-component-names":"off","vue/no-dupe-keys":"off","vue/no-empty-pattern":"error","vue/no-extra-parens":["error","functions"],"vue/no-irregular-whitespace":"error","vue/no-loss-of-precision":"error","vue/no-restricted-syntax":["error","DebuggerStatement","LabeledStatement","WithStatement"],"vue/no-restricted-v-bind":["error","/^v-/"],"vue/no-setup-props-reactivity-loss":"off","vue/no-sparse-arrays":"error","vue/no-unused-refs":"error","vue/no-useless-v-bind":"error","vue/no-v-html":"off","vue/object-shorthand":["error","always",{avoidQuotes:!0,ignoreConstructors:!1}],"vue/prefer-separate-static-class":"error","vue/prefer-template":"error","vue/require-default-prop":"off","vue/require-prop-types":"off","vue/space-infix-ops":"error","vue/space-unary-ops":["error",{nonwords:!1,words:!0}],"vue/array-bracket-spacing":["error","never"],"vue/arrow-spacing":["error",{after:!0,before:!0}],"vue/block-spacing":["error","always"],"vue/block-tag-newline":["error",{multiline:"always",singleline:"always"}],"vue/brace-style":["error","stroustrup",{allowSingleLine:!0}],"vue/comma-dangle":["error","always-multiline"],"vue/comma-spacing":["error",{after:!0,before:!1}],"vue/comma-style":["error","last"],"vue/html-comment-content-spacing":["error","always",{exceptions:["-"]}],"vue/key-spacing":["error",{afterColon:!0,beforeColon:!1}],"vue/keyword-spacing":["error",{after:!0,before:!0}],"vue/object-curly-newline":"off","vue/object-curly-spacing":["error","always"],"vue/object-property-newline":["error",{allowMultiplePropertiesPerLine:!0}],"vue/operator-linebreak":["error","before"],"vue/padding-line-between-blocks":["error","always"],"vue/quote-props":["error","consistent-as-needed"],"vue/space-in-parens":["error","never"],"vue/template-curly-spacing":"error",...o}}]};var X=async e=>{let{overrides:o={}}=e,[t,n]=await Promise.all([r(import("eslint-plugin-yml")),r(import("yaml-eslint-parser"))]);return[{name:"eslint:yaml:setup",plugins:{yml:t}},{name:"eslint:yaml:rules",files:[g],languageOptions:{parser:n},rules:{...t.configs.standard.rules,...t.configs.prettier.rules,"yml/block-mapping":"error","yml/block-sequence":"error","yml/no-empty-key":"error","yml/no-empty-sequence-entry":"error","yml/no-irregular-whitespace":"error","yml/plain-scalar":"error","yml/vue-custom-block/no-parsing-error":"error","yml/spaced-comment":"error",...o}}]};var Y=async e=>{let{overrides:o={}}=e,[t,n]=await Promise.all([r(import("eslint-plugin-toml")),r(import("toml-eslint-parser"))]);return[{name:"eslint:toml:setup",plugins:{toml:t}},{name:"eslint:toml:rules",files:[x],languageOptions:{parser:n},rules:{"style/spaced-comment":"off","toml/comma-style":"error","toml/keys-order":"error","toml/no-space-dots":"error","toml/no-unreadable-number-separator":"error","toml/precision-of-fractional-seconds":"error","toml/precision-of-integer":"error","toml/tables-order":"error","toml/vue-custom-block/no-parsing-error":"error","toml/array-bracket-newline":"error","toml/array-bracket-spacing":"error","toml/array-element-newline":"error","toml/indent":["error",2],"toml/inline-table-curly-spacing":"error","toml/key-spacing":"error","toml/padding-line-between-pairs":"error","toml/padding-line-between-tables":"error","toml/quoted-keys":"error","toml/spaced-comment":"error","toml/table-bracket-spacing":"error",...o}}]};var H=async e=>{let{overrides:o={}}=e,[t,n]=await Promise.all([r(import("eslint-plugin-vitest")),r(import("eslint-plugin-no-only-tests"))]);return[{name:"eslint:test:setup",plugins:{test:{...t,rules:{...t.rules,...n.rules}}}},{name:"eslint:test:rules",files:D,rules:{"test/consistent-test-it":["error",{fn:"it",withinDescribe:"it"}],"test/no-identical-title":"error","test/no-only-tests":"error","test/prefer-hooks-in-order":"error","test/prefer-lowercase-title":"error",...o}}]};async function K(){return[{name:"eslint:perfectionist",plugins:{perfectionist:await r(import("eslint-plugin-perfectionist"))}}]}var z=async e=>{let[o,t,n]=await Promise.all([r(import("eslint-plugin-prettier")),r(import("eslint-config-prettier")),r(import("eslint-parser-plain"))]),a=[{name:"eslint:prettier:markdown",files:[f],parser:"markdown"},{name:"eslint:prettier:mdx",files:[y],parser:"mdx"},{name:"eslint:prettier:html",files:["**/*.html"],parser:"html"},{name:"eslint:prettier:css",files:[P,T],parser:"css"},{name:"eslint:prettier:scss",files:[L],parser:"scss"},{name:"eslint:prettier:less",files:[_],parser:"less"},{name:"eslint:prettier:yaml",files:[g],parser:"yaml"},{name:"eslint:prettier:graphql",files:["**/*.graphql"],parser:"graphql"}].map(l=>({name:l.name,files:l.files,languageOptions:{parser:n},rules:{"prettier/prettier":["warn",{quoteProps:"consistent",parser:l.parser,...e}]}}));return[{name:"eslint:prettier:setup",plugins:{prettier:o}},{name:"eslint:prettier:rules",ignores:[x],rules:{...t.rules,...o.configs.recommended.rules,"prettier/prettier":["warn",{quoteProps:"consistent",...e}]}},...a]};async function pe(){let e=await r(import("@next/eslint-plugin-next"));return[{name:"eslint:next:setup",plugins:{"@next/next":e}},{name:"eslint:next:rules",files:[C,v],languageOptions:{parserOptions:{sourceType:"module",ecmaFeatures:{jsx:!0}}},settings:{react:{version:"detect"}},rules:{...e.configs.recommended.rules,...e.configs["core-web-vitals"].rules}}]}var Q=async e=>{let{next:o=!1,overrides:t={}}=e,[n,a]=await Promise.all([r(import("eslint-plugin-react")),r(import("eslint-plugin-react-hooks"))]),l=[{name:"eslint:react:setup",plugins:{react:n,"react-hooks":a}},{name:"eslint:react:rules",files:[C,v],languageOptions:{parserOptions:{sourceType:"module",ecmaFeatures:{jsx:!0}}},settings:{react:{version:"detect"}},rules:{...n.configs.recommended.rules,...a.configs.recommended.rules,"jsx-quotes":["error","prefer-double"],"react/react-in-jsx-scope":"off","react/jsx-indent":[1,2],"react/jsx-indent-props":[1,2],"react/jsx-closing-bracket-location":[1,{selfClosing:"tag-aligned",nonEmpty:"tag-aligned"}],...t}}];return b(l,o?pe():[])};async function Z(){let e=await r(import("eslint-plugin-tailwindcss"));return[{name:"eslint:tailwindcss",plugins:{tailwindcss:e},rules:{...e.configs.recommended.rules}}]}function c(e){return e?typeof e!="boolean"?e:{}:{}}function ee(e={}){let{ignores:o=!0,vue:t,react:n,typescript:a,tailwindcss:l,componentExts:m=[]}=e,p=[];return p.push(E(c(o)),R(e.javascript??{}),k(),J(),q(),F(),V(),K()),t&&m.push("vue"),a&&p.push($({...typeof a!="boolean"?a:{},componentExts:m})),(e.test??!0)&&p.push(H(c(e.test))),t&&p.push(W({...c(e.vue),typescript:!!a})),n&&p.push(Q(c(n))),(e.jsonc??!0)&&p.push(M(c(e.jsonc)),U(),N()),(e.yml??!0)&&p.push(X(c(e.yml))),(e.toml??!0)&&p.push(Y(c(e.toml))),(e.markdown??!0)&&p.push(A({...c(e.markdown),componentExts:m})),l&&p.push(Z()),(e.prettier??!0)&&p.push(z(c(e.prettier))),b(...p,e.customConfig??[])}var io=ee;export{ge as GLOB_ALL_SRC,P as GLOB_CSS,j as GLOB_EXCLUDE,oe as GLOB_HTML,fe as GLOB_JS,w as GLOB_JSON,O as GLOB_JSON5,G as GLOB_JSONC,v as GLOB_JSX,_ as GLOB_LESS,f as GLOB_MARKDOWN,I as GLOB_MARKDOWN_CODE,y as GLOB_MDX,T as GLOB_POSTCSS,L as GLOB_SCSS,d as GLOB_SRC,u as GLOB_SRC_EXT,re as GLOB_STYLE,D as GLOB_TESTS,x as GLOB_TOML,de as GLOB_TS,C as GLOB_TSX,h as GLOB_VUE,g as GLOB_YAML,b as combine,k as comments,ee as config,io as default,E as ignores,F as imports,r as interopDefault,R as javascript,q as jsdoc,M as jsonc,A as markdown,J as node,K as perfectionist,z as prettier,U as sortPackageJson,N as sortTsconfig,H as test,Y as toml,$ as typescript,V as unicorn,W as vue,X as yml};