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