@cuiqg/eslint-config 2.1.24

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 ADDED
@@ -0,0 +1,1042 @@
1
+ // src/presets.js
2
+ import { FlatConfigComposer } from "eslint-flat-config-utils";
3
+
4
+ // src/utils.js
5
+ async function interopDefault(m) {
6
+ const resolved = await m;
7
+ return resolved.default || m;
8
+ }
9
+
10
+ // src/configs/comments.js
11
+ async function comments() {
12
+ const pluginComments = await interopDefault(
13
+ import("eslint-plugin-eslint-comments")
14
+ );
15
+ return [
16
+ {
17
+ name: "cuiqg/eslint-comments",
18
+ plugins: {
19
+ "eslint-comments": pluginComments
20
+ },
21
+ rules: {
22
+ ...pluginComments.configs.recommended.rules
23
+ }
24
+ }
25
+ ];
26
+ }
27
+
28
+ // src/globs.js
29
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
30
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
31
+ var GLOB_JS = "**/*.?([cm])js";
32
+ var GLOB_JSX = "**/*.?([cm])jsx";
33
+ var GLOB_STYLE = "**/*.{c,le,sc}ss";
34
+ var GLOB_CSS = "**/*.css";
35
+ var GLOB_POSTCSS = "**/*.{p,post}css";
36
+ var GLOB_LESS = "**/*.less";
37
+ var GLOB_SCSS = "**/*.scss";
38
+ var GLOB_JSON = "**/*.json";
39
+ var GLOB_JSON5 = "**/*.json5";
40
+ var GLOB_JSONC = "**/*.jsonc";
41
+ var GLOB_VUE = "**/*.vue";
42
+ var GLOB_YAML = "**/*.y?(a)ml";
43
+ var GLOB_XML = "**/*.xml";
44
+ var GLOB_HTML = "**/*.htm?(l)";
45
+ var GLOB_EXCLUDE = [
46
+ "**/node_modules",
47
+ "**/dist",
48
+ "**/package-lock.json",
49
+ "**/yarn.lock",
50
+ "**/pnpm-lock.yaml",
51
+ "**/bun.lockb",
52
+ "**/output",
53
+ "**/coverage",
54
+ "**/tmp",
55
+ "**/.tmp",
56
+ "**/temp",
57
+ "**/.temp",
58
+ "**/.history",
59
+ "**/.vitepress/cache",
60
+ "**/.nuxt",
61
+ "**/.next",
62
+ "**/.vercel",
63
+ "**/.changeset",
64
+ "**/.idea",
65
+ "**/.cache",
66
+ "**/.output",
67
+ "**/.vite-inspect",
68
+ "**/.yarn",
69
+ "**/vite.config.*.timestamp-*",
70
+ "**/.eslint-config-inspector",
71
+ "**/CHANGELOG*.md",
72
+ "**/*.min.*",
73
+ "**/LICENSE*",
74
+ "**/__snapshots__",
75
+ "**/auto-import?(s).d.ts",
76
+ "**/components.d.ts"
77
+ ];
78
+
79
+ // src/configs/ignores.js
80
+ async function ignores() {
81
+ return [
82
+ {
83
+ name: "cuiqg/ignores",
84
+ ignores: GLOB_EXCLUDE
85
+ }
86
+ ];
87
+ }
88
+
89
+ // src/configs/imports.js
90
+ async function imports() {
91
+ const pluginImport = await interopDefault(import("eslint-plugin-import-x"));
92
+ return [
93
+ {
94
+ name: "cuiqg/imports",
95
+ plugins: {
96
+ import: pluginImport
97
+ },
98
+ rules: {
99
+ "import/first": "error",
100
+ "import/no-duplicates": "error",
101
+ "import/no-mutable-exports": "error",
102
+ "import/no-named-default": "error",
103
+ "import/no-self-import": "error",
104
+ "import/no-webpack-loader-syntax": "error",
105
+ "import/newline-after-import": "error",
106
+ "import/order": "error"
107
+ }
108
+ }
109
+ ];
110
+ }
111
+
112
+ // src/configs/javascript.js
113
+ import globals from "globals";
114
+
115
+ // src/env.js
116
+ import process from "node:process";
117
+ import { isPackageExists } from "local-pkg";
118
+ var isInEditor = !!((process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM) && !process.env.CI);
119
+ var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
120
+ var hasUnocss = isPackageExists("unocss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
121
+
122
+ // src/configs/javascript.js
123
+ async function javascript() {
124
+ return [
125
+ {
126
+ languageOptions: {
127
+ ecmaVersion: 2022,
128
+ globals: {
129
+ ...globals.browser,
130
+ ...globals.es2021,
131
+ ...globals.node,
132
+ document: "readonly",
133
+ navigator: "readonly",
134
+ window: "readonly"
135
+ },
136
+ parserOptions: {
137
+ ecmaFeatures: {
138
+ jsx: true
139
+ },
140
+ ecmaVersion: 2022,
141
+ sourceType: "module"
142
+ },
143
+ sourceType: "module"
144
+ },
145
+ linterOptions: {
146
+ reportUnusedDisableDirectives: true
147
+ },
148
+ name: "cuiqg/javascript",
149
+ rules: {
150
+ "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
151
+ "array-callback-return": "error",
152
+ "block-scoped-var": "error",
153
+ "constructor-super": "error",
154
+ "default-case-last": "error",
155
+ "dot-notation": ["error", { allowKeywords: true }],
156
+ "eqeqeq": ["error", "smart"],
157
+ "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
158
+ "no-alert": "error",
159
+ "no-array-constructor": "error",
160
+ "no-async-promise-executor": "error",
161
+ "no-caller": "error",
162
+ "no-case-declarations": "error",
163
+ "no-class-assign": "error",
164
+ "no-compare-neg-zero": "error",
165
+ "no-cond-assign": ["error", "always"],
166
+ "no-console": ["error", { allow: ["warn", "error"] }],
167
+ "no-const-assign": "error",
168
+ "no-control-regex": "error",
169
+ "no-debugger": "error",
170
+ "no-delete-var": "error",
171
+ "no-dupe-args": "error",
172
+ "no-dupe-class-members": "error",
173
+ "no-dupe-keys": "error",
174
+ "no-duplicate-case": "error",
175
+ "no-empty": ["error", { allowEmptyCatch: true }],
176
+ "no-empty-character-class": "error",
177
+ "no-empty-pattern": "error",
178
+ "no-eval": "error",
179
+ "no-ex-assign": "error",
180
+ "no-extend-native": "error",
181
+ "no-extra-bind": "error",
182
+ "no-extra-boolean-cast": "error",
183
+ "no-fallthrough": "error",
184
+ "no-func-assign": "error",
185
+ "no-global-assign": "error",
186
+ "no-implied-eval": "error",
187
+ "no-import-assign": "error",
188
+ "no-invalid-regexp": "error",
189
+ "no-irregular-whitespace": "error",
190
+ "no-iterator": "error",
191
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
192
+ "no-lone-blocks": "error",
193
+ "no-loss-of-precision": "error",
194
+ "no-misleading-character-class": "error",
195
+ "no-multi-str": "error",
196
+ "no-new": "error",
197
+ "no-new-func": "error",
198
+ "no-new-native-nonconstructor": "error",
199
+ "no-new-wrappers": "error",
200
+ "no-obj-calls": "error",
201
+ "no-octal": "error",
202
+ "no-octal-escape": "error",
203
+ "no-proto": "error",
204
+ "no-prototype-builtins": "error",
205
+ "no-redeclare": ["error", { builtinGlobals: false }],
206
+ "no-regex-spaces": "error",
207
+ "no-restricted-globals": [
208
+ "error",
209
+ { message: "Use `globalThis` instead.", name: "global" },
210
+ { message: "Use `globalThis` instead.", name: "self" }
211
+ ],
212
+ "no-restricted-properties": [
213
+ "error",
214
+ { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
215
+ { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
216
+ { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
217
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
218
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
219
+ ],
220
+ "no-restricted-syntax": [
221
+ "error",
222
+ "TSEnumDeclaration[const=true]",
223
+ "TSExportAssignment"
224
+ ],
225
+ "no-self-assign": ["error", { props: true }],
226
+ "no-self-compare": "error",
227
+ "no-sequences": "error",
228
+ "no-shadow-restricted-names": "error",
229
+ "no-sparse-arrays": "error",
230
+ "no-template-curly-in-string": "error",
231
+ "no-this-before-super": "error",
232
+ "no-throw-literal": "error",
233
+ "no-undef": "error",
234
+ "no-undef-init": "error",
235
+ "no-unexpected-multiline": "error",
236
+ "no-unmodified-loop-condition": "error",
237
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
238
+ "no-unreachable": "error",
239
+ "no-unreachable-loop": "error",
240
+ "no-unsafe-finally": "error",
241
+ "no-unsafe-negation": "error",
242
+ "no-unused-expressions": ["error", {
243
+ allowShortCircuit: true,
244
+ allowTaggedTemplates: true,
245
+ allowTernary: true
246
+ }],
247
+ "no-unused-vars": ["error", {
248
+ args: "none",
249
+ caughtErrors: "none",
250
+ ignoreRestSiblings: true,
251
+ vars: "all"
252
+ }],
253
+ "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
254
+ "no-useless-backreference": "error",
255
+ "no-useless-call": "error",
256
+ "no-useless-catch": "error",
257
+ "no-useless-computed-key": "error",
258
+ "no-useless-constructor": "error",
259
+ "no-useless-rename": "error",
260
+ "no-useless-return": "error",
261
+ "no-var": "error",
262
+ "no-with": "error",
263
+ "object-shorthand": [
264
+ "error",
265
+ "always",
266
+ {
267
+ avoidQuotes: true,
268
+ ignoreConstructors: false
269
+ }
270
+ ],
271
+ "one-var": ["error", { initialized: "never" }],
272
+ "prefer-arrow-callback": [
273
+ "error",
274
+ {
275
+ allowNamedFunctions: false,
276
+ allowUnboundThis: true
277
+ }
278
+ ],
279
+ "prefer-const": [
280
+ isInEditor ? "warn" : "error",
281
+ {
282
+ destructuring: "all",
283
+ ignoreReadBeforeAssign: true
284
+ }
285
+ ],
286
+ "prefer-exponentiation-operator": "error",
287
+ "prefer-promise-reject-errors": "error",
288
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
289
+ "prefer-rest-params": "error",
290
+ "prefer-spread": "error",
291
+ "prefer-template": "error",
292
+ "symbol-description": "error",
293
+ "unicode-bom": ["error", "never"],
294
+ "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
295
+ "valid-typeof": ["error", { requireStringLiterals: true }],
296
+ "vars-on-top": "error",
297
+ "yoda": ["error", "never"]
298
+ }
299
+ },
300
+ {
301
+ files: [`**/scripts/${GLOB_SRC}`, `**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
302
+ name: "cuiqg/javascript/disables",
303
+ rules: {
304
+ "no-console": "off"
305
+ }
306
+ }
307
+ ];
308
+ }
309
+
310
+ // src/configs/jsdoc.js
311
+ async function jsdoc() {
312
+ const pluginJsdoc = await interopDefault(import("eslint-plugin-jsdoc"));
313
+ return [
314
+ {
315
+ name: "cuiqg/jsdoc",
316
+ plugins: {
317
+ jsdoc: pluginJsdoc
318
+ },
319
+ rules: {
320
+ ...pluginJsdoc.configs.recommended.rules
321
+ }
322
+ }
323
+ ];
324
+ }
325
+
326
+ // src/configs/jsonc.js
327
+ async function jsonc() {
328
+ const files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC];
329
+ const [pluginJsonc, parserJsonc] = await Promise.all([
330
+ interopDefault(import("eslint-plugin-jsonc")),
331
+ interopDefault(import("jsonc-eslint-parser"))
332
+ ]);
333
+ return [
334
+ {
335
+ name: "cuiqg/jsonc",
336
+ files,
337
+ plugins: {
338
+ jsonc: pluginJsonc
339
+ },
340
+ languageOptions: {
341
+ parser: parserJsonc
342
+ },
343
+ rules: {
344
+ ...pluginJsonc.configs["recommended-with-jsonc"].rules,
345
+ "jsonc/array-bracket-spacing": ["error", "never"],
346
+ "jsonc/comma-dangle": ["error", "never"],
347
+ "jsonc/comma-style": ["error", "last"],
348
+ "jsonc/indent": ["error", 2],
349
+ "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
350
+ "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
351
+ "jsonc/object-curly-spacing": ["error", "always"],
352
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
353
+ "jsonc/quote-props": "error",
354
+ "jsonc/quotes": "error"
355
+ }
356
+ }
357
+ ];
358
+ }
359
+
360
+ // src/configs/node.js
361
+ async function node() {
362
+ const pluginNode = await interopDefault(import("eslint-plugin-n"));
363
+ return [
364
+ {
365
+ name: "cuiqg/node",
366
+ plugins: {
367
+ node: pluginNode
368
+ },
369
+ rules: {
370
+ "node/handle-callback-err": ["error", "^(err|error)$"],
371
+ "node/no-deprecated-api": "error",
372
+ "node/no-exports-assign": "error",
373
+ "node/no-new-require": "error",
374
+ "node/no-path-concat": "error",
375
+ "node/prefer-global/buffer": ["error", "never"],
376
+ "node/prefer-global/process": ["error", "never"],
377
+ "node/process-exit-as-throw": "error"
378
+ }
379
+ }
380
+ ];
381
+ }
382
+
383
+ // src/configs/perfectionist.js
384
+ async function perfectionist() {
385
+ const pluginPerfectionist = await interopDefault(import("eslint-plugin-perfectionist"));
386
+ return [
387
+ {
388
+ name: "cuiqg/perfectionist",
389
+ plugins: {
390
+ perfectionist: pluginPerfectionist
391
+ },
392
+ rules: {
393
+ "perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
394
+ "perfectionist/sort-imports": ["error", {
395
+ groups: [
396
+ "type",
397
+ ["parent-type", "sibling-type", "index-type", "internal-type"],
398
+ "builtin",
399
+ "external",
400
+ "internal",
401
+ ["parent", "sibling", "index"],
402
+ "side-effect",
403
+ "object",
404
+ "unknown"
405
+ ],
406
+ newlinesBetween: "ignore",
407
+ order: "asc",
408
+ type: "natural"
409
+ }],
410
+ "perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
411
+ "perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
412
+ }
413
+ }
414
+ ];
415
+ }
416
+
417
+ // src/configs/prettier.js
418
+ async function prettier() {
419
+ const [pluginJsonc, pluginPrettier, configPrettier] = await Promise.all([
420
+ interopDefault(import("eslint-plugin-jsonc")),
421
+ interopDefault(import("eslint-plugin-prettier")),
422
+ interopDefault(import("eslint-config-prettier"))
423
+ ]);
424
+ return [
425
+ {
426
+ name: "cuiqg/prettier",
427
+ plugins: {
428
+ prettier: pluginPrettier
429
+ },
430
+ rules: {
431
+ ...configPrettier.rules,
432
+ ...pluginPrettier.configs.recommended.rules,
433
+ ...pluginJsonc.configs.prettier.rules,
434
+ "prettier/prettier": "warn"
435
+ }
436
+ }
437
+ ];
438
+ }
439
+
440
+ // src/configs/sorts.js
441
+ async function sortPackageJson() {
442
+ return [
443
+ {
444
+ name: "cuiqg/sort/package-json",
445
+ files: ["**/package.json"],
446
+ rules: {
447
+ "jsonc/sort-array-values": [
448
+ "error",
449
+ {
450
+ order: { type: "asc" },
451
+ pathPattern: "^files$"
452
+ }
453
+ ],
454
+ "jsonc/sort-keys": [
455
+ "error",
456
+ {
457
+ order: [
458
+ "name",
459
+ "version",
460
+ "private",
461
+ "packageManager",
462
+ "description",
463
+ "type",
464
+ "keywords",
465
+ "license",
466
+ "homepage",
467
+ "bugs",
468
+ "repository",
469
+ "author",
470
+ "contributors",
471
+ "funding",
472
+ "files",
473
+ "main",
474
+ "module",
475
+ "types",
476
+ "exports",
477
+ "typesVersions",
478
+ "sideEffects",
479
+ "unpkg",
480
+ "jsdelivr",
481
+ "browser",
482
+ "bin",
483
+ "man",
484
+ "directories",
485
+ "publishConfig",
486
+ "scripts",
487
+ "peerDependencies",
488
+ "peerDependenciesMeta",
489
+ "optionalDependencies",
490
+ "dependencies",
491
+ "devDependencies",
492
+ "engines",
493
+ "config",
494
+ "overrides",
495
+ "pnpm",
496
+ "husky",
497
+ "lint-staged",
498
+ "eslintConfig",
499
+ "prettier"
500
+ ],
501
+ pathPattern: "^$"
502
+ },
503
+ {
504
+ order: { type: "asc" },
505
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
506
+ },
507
+ {
508
+ order: ["types", "require", "import", "default"],
509
+ pathPattern: "^exports.*$"
510
+ },
511
+ {
512
+ order: { type: "asc" },
513
+ pathPattern: "^resolutions$"
514
+ },
515
+ {
516
+ order: { type: "asc" },
517
+ pathPattern: "^pnpm.overrides$"
518
+ }
519
+ ]
520
+ }
521
+ }
522
+ ];
523
+ }
524
+ async function sortJsconfig() {
525
+ return [
526
+ {
527
+ name: "cuiqg/sort/jsconfig-json",
528
+ files: ["**/jsconfig.json", "**/jsconfig.*.json"],
529
+ rules: {
530
+ "jsonc/sort-keys": [
531
+ "error",
532
+ {
533
+ order: [
534
+ "extends",
535
+ "compilerOptions",
536
+ "references",
537
+ "files",
538
+ "include",
539
+ "exclude"
540
+ ],
541
+ pathPattern: "^$"
542
+ },
543
+ {
544
+ order: [
545
+ /* Projects */
546
+ "incremental",
547
+ "composite",
548
+ "tsBuildInfoFile",
549
+ "disableSourceOfProjectReferenceRedirect",
550
+ "disableSolutionSearching",
551
+ "disableReferencedProjectLoad",
552
+ /* Language and Environment */
553
+ "target",
554
+ "jsx",
555
+ "jsxFactory",
556
+ "jsxFragmentFactory",
557
+ "jsxImportSource",
558
+ "lib",
559
+ "moduleDetection",
560
+ "noLib",
561
+ "reactNamespace",
562
+ "useDefineForClassFields",
563
+ "emitDecoratorMetadata",
564
+ "experimentalDecorators",
565
+ /* Modules */
566
+ "baseUrl",
567
+ "rootDir",
568
+ "rootDirs",
569
+ "customConditions",
570
+ "module",
571
+ "moduleResolution",
572
+ "moduleSuffixes",
573
+ "noResolve",
574
+ "paths",
575
+ "resolveJsonModule",
576
+ "resolvePackageJsonExports",
577
+ "resolvePackageJsonImports",
578
+ "typeRoots",
579
+ "types",
580
+ "allowArbitraryExtensions",
581
+ "allowImportingTsExtensions",
582
+ "allowUmdGlobalAccess",
583
+ /* JavaScript Support */
584
+ "allowJs",
585
+ "checkJs",
586
+ "maxNodeModuleJsDepth",
587
+ /* Type Checking */
588
+ "strict",
589
+ "strictBindCallApply",
590
+ "strictFunctionTypes",
591
+ "strictNullChecks",
592
+ "strictPropertyInitialization",
593
+ "allowUnreachableCode",
594
+ "allowUnusedLabels",
595
+ "alwaysStrict",
596
+ "exactOptionalPropertyTypes",
597
+ "noFallthroughCasesInSwitch",
598
+ "noImplicitAny",
599
+ "noImplicitOverride",
600
+ "noImplicitReturns",
601
+ "noImplicitThis",
602
+ "noPropertyAccessFromIndexSignature",
603
+ "noUncheckedIndexedAccess",
604
+ "noUnusedLocals",
605
+ "noUnusedParameters",
606
+ "useUnknownInCatchVariables",
607
+ /* Emit */
608
+ "declaration",
609
+ "declarationDir",
610
+ "declarationMap",
611
+ "downlevelIteration",
612
+ "emitBOM",
613
+ "emitDeclarationOnly",
614
+ "importHelpers",
615
+ "importsNotUsedAsValues",
616
+ "inlineSourceMap",
617
+ "inlineSources",
618
+ "mapRoot",
619
+ "newLine",
620
+ "noEmit",
621
+ "noEmitHelpers",
622
+ "noEmitOnError",
623
+ "outDir",
624
+ "outFile",
625
+ "preserveConstEnums",
626
+ "preserveValueImports",
627
+ "removeComments",
628
+ "sourceMap",
629
+ "sourceRoot",
630
+ "stripInternal",
631
+ /* Interop Constraints */
632
+ "allowSyntheticDefaultImports",
633
+ "esModuleInterop",
634
+ "forceConsistentCasingInFileNames",
635
+ "isolatedModules",
636
+ "preserveSymlinks",
637
+ "verbatimModuleSyntax",
638
+ /* Completeness */
639
+ "skipDefaultLibCheck",
640
+ "skipLibCheck"
641
+ ],
642
+ pathPattern: "^compilerOptions$"
643
+ }
644
+ ]
645
+ }
646
+ }
647
+ ];
648
+ }
649
+
650
+ // src/configs/stylistic.js
651
+ async function stylistic() {
652
+ const pluginStylistic = await interopDefault(
653
+ import("@stylistic/eslint-plugin")
654
+ );
655
+ const config = pluginStylistic.configs.customize({
656
+ flat: true,
657
+ pluginName: "style",
658
+ indent: 2,
659
+ jsx: true,
660
+ quotes: "single",
661
+ semi: false,
662
+ commaDangle: "never"
663
+ });
664
+ return [
665
+ {
666
+ name: "cuiqg/stylistic",
667
+ plugins: {
668
+ style: pluginStylistic
669
+ },
670
+ rules: {
671
+ ...config.rules
672
+ }
673
+ }
674
+ ];
675
+ }
676
+
677
+ // src/configs/unicorn.js
678
+ async function unicorn() {
679
+ const pluginUnicorn = await interopDefault(import("eslint-plugin-unicorn"));
680
+ return [
681
+ {
682
+ name: "cuiqg/unicorn",
683
+ plugins: {
684
+ unicorn: pluginUnicorn
685
+ },
686
+ rules: {
687
+ "unicorn/consistent-empty-array-spread": "error",
688
+ "unicorn/error-message": "error",
689
+ "unicorn/escape-case": "error",
690
+ "unicorn/new-for-builtins": "error",
691
+ "unicorn/no-instanceof-array": "error",
692
+ "unicorn/no-new-array": "error",
693
+ "unicorn/no-new-buffer": "error",
694
+ "unicorn/number-literal-case": "error",
695
+ "unicorn/prefer-dom-node-text-content": "error",
696
+ "unicorn/prefer-includes": "error",
697
+ "unicorn/prefer-node-protocol": "error",
698
+ "unicorn/prefer-number-properties": "error",
699
+ "unicorn/prefer-string-starts-ends-with": "error",
700
+ "unicorn/prefer-type-error": "error",
701
+ "unicorn/throw-new-error": "error"
702
+ }
703
+ }
704
+ ];
705
+ }
706
+
707
+ // src/configs/unocss.js
708
+ async function unocss() {
709
+ const pluginUnoCSS = await interopDefault(import("@unocss/eslint-plugin"));
710
+ return [
711
+ {
712
+ name: "cuiqg/unocss",
713
+ plugins: {
714
+ unocss: pluginUnoCSS
715
+ },
716
+ rules: {
717
+ "unocss/order": "error",
718
+ "unocss/order-attributify": "warn"
719
+ }
720
+ }
721
+ ];
722
+ }
723
+
724
+ // src/configs/unplugin.js
725
+ import fs from "node:fs";
726
+ import { dirname, resolve } from "node:path";
727
+ import process2 from "node:process";
728
+ import { loadConfig } from "unconfig";
729
+ async function autoImport() {
730
+ const resolved = resolve(process2.cwd(), `./.eslintrc-auto-import.json`);
731
+ if (fs.existsSync(resolved) && fs.statSync(resolved).isFile) {
732
+ const cwd = dirname(resolved);
733
+ const { config } = await loadConfig({
734
+ sources: [
735
+ {
736
+ files: resolved,
737
+ extensions: [],
738
+ rewrite(config2) {
739
+ return config2?.globals;
740
+ }
741
+ }
742
+ ],
743
+ cwd
744
+ });
745
+ return [
746
+ {
747
+ name: "cuiqg/unplugin/auto-import",
748
+ languageOptions: {
749
+ globals: {
750
+ ...config
751
+ }
752
+ }
753
+ }
754
+ ];
755
+ } else {
756
+ return [];
757
+ }
758
+ }
759
+
760
+ // src/configs/vue.js
761
+ async function vue() {
762
+ const files = [GLOB_VUE];
763
+ const [pluginVue, parserVue] = await Promise.all([
764
+ interopDefault(import("eslint-plugin-vue")),
765
+ interopDefault(import("vue-eslint-parser"))
766
+ ]);
767
+ return [
768
+ {
769
+ files,
770
+ languageOptions: {
771
+ globals: {
772
+ computed: "readonly",
773
+ defineModel: "readonly",
774
+ defineOptions: "readonly",
775
+ defineProps: "readonly",
776
+ defineRender: "readonly",
777
+ defineSlots: "readonly",
778
+ defineEmits: "readonly",
779
+ defineExpose: "readonly",
780
+ definePage: "readonly",
781
+ onMounted: "readonly",
782
+ onUnmounted: "readonly",
783
+ onActivated: "readonly",
784
+ onDeactivated: "readonly",
785
+ reactive: "readonly",
786
+ ref: "readonly",
787
+ shallowReactive: "readonly",
788
+ shallowRef: "readonly",
789
+ toRef: "readonly",
790
+ toRefs: "readonly",
791
+ watch: "readonly",
792
+ watchEffect: "readonly"
793
+ },
794
+ parser: parserVue,
795
+ parserOptions: {
796
+ ecmaFeatures: {
797
+ jsx: true
798
+ },
799
+ extraFileExtensions: [".vue"],
800
+ parser: null,
801
+ sourceType: "module"
802
+ }
803
+ },
804
+ name: "cuiqg/vue",
805
+ plugins: {
806
+ vue: pluginVue
807
+ },
808
+ processor: pluginVue.processors[".vue"],
809
+ rules: {
810
+ ...pluginVue.configs.base.rules,
811
+ ...pluginVue.configs["vue3-essential"].rules,
812
+ ...pluginVue.configs["vue3-strongly-recommended"].rules,
813
+ ...pluginVue.configs["vue3-recommended"].rules,
814
+ "vue/block-order": ["error", {
815
+ order: ["script", "template", "style", "route"]
816
+ }],
817
+ "vue/component-name-in-template-casing": ["error", "PascalCase"],
818
+ "vue/component-options-name-casing": ["error", "PascalCase"],
819
+ "vue/component-tags-order": "off",
820
+ "vue/custom-event-name-casing": ["error", "camelCase"],
821
+ "vue/define-macros-order": ["error", {
822
+ order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
823
+ }],
824
+ "vue/dot-location": ["error", "property"],
825
+ "vue/dot-notation": ["error", { allowKeywords: true }],
826
+ "vue/eqeqeq": ["error", "smart"],
827
+ "vue/html-indent": ["error", 2],
828
+ "vue/html-quotes": ["error", "double"],
829
+ "vue/max-attributes-per-line": ["error", {
830
+ singleline: {
831
+ max: 1
832
+ },
833
+ multiline: {
834
+ max: 1
835
+ }
836
+ }],
837
+ "vue/multi-word-component-names": "off",
838
+ "vue/no-dupe-keys": "off",
839
+ "vue/no-empty-pattern": "error",
840
+ "vue/no-irregular-whitespace": "error",
841
+ "vue/no-loss-of-precision": "error",
842
+ "vue/no-restricted-syntax": [
843
+ "error",
844
+ "DebuggerStatement",
845
+ "LabeledStatement",
846
+ "WithStatement"
847
+ ],
848
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
849
+ "vue/no-setup-props-reactivity-loss": "off",
850
+ "vue/no-sparse-arrays": "error",
851
+ "vue/no-unused-refs": "error",
852
+ "vue/no-useless-v-bind": "error",
853
+ "vue/no-v-html": "off",
854
+ "vue/object-shorthand": [
855
+ "error",
856
+ "always",
857
+ {
858
+ avoidQuotes: true,
859
+ ignoreConstructors: false
860
+ }
861
+ ],
862
+ "vue/prefer-separate-static-class": "error",
863
+ "vue/prefer-template": "error",
864
+ "vue/prop-name-casing": ["error", "camelCase"],
865
+ "vue/require-default-prop": "off",
866
+ "vue/require-prop-types": "off",
867
+ "vue/space-infix-ops": "error",
868
+ "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
869
+ "vue/array-bracket-spacing": ["error", "never"],
870
+ "vue/arrow-spacing": ["error", { after: true, before: true }],
871
+ "vue/block-spacing": ["error", "always"],
872
+ "vue/block-tag-newline": ["error", {
873
+ multiline: "always",
874
+ singleline: "always"
875
+ }],
876
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
877
+ "vue/comma-dangle": ["error", "always-multiline"],
878
+ "vue/comma-spacing": ["error", { after: true, before: false }],
879
+ "vue/comma-style": ["error", "last"],
880
+ "vue/html-comment-content-spacing": ["error", "always", {
881
+ exceptions: ["-"]
882
+ }],
883
+ "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
884
+ "vue/keyword-spacing": ["error", { after: true, before: true }],
885
+ "vue/object-curly-newline": "off",
886
+ "vue/object-curly-spacing": ["error", "always"],
887
+ "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
888
+ "vue/operator-linebreak": ["error", "before"],
889
+ "vue/padding-line-between-blocks": ["error", "always"],
890
+ "vue/quote-props": ["error", "consistent-as-needed"],
891
+ "vue/space-in-parens": ["error", "never"],
892
+ "vue/template-curly-spacing": "error",
893
+ "vue/no-export-in-script-setup": "off",
894
+ // exportRender / exportExpose / exportProps
895
+ "vue/valid-attribute-name": "off",
896
+ // short-vmodel
897
+ "vue/valid-define-props": "off",
898
+ // hoistStatic
899
+ "vue/valid-v-bind": "off",
900
+ "vue/no-unused-vars": "off"
901
+ }
902
+ }
903
+ ];
904
+ }
905
+
906
+ // src/configs/yaml.js
907
+ async function yaml() {
908
+ const files = [GLOB_YAML];
909
+ const [pluginYaml, parserYaml] = await Promise.all([
910
+ interopDefault(import("eslint-plugin-yml")),
911
+ interopDefault(import("yaml-eslint-parser"))
912
+ ]);
913
+ return [
914
+ {
915
+ name: "cuiqg/yaml",
916
+ files,
917
+ plugins: {
918
+ yaml: pluginYaml
919
+ },
920
+ languageOptions: {
921
+ parser: parserYaml
922
+ },
923
+ rules: {
924
+ ...pluginYaml.configs.standard.rules,
925
+ ...pluginYaml.configs.prettier.rules,
926
+ "yaml/block-mapping": "error",
927
+ "yaml/block-sequence": "error",
928
+ "yaml/no-empty-key": "error",
929
+ "yaml/no-empty-sequence-entry": "error",
930
+ "yaml/no-irregular-whitespace": "error",
931
+ "yaml/plain-scalar": "error",
932
+ "yaml/vue-custom-block/no-parsing-error": "error"
933
+ }
934
+ }
935
+ ];
936
+ }
937
+
938
+ // src/presets.js
939
+ var defaultPluginRenaming = {
940
+ "@stylistic": "style",
941
+ "import-x": "import",
942
+ "n": "node",
943
+ "yml": "yaml"
944
+ };
945
+ function cuiqg(options = {}, ...userConfigs) {
946
+ const {
947
+ prettier: enablePrettier = false,
948
+ unocss: enableUnocss = hasUnocss,
949
+ vue: enableVue = hasVue,
950
+ stylistic: enableStylistic = true,
951
+ jsdoc: enableJsdoc = false
952
+ } = options;
953
+ const configs = [];
954
+ configs.push(
955
+ autoImport(),
956
+ ignores(),
957
+ javascript(),
958
+ comments(),
959
+ node(),
960
+ imports(),
961
+ unicorn(),
962
+ perfectionist(),
963
+ jsonc(),
964
+ sortPackageJson(),
965
+ sortJsconfig(),
966
+ yaml()
967
+ );
968
+ if (enableStylistic) {
969
+ configs.push(
970
+ stylistic()
971
+ );
972
+ }
973
+ if (enableVue) {
974
+ configs.push(
975
+ vue()
976
+ );
977
+ }
978
+ if (enableUnocss) {
979
+ configs.push(
980
+ unocss()
981
+ );
982
+ }
983
+ if (enablePrettier) {
984
+ configs.push(
985
+ prettier()
986
+ );
987
+ }
988
+ if (enableJsdoc) {
989
+ configs.push(
990
+ jsdoc()
991
+ );
992
+ }
993
+ let composer = new FlatConfigComposer();
994
+ composer = composer.append(...configs, ...userConfigs).renamePlugins(defaultPluginRenaming);
995
+ return composer;
996
+ }
997
+
998
+ // src/index.js
999
+ var src_default = cuiqg;
1000
+ export {
1001
+ GLOB_CSS,
1002
+ GLOB_EXCLUDE,
1003
+ GLOB_HTML,
1004
+ GLOB_JS,
1005
+ GLOB_JSON,
1006
+ GLOB_JSON5,
1007
+ GLOB_JSONC,
1008
+ GLOB_JSX,
1009
+ GLOB_LESS,
1010
+ GLOB_POSTCSS,
1011
+ GLOB_SCSS,
1012
+ GLOB_SRC,
1013
+ GLOB_SRC_EXT,
1014
+ GLOB_STYLE,
1015
+ GLOB_VUE,
1016
+ GLOB_XML,
1017
+ GLOB_YAML,
1018
+ autoImport,
1019
+ comments,
1020
+ cuiqg,
1021
+ src_default as default,
1022
+ defaultPluginRenaming,
1023
+ hasUnocss,
1024
+ hasVue,
1025
+ ignores,
1026
+ imports,
1027
+ interopDefault,
1028
+ isInEditor,
1029
+ javascript,
1030
+ jsdoc,
1031
+ jsonc,
1032
+ node,
1033
+ perfectionist,
1034
+ prettier,
1035
+ sortJsconfig,
1036
+ sortPackageJson,
1037
+ stylistic,
1038
+ unicorn,
1039
+ unocss,
1040
+ vue,
1041
+ yaml
1042
+ };