@cuiqg/eslint-config 2.5.7 → 2.5.9

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 DELETED
@@ -1,822 +0,0 @@
1
- import { FlatConfigComposer } from "eslint-flat-config-utils";
2
- import globals from "globals";
3
- import process from "node:process";
4
- import { isPackageExists } from "local-pkg";
5
-
6
- //#region src/utils.js
7
- async function interopDefault(module) {
8
- try {
9
- let resolved = await module;
10
- return resolved?.default || resolved;
11
- } catch (error) {
12
- throw new Error(`Cannot import module: ${String(error)}`);
13
- }
14
- }
15
- function renameRules(rules, map) {
16
- return Object.fromEntries(Object.entries(rules).map(([key, value]) => {
17
- for (const [from, to] of Object.entries(map)) if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
18
- return [key, value];
19
- }));
20
- }
21
-
22
- //#endregion
23
- //#region src/configs/de-morgan.js
24
- async function deMorgan() {
25
- const pluginDeMorgan = await interopDefault(import("eslint-plugin-de-morgan"));
26
- return [{
27
- ...pluginDeMorgan.configs.recommended,
28
- name: "cuiqg/de-morgan"
29
- }];
30
- }
31
-
32
- //#endregion
33
- //#region src/globs.js
34
- const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
35
- const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
36
- const GLOB_TS = `**/*.?([cm])ts`;
37
- const GLOB_TSX = `**/*.?([cm])tsx`;
38
- const GLOB_JS = `**/*.?([cm])js`;
39
- const GLOB_JSX = `**/*.?([cm])jsx`;
40
- const GLOB_STYLE = "**/*.{c,le,sc}ss";
41
- const GLOB_CSS = "**/*.css";
42
- const GLOB_SCSS = "**/*.scss";
43
- const GLOB_LESS = "**/*.less";
44
- const GLOB_STYLUS = "**/*.styl";
45
- const GLOB_POSTCSS = "**/*.{p,post}css";
46
- const GLOB_JSON = "**/*.json";
47
- const GLOB_JSON5 = "**/*.json5";
48
- const GLOB_JSONC = "**/*.jsonc";
49
- const GLOB_MARKDOWN = "**/*.md";
50
- const GLOB_VUE = "**/*.vue";
51
- const GLOB_YAML = "**/*.y?(a)ml";
52
- const GLOB_TOML = "**/*.toml";
53
- const GLOB_XML = "**/*.xml";
54
- const GLOB_SVG = "**/*.svg";
55
- const GLOB_HTML = "**/*.htm?(l)";
56
- const GLOB_ALL_SRC = [
57
- GLOB_SRC,
58
- GLOB_STYLE,
59
- GLOB_HTML,
60
- GLOB_VUE,
61
- GLOB_YAML,
62
- GLOB_XML,
63
- GLOB_JSONC,
64
- GLOB_JSON5,
65
- GLOB_JSON
66
- ];
67
- const GLOB_EXCLUDE = [
68
- "**/node_modules",
69
- "**/dist",
70
- "**/package-lock.json",
71
- "**/yarn.lock",
72
- "**/pnpm-lock.yaml",
73
- "**/bun.lockb",
74
- "**/output",
75
- "**/coverage",
76
- "**/temp",
77
- "**/.temp",
78
- "**/tmp",
79
- "**/.tmp",
80
- "**/.history",
81
- "**/.vitepress/cache",
82
- "**/.nuxt",
83
- "**/.next",
84
- "**/.svelte-kit",
85
- "**/.vercel",
86
- "**/.changeset",
87
- "**/.idea",
88
- "**/.cache",
89
- "**/.output",
90
- "**/.vite-inspect",
91
- "**/.yarn",
92
- "**/vite.config.*.timestamp-*",
93
- "**/CHANGELOG*.md",
94
- "**/*.min.*",
95
- "**/LICENSE*",
96
- "**/__snapshots__",
97
- "**/auto-import?(s).d.ts",
98
- "**/components.d.ts",
99
- "**/.eslint-config-inspector"
100
- ];
101
-
102
- //#endregion
103
- //#region src/configs/ignores.js
104
- async function ignores() {
105
- const configGitignore = await interopDefault(import("eslint-config-flat-gitignore"));
106
- return [{
107
- ignores: [...GLOB_EXCLUDE],
108
- name: "cuiqg/ignores"
109
- }, configGitignore({
110
- name: "cuiqg/gitignore",
111
- strict: false
112
- })];
113
- }
114
-
115
- //#endregion
116
- //#region src/configs/imports.js
117
- async function imports() {
118
- const pluginImportLite = await interopDefault(import("eslint-plugin-import-lite"));
119
- return [{
120
- name: "cuiqg/imports",
121
- plugins: { import: pluginImportLite },
122
- rules: {
123
- "import/consistent-type-specifier-style": ["error", "top-level"],
124
- "import/first": "error",
125
- "import/newline-after-import": ["error", { count: 1 }],
126
- "import/no-duplicates": "error",
127
- "import/no-mutable-exports": "error",
128
- "import/no-named-default": "error"
129
- }
130
- }];
131
- }
132
-
133
- //#endregion
134
- //#region src/env.js
135
- const isInGitHookOrLintStaged = () => {
136
- return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
137
- };
138
- const isInEditor = () => {
139
- if (process.env.CI) return false;
140
- if (isInGitHookOrLintStaged()) return false;
141
- return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
142
- };
143
- const hasVue = () => [
144
- "vue",
145
- "nuxt",
146
- "vitepress",
147
- "@slidev/cli"
148
- ].some((i) => isPackageExists("vue"));
149
- const hasTypeScript = () => isPackageExists("typescript");
150
- const hasUnoCss = () => isPackageExists("unocss");
151
- const hasNextjs = () => isPackageExists("next");
152
-
153
- //#endregion
154
- //#region src/configs/javascript.js
155
- async function javascript() {
156
- const [pluginUnuseImports, pluginJs] = await Promise.all([interopDefault(import("eslint-plugin-unused-imports")), interopDefault(import("@eslint/js"))]);
157
- return [{
158
- name: "cuiqg/javascript",
159
- languageOptions: {
160
- ecmaVersion: "latest",
161
- globals: {
162
- ...globals.browser,
163
- ...globals.es2025,
164
- ...globals.node
165
- },
166
- parserOptions: {
167
- ecmaFeatures: { jsx: true },
168
- ecmaVersion: "latest",
169
- sourceType: "module"
170
- },
171
- sourceType: "module"
172
- },
173
- linterOptions: { reportUnusedDisableDirectives: true },
174
- plugins: {
175
- "unused-imports": pluginUnuseImports,
176
- js: pluginJs
177
- },
178
- rules: {
179
- ...pluginJs.configs.recommended.rules,
180
- "accessor-pairs": ["error", {
181
- enforceForClassMembers: true,
182
- setWithoutGet: true
183
- }],
184
- "array-callback-return": "error",
185
- "block-scoped-var": "error",
186
- "constructor-super": "error",
187
- "default-case-last": "error",
188
- "dot-notation": ["error", { allowKeywords: true }],
189
- eqeqeq: ["error", "smart"],
190
- "new-cap": ["error", {
191
- capIsNew: false,
192
- newIsCap: true,
193
- properties: true
194
- }],
195
- "no-alert": "error",
196
- "no-array-constructor": "error",
197
- "no-async-promise-executor": "error",
198
- "no-caller": "error",
199
- "no-case-declarations": "error",
200
- "no-class-assign": "error",
201
- "no-compare-neg-zero": "error",
202
- "no-cond-assign": ["error", "always"],
203
- "no-console": ["error", { allow: ["warn", "error"] }],
204
- "no-const-assign": "error",
205
- "no-control-regex": "error",
206
- "no-debugger": "error",
207
- "no-delete-var": "error",
208
- "no-dupe-args": "error",
209
- "no-dupe-class-members": "error",
210
- "no-dupe-keys": "error",
211
- "no-duplicate-case": "error",
212
- "no-empty": ["error", { allowEmptyCatch: true }],
213
- "no-empty-character-class": "error",
214
- "no-empty-pattern": "error",
215
- "no-eval": "error",
216
- "no-ex-assign": "error",
217
- "no-extend-native": "error",
218
- "no-extra-bind": "error",
219
- "no-extra-boolean-cast": "error",
220
- "no-fallthrough": "error",
221
- "no-func-assign": "error",
222
- "no-global-assign": "error",
223
- "no-implied-eval": "error",
224
- "no-import-assign": "error",
225
- "no-invalid-regexp": "error",
226
- "no-irregular-whitespace": "error",
227
- "no-iterator": "error",
228
- "no-labels": ["error", {
229
- allowLoop: false,
230
- allowSwitch: false
231
- }],
232
- "no-lone-blocks": "error",
233
- "no-loss-of-precision": "error",
234
- "no-misleading-character-class": "error",
235
- "no-multi-str": "error",
236
- "no-new": "error",
237
- "no-new-func": "error",
238
- "no-new-native-nonconstructor": "error",
239
- "no-new-wrappers": "error",
240
- "no-obj-calls": "error",
241
- "no-octal": "error",
242
- "no-octal-escape": "error",
243
- "no-proto": "error",
244
- "no-prototype-builtins": "error",
245
- "no-redeclare": ["error", { builtinGlobals: false }],
246
- "no-regex-spaces": "error",
247
- "no-restricted-globals": [
248
- "error",
249
- {
250
- message: "Use `globalThis` instead.",
251
- name: "global"
252
- },
253
- {
254
- message: "Use `globalThis` instead.",
255
- name: "self"
256
- }
257
- ],
258
- "no-restricted-properties": [
259
- "error",
260
- {
261
- message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
262
- property: "__proto__"
263
- },
264
- {
265
- message: "Use `Object.defineProperty` instead.",
266
- property: "__defineGetter__"
267
- },
268
- {
269
- message: "Use `Object.defineProperty` instead.",
270
- property: "__defineSetter__"
271
- },
272
- {
273
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
274
- property: "__lookupGetter__"
275
- },
276
- {
277
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
278
- property: "__lookupSetter__"
279
- }
280
- ],
281
- "no-restricted-syntax": [
282
- "error",
283
- "TSEnumDeclaration[const=true]",
284
- "TSExportAssignment"
285
- ],
286
- "no-self-assign": ["error", { props: true }],
287
- "no-self-compare": "error",
288
- "no-sequences": "error",
289
- "no-shadow-restricted-names": "error",
290
- "no-sparse-arrays": "error",
291
- "no-template-curly-in-string": "error",
292
- "no-this-before-super": "error",
293
- "no-throw-literal": "error",
294
- "no-undef": "error",
295
- "no-undef-init": "error",
296
- "no-unexpected-multiline": "error",
297
- "no-unmodified-loop-condition": "error",
298
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
299
- "no-unreachable": "error",
300
- "no-unreachable-loop": "error",
301
- "no-unsafe-finally": "error",
302
- "no-unsafe-negation": "error",
303
- "no-unused-expressions": ["error", {
304
- allowShortCircuit: true,
305
- allowTaggedTemplates: true,
306
- allowTernary: true
307
- }],
308
- "no-unused-vars": ["error", {
309
- args: "none",
310
- caughtErrors: "none",
311
- ignoreRestSiblings: true,
312
- vars: "all"
313
- }],
314
- "no-use-before-define": ["error", {
315
- classes: false,
316
- functions: false,
317
- variables: true
318
- }],
319
- "no-useless-backreference": "error",
320
- "no-useless-call": "error",
321
- "no-useless-catch": "error",
322
- "no-useless-computed-key": "error",
323
- "no-useless-constructor": "error",
324
- "no-useless-rename": "error",
325
- "no-var": "error",
326
- "no-with": "error",
327
- "object-shorthand": [
328
- "error",
329
- "always",
330
- {
331
- avoidQuotes: true,
332
- ignoreConstructors: false
333
- }
334
- ],
335
- "one-var": ["error", { initialized: "never" }],
336
- "prefer-arrow-callback": ["error", {
337
- allowNamedFunctions: false,
338
- allowUnboundThis: true
339
- }],
340
- "prefer-const": [isInEditor() ? "warn" : "error", {
341
- destructuring: "all",
342
- ignoreReadBeforeAssign: true
343
- }],
344
- "prefer-exponentiation-operator": "error",
345
- "prefer-promise-reject-errors": "error",
346
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
347
- "prefer-rest-params": "error",
348
- "prefer-spread": "error",
349
- "prefer-template": "error",
350
- "symbol-description": "error",
351
- "unicode-bom": ["error", "never"],
352
- "unused-imports/no-unused-imports": isInEditor() ? "warn" : "error",
353
- "unused-imports/no-unused-vars": ["error", {
354
- args: "after-used",
355
- argsIgnorePattern: "^_",
356
- ignoreRestSiblings: true,
357
- vars: "all",
358
- varsIgnorePattern: "^_"
359
- }],
360
- "use-isnan": ["error", {
361
- enforceForIndexOf: true,
362
- enforceForSwitchCase: true
363
- }],
364
- "valid-typeof": ["error", { requireStringLiterals: true }],
365
- "vars-on-top": "error",
366
- yoda: ["error", "never"]
367
- }
368
- }];
369
- }
370
-
371
- //#endregion
372
- //#region src/configs/jsdoc.js
373
- async function jsdoc() {
374
- const pluginJsdoc = await interopDefault(import("eslint-plugin-jsdoc"));
375
- return [{
376
- name: "cuiqg/jsdoc",
377
- plugins: { jsdoc: pluginJsdoc },
378
- rules: {
379
- "jsdoc/check-access": "warn",
380
- "jsdoc/check-param-names": "warn",
381
- "jsdoc/check-property-names": "warn",
382
- "jsdoc/check-types": "warn",
383
- "jsdoc/empty-tags": "warn",
384
- "jsdoc/implements-on-classes": "warn",
385
- "jsdoc/no-defaults": "warn",
386
- "jsdoc/no-multi-asterisks": "warn",
387
- "jsdoc/require-param-name": "warn",
388
- "jsdoc/require-property": "warn",
389
- "jsdoc/require-property-description": "warn",
390
- "jsdoc/require-property-name": "warn",
391
- "jsdoc/require-returns-check": "warn",
392
- "jsdoc/require-returns-description": "warn",
393
- "jsdoc/require-yields-check": "warn",
394
- "jsdoc/check-alignment": "warn",
395
- "jsdoc/multiline-blocks": "warn"
396
- }
397
- }];
398
- }
399
-
400
- //#endregion
401
- //#region src/configs/jsonc.js
402
- async function jsonc() {
403
- const files = [
404
- GLOB_JSON,
405
- GLOB_JSON5,
406
- GLOB_JSONC
407
- ];
408
- const [pluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
409
- return [{
410
- files,
411
- name: "cuiqg/jsonc",
412
- plugins: { jsonc: pluginJsonc },
413
- languageOptions: { parser: parserJsonc },
414
- rules: {
415
- "jsonc/no-bigint-literals": "error",
416
- "jsonc/no-binary-expression": "error",
417
- "jsonc/no-binary-numeric-literals": "error",
418
- "jsonc/no-dupe-keys": "error",
419
- "jsonc/no-escape-sequence-in-identifier": "error",
420
- "jsonc/no-floating-decimal": "error",
421
- "jsonc/no-hexadecimal-numeric-literals": "error",
422
- "jsonc/no-infinity": "error",
423
- "jsonc/no-multi-str": "error",
424
- "jsonc/no-nan": "error",
425
- "jsonc/no-number-props": "error",
426
- "jsonc/no-numeric-separators": "error",
427
- "jsonc/no-octal": "error",
428
- "jsonc/no-octal-escape": "error",
429
- "jsonc/no-octal-numeric-literals": "error",
430
- "jsonc/no-parenthesized": "error",
431
- "jsonc/no-plus-sign": "error",
432
- "jsonc/no-regexp-literals": "error",
433
- "jsonc/no-sparse-arrays": "error",
434
- "jsonc/no-template-literals": "error",
435
- "jsonc/no-undefined-value": "error",
436
- "jsonc/no-unicode-codepoint-escapes": "error",
437
- "jsonc/no-useless-escape": "error",
438
- "jsonc/space-unary-ops": "error",
439
- "jsonc/valid-json-number": "error",
440
- "jsonc/vue-custom-block/no-parsing-error": "error",
441
- "jsonc/array-bracket-spacing": ["error", "never"],
442
- "jsonc/comma-dangle": ["error", "never"],
443
- "jsonc/comma-style": ["error", "last"],
444
- "jsonc/indent": ["error", 2],
445
- "jsonc/key-spacing": ["error", {
446
- afterColon: true,
447
- beforeColon: false
448
- }],
449
- "jsonc/object-curly-newline": ["error", {
450
- consistent: true,
451
- multiline: true
452
- }],
453
- "jsonc/object-curly-spacing": ["error", "always"],
454
- "jsonc/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
455
- "jsonc/quote-props": "error",
456
- "jsonc/quotes": "error"
457
- }
458
- }];
459
- }
460
-
461
- //#endregion
462
- //#region src/configs/nextjs.js
463
- function normalizeRules(rules) {
464
- return Object.fromEntries(Object.entries(rules).map(([key, value]) => [key, typeof value === "string" ? [value] : value]));
465
- }
466
- async function nextjs() {
467
- const files = [GLOB_SRC];
468
- const pluginNextJS = await interopDefault(import("@next/eslint-plugin-next"));
469
- return [{
470
- name: "cuiqg/nextjs",
471
- files,
472
- plugins: { next: pluginNextJS },
473
- languageOptions: {
474
- parserOptions: { ecmaFeatures: { jsx: true } },
475
- sourceType: "module"
476
- },
477
- rules: {
478
- ...normalizeRules(pluginNextJS.configs.recommended.rules),
479
- ...normalizeRules(pluginNextJS.configs["core-web-vitals"].rules)
480
- },
481
- settings: { react: { version: "detect" } }
482
- }];
483
- }
484
-
485
- //#endregion
486
- //#region src/configs/node.js
487
- async function node() {
488
- const pluginNode = await interopDefault(import("eslint-plugin-n"));
489
- return [{
490
- name: "cuiqg/node",
491
- plugins: { node: pluginNode },
492
- rules: {
493
- "node/handle-callback-err": ["error", "^(err|error)$"],
494
- "node/no-deprecated-api": "error",
495
- "node/no-exports-assign": "error",
496
- "node/no-new-require": "error",
497
- "node/no-path-concat": "error",
498
- "node/prefer-global/buffer": ["error", "never"],
499
- "node/prefer-global/process": ["error", "never"],
500
- "node/process-exit-as-throw": "error"
501
- }
502
- }];
503
- }
504
-
505
- //#endregion
506
- //#region src/configs/package-json.js
507
- async function packageJson() {
508
- const [pluginPackageJson, pluginDepend, parserJsonc] = await Promise.all([
509
- interopDefault(import("eslint-plugin-package-json")),
510
- interopDefault(import("eslint-plugin-depend")),
511
- interopDefault(import("jsonc-eslint-parser"))
512
- ]);
513
- return [{
514
- files: ["**/package.json"],
515
- plugins: {
516
- depend: pluginDepend,
517
- "package-json": pluginPackageJson
518
- },
519
- languageOptions: { parser: parserJsonc },
520
- name: "cuiqg/package-json",
521
- rules: {
522
- "depend/ban-dependencies": "error",
523
- ...pluginPackageJson.configs.recommended.rules
524
- },
525
- settings: { packageJson: { enforceForPrivate: false } }
526
- }];
527
- }
528
-
529
- //#endregion
530
- //#region src/configs/perfectionist.js
531
- async function perfectionist() {
532
- const pluginPerfectionist = await interopDefault(import("eslint-plugin-perfectionist"));
533
- return [{
534
- name: "cuiqg/perfectionist",
535
- plugins: { perfectionist: pluginPerfectionist },
536
- rules: {
537
- "perfectionist/sort-exports": ["error", {
538
- order: "asc",
539
- type: "natural"
540
- }],
541
- "perfectionist/sort-imports": ["error", {
542
- groups: [
543
- "type",
544
- [
545
- "parent-type",
546
- "sibling-type",
547
- "index-type",
548
- "internal-type"
549
- ],
550
- "builtin",
551
- "external",
552
- "internal",
553
- [
554
- "parent",
555
- "sibling",
556
- "index"
557
- ],
558
- "side-effect",
559
- "object",
560
- "unknown"
561
- ],
562
- newlinesBetween: "ignore",
563
- order: "asc",
564
- type: "natural"
565
- }],
566
- "perfectionist/sort-named-exports": ["error", {
567
- order: "asc",
568
- type: "natural"
569
- }],
570
- "perfectionist/sort-named-imports": ["error", {
571
- order: "asc",
572
- type: "natural"
573
- }]
574
- },
575
- settings: { perfectionist: {
576
- order: "desc",
577
- type: "line-length"
578
- } }
579
- }];
580
- }
581
-
582
- //#endregion
583
- //#region src/configs/prettier.js
584
- async function prettier() {
585
- const [pluginPrettier, recommendedPrettier] = await Promise.all([interopDefault(import("eslint-plugin-prettier")), interopDefault(import("eslint-plugin-prettier/recommended"))]);
586
- return [{
587
- plugins: { prettier: pluginPrettier },
588
- name: "cuiqg/prettier",
589
- rules: {
590
- ...recommendedPrettier.rules,
591
- "prettier/prettier": "warn"
592
- }
593
- }];
594
- }
595
-
596
- //#endregion
597
- //#region src/configs/stylistic.js
598
- async function stylistic() {
599
- const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
600
- const config = pluginStylistic.configs.customize({
601
- pluginName: "style",
602
- indent: 2,
603
- quotes: "single",
604
- semi: false,
605
- commaDangle: "never"
606
- });
607
- return [{
608
- name: "cuiqg/stylistic",
609
- plugins: { style: pluginStylistic },
610
- rules: {
611
- ...config.rules,
612
- "style/generator-star-spacing": ["error", {
613
- after: true,
614
- before: false
615
- }],
616
- "style/yield-star-spacing": ["error", {
617
- after: true,
618
- before: false
619
- }]
620
- }
621
- }];
622
- }
623
-
624
- //#endregion
625
- //#region src/configs/unocss.js
626
- async function unocss() {
627
- const [pluginUnoCSS] = await Promise.all([interopDefault(import("@unocss/eslint-plugin"))]);
628
- return [{
629
- name: "cuiqg/unocss",
630
- plugins: { unocss: pluginUnoCSS },
631
- rules: { ...renameRules(pluginUnoCSS.configs.recommended.rules, { "@unocss": "unocss" }) }
632
- }];
633
- }
634
-
635
- //#endregion
636
- //#region src/configs/vue.js
637
- async function vue() {
638
- const files = [GLOB_VUE];
639
- const [pluginVue, parserVue] = await Promise.all([interopDefault(import("eslint-plugin-vue")), interopDefault(import("vue-eslint-parser"))]);
640
- return [{
641
- languageOptions: {
642
- globals: {
643
- ref: "readonly",
644
- computed: "readonly",
645
- reactive: "readonly",
646
- defineProps: "readonly",
647
- defineEmits: "readonly",
648
- defineModel: "readonly",
649
- defineExpose: "readonly",
650
- defineOptions: "readonly",
651
- defineSlots: "readonly",
652
- useSlots: "readonly",
653
- useAttrs: "readonly",
654
- onMounted: "readonly",
655
- onUnmounted: "readonly",
656
- onActivated: "readonly",
657
- onDeactivated: "readonly",
658
- toRef: "readonly",
659
- toRefs: "readonly",
660
- watch: "readonly",
661
- watchEffect: "readonly"
662
- },
663
- parser: parserVue,
664
- parserOptions: {
665
- ecmaFeatures: { jsx: true },
666
- extraFileExtensions: [".vue"],
667
- parser: null,
668
- sourceType: "module"
669
- }
670
- },
671
- name: "cuiqg/vue",
672
- plugins: { vue: pluginVue },
673
- files,
674
- processor: pluginVue.processors[".vue"],
675
- rules: {
676
- ...pluginVue.configs["flat/recommended"].map((c) => c.rules).reduce((acc, c) => ({
677
- ...acc,
678
- ...c
679
- }), {}),
680
- "node/prefer-global/process": "off",
681
- "vue/block-order": ["error", { order: [
682
- "script",
683
- "template",
684
- "style"
685
- ] }],
686
- "vue/custom-event-name-casing": ["error", "camelCase"],
687
- "vue/define-macros-order": ["error", { order: [
688
- "defineOptions",
689
- "defineProps",
690
- "defineEmits",
691
- "defineSlots"
692
- ] }],
693
- "vue/dot-location": ["error", "property"],
694
- "vue/dot-notation": ["error", { allowKeywords: true }],
695
- "vue/eqeqeq": ["error", "smart"],
696
- "vue/html-indent": ["error", 2],
697
- "vue/html-quotes": ["error", "double"],
698
- "vue/max-attributes-per-line": "off",
699
- "vue/multi-word-component-names": "off",
700
- "vue/no-dupe-keys": "off",
701
- "vue/no-empty-pattern": "error",
702
- "vue/no-irregular-whitespace": "error",
703
- "vue/no-loss-of-precision": "error",
704
- "vue/no-restricted-syntax": [
705
- "error",
706
- "DebuggerStatement",
707
- "LabeledStatement",
708
- "WithStatement"
709
- ],
710
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
711
- "vue/no-setup-props-reactivity-loss": "off",
712
- "vue/no-sparse-arrays": "error",
713
- "vue/no-unused-refs": "error",
714
- "vue/no-useless-v-bind": "error",
715
- "vue/no-v-html": "off",
716
- "vue/object-shorthand": [
717
- "error",
718
- "always",
719
- {
720
- avoidQuotes: true,
721
- ignoreConstructors: false
722
- }
723
- ],
724
- "vue/prefer-separate-static-class": "error",
725
- "vue/prefer-template": "error",
726
- "vue/prop-name-casing": ["error", "camelCase"],
727
- "vue/require-default-prop": "off",
728
- "vue/require-prop-types": "off",
729
- "vue/space-infix-ops": "error",
730
- "vue/space-unary-ops": ["error", {
731
- nonwords: false,
732
- words: true
733
- }],
734
- "vue/array-bracket-spacing": ["error", "never"],
735
- "vue/arrow-spacing": ["error", {
736
- after: true,
737
- before: true
738
- }],
739
- "vue/block-spacing": ["error", "always"],
740
- "vue/block-tag-newline": ["error", {
741
- multiline: "always",
742
- singleline: "always"
743
- }],
744
- "vue/brace-style": [
745
- "error",
746
- "stroustrup",
747
- { allowSingleLine: true }
748
- ],
749
- "vue/comma-dangle": ["error", "always-multiline"],
750
- "vue/comma-spacing": ["error", {
751
- after: true,
752
- before: false
753
- }],
754
- "vue/comma-style": ["error", "last"],
755
- "vue/html-comment-content-spacing": [
756
- "error",
757
- "always",
758
- { exceptions: ["-"] }
759
- ],
760
- "vue/key-spacing": ["error", {
761
- afterColon: true,
762
- beforeColon: false
763
- }],
764
- "vue/keyword-spacing": ["error", {
765
- after: true,
766
- before: true
767
- }],
768
- "vue/object-curly-newline": "off",
769
- "vue/object-curly-spacing": ["error", "always"],
770
- "vue/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
771
- "vue/operator-linebreak": ["error", "before"],
772
- "vue/padding-line-between-blocks": ["error", "always"],
773
- "vue/quote-props": ["error", "consistent-as-needed"],
774
- "vue/space-in-parens": ["error", "never"],
775
- "vue/template-curly-spacing": "error"
776
- }
777
- }];
778
- }
779
-
780
- //#endregion
781
- //#region src/configs/macros.js
782
- async function macros() {
783
- const configMacros = await interopDefault(import("@vue-macros/eslint-config"));
784
- return [{
785
- ...configMacros,
786
- name: "cuiqg/macros"
787
- }];
788
- }
789
-
790
- //#endregion
791
- //#region src/presets.js
792
- const defaultPluginRenaming = {
793
- "@next/next": "next",
794
- n: "node",
795
- vitest: "test",
796
- "import-lite": "import",
797
- "@stylistic": "style"
798
- };
799
- function cuiqg(options = {}, ...userConfigs) {
800
- const { prettier: enablePrettier = false, imports: enableImports = true, vue: enableVue = hasVue(), unocss: enableUnocss = hasUnoCss(), nextjs: enableNextjs = hasNextjs() } = options;
801
- const configs = [];
802
- configs.push(deMorgan(), ignores(), javascript(), jsdoc(), jsonc(), stylistic(), node(), packageJson(), perfectionist());
803
- if (enableImports) configs.push(imports());
804
- if (enableVue) {
805
- configs.push(vue());
806
- configs.push(macros());
807
- }
808
- if (enableUnocss) configs.push(unocss());
809
- if (enableNextjs) configs.push(nextjs());
810
- if (enablePrettier) configs.push(prettier());
811
- let composer = new FlatConfigComposer();
812
- composer = composer.append(...configs, ...userConfigs).renamePlugins(defaultPluginRenaming);
813
- if (isInEditor()) composer = composer.disableRulesFix(["unused-imports/no-unused-imports", "prefer-const"], { builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then((r) => r.builtinRules) });
814
- return composer;
815
- }
816
-
817
- //#endregion
818
- //#region src/index.js
819
- var src_default = cuiqg;
820
-
821
- //#endregion
822
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_STYLUS, GLOB_SVG, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, cuiqg, deMorgan, src_default as default, defaultPluginRenaming, hasNextjs, hasTypeScript, hasUnoCss, hasVue, ignores, imports, isInEditor, isInGitHookOrLintStaged, javascript, jsdoc, jsonc, macros, nextjs, node, packageJson, perfectionist, prettier, stylistic, unocss, vue };