@curev/eslint-config 0.2.2 → 0.3.1

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,2153 @@
1
+ import {
2
+ init_esm_shims
3
+ } from "./chunk-TMQW6NVO.js";
4
+
5
+ // src/index.ts
6
+ init_esm_shims();
7
+
8
+ // src/factory.ts
9
+ init_esm_shims();
10
+ import process3 from "process";
11
+ import fs from "fs";
12
+ import { isPackageExists as isPackageExists3 } from "local-pkg";
13
+
14
+ // src/configs/index.ts
15
+ init_esm_shims();
16
+
17
+ // src/configs/comments.ts
18
+ init_esm_shims();
19
+
20
+ // src/plugins.ts
21
+ init_esm_shims();
22
+ import { default as default2 } from "eslint-plugin-antfu";
23
+ import { default as default3 } from "eslint-plugin-eslint-comments";
24
+ import * as pluginImport from "eslint-plugin-i";
25
+ import { default as default4 } from "eslint-plugin-n";
26
+ import { default as default5 } from "eslint-plugin-unicorn";
27
+ import { default as default6 } from "eslint-plugin-unused-imports";
28
+ import { default as default7 } from "eslint-plugin-perfectionist";
29
+
30
+ // src/configs/comments.ts
31
+ async function comments() {
32
+ return [
33
+ {
34
+ name: "curev:eslint-comments",
35
+ plugins: {
36
+ "eslint-comments": default3
37
+ },
38
+ rules: {
39
+ "eslint-comments/no-aggregating-enable": "error",
40
+ "eslint-comments/no-duplicate-disable": "error",
41
+ "eslint-comments/no-unlimited-disable": "error",
42
+ "eslint-comments/no-unused-enable": "error"
43
+ }
44
+ }
45
+ ];
46
+ }
47
+
48
+ // src/configs/ignores.ts
49
+ init_esm_shims();
50
+
51
+ // src/globs.ts
52
+ init_esm_shims();
53
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
54
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
55
+ var GLOB_JS = "**/*.?([cm])js";
56
+ var GLOB_JSX = "**/*.?([cm])jsx";
57
+ var GLOB_TS = "**/*.?([cm])ts";
58
+ var GLOB_TSX = "**/*.?([cm])tsx";
59
+ var GLOB_STYLE = "**/*.{c,le,sc}ss";
60
+ var GLOB_CSS = "**/*.css";
61
+ var GLOB_POSTCSS = "**/*.{p,post}css";
62
+ var GLOB_LESS = "**/*.less";
63
+ var GLOB_SCSS = "**/*.scss";
64
+ var GLOB_JSON = "**/*.json";
65
+ var GLOB_JSON5 = "**/*.json5";
66
+ var GLOB_JSONC = "**/*.jsonc";
67
+ var GLOB_MARKDOWN = "**/*.md";
68
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
69
+ var GLOB_SVELTE = "**/*.svelte";
70
+ var GLOB_VUE = "**/*.vue";
71
+ var GLOB_YAML = "**/*.y?(a)ml";
72
+ var GLOB_TOML = "**/*.toml";
73
+ var GLOB_HTML = "**/*.htm?(l)";
74
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
75
+ var GLOB_TESTS = [
76
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
77
+ `**/*.spec.${GLOB_SRC_EXT}`,
78
+ `**/*.test.${GLOB_SRC_EXT}`,
79
+ `**/*.bench.${GLOB_SRC_EXT}`,
80
+ `**/*.benchmark.${GLOB_SRC_EXT}`
81
+ ];
82
+ var GLOB_ALL_SRC = [
83
+ GLOB_SRC,
84
+ GLOB_STYLE,
85
+ GLOB_JSON,
86
+ GLOB_JSON5,
87
+ GLOB_MARKDOWN,
88
+ GLOB_SVELTE,
89
+ GLOB_VUE,
90
+ GLOB_YAML,
91
+ GLOB_HTML
92
+ ];
93
+ var GLOB_EXCLUDE = [
94
+ "**/node_modules",
95
+ "**/dist",
96
+ "**/package-lock.json",
97
+ "**/yarn.lock",
98
+ "**/pnpm-lock.yaml",
99
+ "**/bun.lockb",
100
+ "**/output",
101
+ "**/coverage",
102
+ "**/temp",
103
+ "**/.temp",
104
+ "**/tmp",
105
+ "**/.tmp",
106
+ "**/.history",
107
+ "**/.vitepress/cache",
108
+ "**/.nuxt",
109
+ "**/.next",
110
+ "**/.vercel",
111
+ "**/.changeset",
112
+ "**/.idea",
113
+ "**/.cache",
114
+ "**/.output",
115
+ "**/.vite-inspect",
116
+ "**/CHANGELOG*.md",
117
+ "**/*.min.*",
118
+ "**/LICENSE*",
119
+ "**/__snapshots__",
120
+ "**/auto-import?(s).d.ts",
121
+ "**/components.d.ts"
122
+ ];
123
+
124
+ // src/configs/ignores.ts
125
+ async function ignores() {
126
+ return [
127
+ {
128
+ ignores: GLOB_EXCLUDE
129
+ }
130
+ ];
131
+ }
132
+
133
+ // src/configs/imports.ts
134
+ init_esm_shims();
135
+ async function imports(options = {}) {
136
+ const {
137
+ stylistic: stylistic2 = true
138
+ } = options;
139
+ return [
140
+ {
141
+ name: "curev:imports",
142
+ plugins: {
143
+ curev: default2,
144
+ import: pluginImport
145
+ },
146
+ rules: {
147
+ "antfu/import-dedupe": "error",
148
+ "antfu/no-import-dist": "error",
149
+ "antfu/no-import-node-modules-by-path": "error",
150
+ "import/first": "error",
151
+ "import/no-duplicates": "error",
152
+ "import/no-mutable-exports": "error",
153
+ "import/no-named-default": "error",
154
+ "import/no-self-import": "error",
155
+ "import/no-webpack-loader-syntax": "error",
156
+ "import/order": "error",
157
+ ...stylistic2 ? {
158
+ "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
159
+ } : {}
160
+ }
161
+ },
162
+ {
163
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
164
+ name: "curev:imports:bin",
165
+ rules: {
166
+ "antfu/no-import-dist": "off",
167
+ "antfu/no-import-node-modules-by-path": "off"
168
+ }
169
+ }
170
+ ];
171
+ }
172
+
173
+ // src/configs/javascript.ts
174
+ init_esm_shims();
175
+ import globals from "globals";
176
+ async function javascript(options = {}) {
177
+ const {
178
+ isInEditor = false,
179
+ overrides = {}
180
+ } = options;
181
+ return [
182
+ {
183
+ languageOptions: {
184
+ ecmaVersion: 2022,
185
+ globals: {
186
+ ...globals.browser,
187
+ ...globals.es2021,
188
+ ...globals.node,
189
+ document: "readonly",
190
+ navigator: "readonly",
191
+ window: "readonly"
192
+ },
193
+ parserOptions: {
194
+ ecmaFeatures: {
195
+ jsx: true
196
+ },
197
+ ecmaVersion: 2022,
198
+ sourceType: "module"
199
+ },
200
+ sourceType: "module"
201
+ },
202
+ linterOptions: {
203
+ reportUnusedDisableDirectives: true
204
+ },
205
+ name: "curev:javascript",
206
+ plugins: {
207
+ "antfu": default2,
208
+ "unused-imports": default6
209
+ },
210
+ rules: {
211
+ "no-var": "warn",
212
+ "object-shorthand": ["warn", "properties"],
213
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
214
+ "array-callback-return": ["error", {
215
+ allowImplicit: false,
216
+ checkForEach: false
217
+ }],
218
+ "camelcase": ["error", {
219
+ allow: ["^UNSAFE_"],
220
+ properties: "never",
221
+ ignoreGlobals: true,
222
+ ignoreImports: true
223
+ }],
224
+ "constructor-super": "error",
225
+ "default-case-last": "error",
226
+ "eol-last": "error",
227
+ "eqeqeq": ["error", "always", { null: "ignore" }],
228
+ "func-call-spacing": ["error", "never"],
229
+ "generator-star-spacing": ["error", { before: true, after: true }],
230
+ "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
231
+ "multiline-ternary": ["error", "always-multiline"],
232
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
233
+ "new-parens": "error",
234
+ "no-array-constructor": "error",
235
+ "no-async-promise-executor": "error",
236
+ "no-caller": "error",
237
+ "no-case-declarations": "error",
238
+ "no-class-assign": "error",
239
+ "no-compare-neg-zero": "error",
240
+ "no-cond-assign": "error",
241
+ "no-const-assign": "error",
242
+ "no-constant-condition": ["error", { checkLoops: false }],
243
+ "no-control-regex": "error",
244
+ "no-debugger": "error",
245
+ "no-delete-var": "error",
246
+ "no-dupe-args": "error",
247
+ "no-dupe-class-members": "error",
248
+ "no-dupe-keys": "error",
249
+ "no-duplicate-case": "error",
250
+ "no-useless-backreference": "error",
251
+ "no-empty": ["error", { allowEmptyCatch: true }],
252
+ "no-empty-character-class": "error",
253
+ "no-empty-pattern": "error",
254
+ "no-eval": "error",
255
+ "no-ex-assign": "error",
256
+ "no-extend-native": "error",
257
+ "no-extra-bind": "error",
258
+ "no-extra-boolean-cast": "error",
259
+ "no-extra-parens": ["error", "functions"],
260
+ "no-fallthrough": "error",
261
+ "no-floating-decimal": "error",
262
+ "no-func-assign": "error",
263
+ "no-global-assign": "error",
264
+ "no-implied-eval": "error",
265
+ "no-import-assign": "error",
266
+ "no-invalid-regexp": "error",
267
+ "no-irregular-whitespace": "error",
268
+ "no-iterator": "error",
269
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
270
+ "no-lone-blocks": "error",
271
+ "no-loss-of-precision": "error",
272
+ "no-misleading-character-class": "error",
273
+ "no-prototype-builtins": "error",
274
+ "no-useless-catch": "error",
275
+ "no-mixed-operators": ["error", {
276
+ groups: [
277
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
278
+ ["&&", "||"],
279
+ ["in", "instanceof"]
280
+ ],
281
+ allowSamePrecedence: true
282
+ }],
283
+ "no-mixed-spaces-and-tabs": "error",
284
+ "no-multi-spaces": "error",
285
+ "no-multi-str": "error",
286
+ "no-new": "error",
287
+ "no-new-func": "error",
288
+ "no-new-object": "error",
289
+ "no-new-symbol": "error",
290
+ "no-new-wrappers": "error",
291
+ "no-obj-calls": "error",
292
+ "no-octal": "error",
293
+ "no-octal-escape": "error",
294
+ "no-proto": "error",
295
+ "no-redeclare": ["error", { builtinGlobals: false }],
296
+ "no-regex-spaces": "error",
297
+ "no-return-assign": ["error", "except-parens"],
298
+ "no-self-assign": ["error", { props: true }],
299
+ "no-self-compare": "error",
300
+ "no-sequences": "error",
301
+ "no-shadow-restricted-names": "error",
302
+ "no-sparse-arrays": "error",
303
+ "no-tabs": "error",
304
+ "no-template-curly-in-string": "error",
305
+ "no-this-before-super": "error",
306
+ "no-throw-literal": "error",
307
+ "no-trailing-spaces": [
308
+ "error",
309
+ {
310
+ skipBlankLines: true
311
+ }
312
+ ],
313
+ "no-multiple-empty-lines": [
314
+ "error",
315
+ {
316
+ max: 3,
317
+ maxBOF: 0,
318
+ maxEOF: 1
319
+ }
320
+ ],
321
+ "no-undef": "error",
322
+ "no-undef-init": "error",
323
+ "no-unexpected-multiline": "error",
324
+ "no-unmodified-loop-condition": "error",
325
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
326
+ "no-unreachable": "error",
327
+ "no-unreachable-loop": "error",
328
+ "no-unsafe-finally": "error",
329
+ "no-unsafe-negation": "error",
330
+ "no-unused-expressions": ["error", {
331
+ allowShortCircuit: true,
332
+ allowTernary: true,
333
+ allowTaggedTemplates: true
334
+ }],
335
+ "no-unused-vars": ["error", {
336
+ args: "none",
337
+ caughtErrors: "none",
338
+ ignoreRestSiblings: true,
339
+ vars: "all"
340
+ }],
341
+ "no-use-before-define": ["error", { functions: false, classes: false, variables: false }],
342
+ "no-useless-call": "error",
343
+ "no-useless-computed-key": "error",
344
+ "no-useless-constructor": "error",
345
+ "no-useless-escape": "error",
346
+ "no-useless-rename": "error",
347
+ "no-useless-return": "error",
348
+ "no-void": "error",
349
+ "no-with": "error",
350
+ "object-curly-newline": ["error", { multiline: true, consistent: true }],
351
+ "object-curly-spacing": ["error", "always"],
352
+ "object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
353
+ "one-var": ["error", { initialized: "never" }],
354
+ "padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
355
+ "prefer-const": ["error", { destructuring: "all" }],
356
+ "prefer-promise-reject-errors": "error",
357
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
358
+ "rest-spread-spacing": ["error", "never"],
359
+ "symbol-description": "error",
360
+ "template-curly-spacing": ["error", "never"],
361
+ "template-tag-spacing": ["error", "never"],
362
+ "unicode-bom": ["error", "never"],
363
+ "use-isnan": ["error", {
364
+ enforceForSwitchCase: true,
365
+ enforceForIndexOf: true
366
+ }],
367
+ "valid-typeof": ["error", { requireStringLiterals: true }],
368
+ "wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
369
+ "yield-star-spacing": ["error", "both"],
370
+ "yoda": ["error", "never"],
371
+ "import/export": "error",
372
+ "import/first": "error",
373
+ "import/no-absolute-path": ["error", { esmodule: true, commonjs: true, amd: false }],
374
+ "import/no-duplicates": "error",
375
+ "import/no-named-default": "error",
376
+ "import/no-webpack-loader-syntax": "error",
377
+ "block-scoped-var": "error",
378
+ "no-alert": "error",
379
+ "no-console": ["error", { allow: ["warn", "error"] }],
380
+ "no-restricted-globals": [
381
+ "error",
382
+ { message: "Use `globalThis` instead.", name: "global" },
383
+ { message: "Use `globalThis` instead.", name: "self" }
384
+ ],
385
+ "no-restricted-properties": [
386
+ "error",
387
+ { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
388
+ { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
389
+ { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
390
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
391
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
392
+ ],
393
+ "no-restricted-syntax": [
394
+ "error",
395
+ "DebuggerStatement",
396
+ "LabeledStatement",
397
+ "WithStatement",
398
+ "TSEnumDeclaration[const=true]",
399
+ "TSExportAssignment"
400
+ ],
401
+ "prefer-arrow-callback": [
402
+ "error",
403
+ {
404
+ allowNamedFunctions: false,
405
+ allowUnboundThis: true
406
+ }
407
+ ],
408
+ "prefer-exponentiation-operator": "error",
409
+ "prefer-rest-params": "error",
410
+ "prefer-spread": "error",
411
+ "prefer-template": "error",
412
+ "sort-imports": [
413
+ "error",
414
+ {
415
+ allowSeparatedGroups: false,
416
+ ignoreCase: false,
417
+ ignoreDeclarationSort: true,
418
+ ignoreMemberSort: false,
419
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
420
+ }
421
+ ],
422
+ "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
423
+ "unused-imports/no-unused-vars": [
424
+ "error",
425
+ { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
426
+ ],
427
+ "vars-on-top": "error",
428
+ ...overrides
429
+ }
430
+ },
431
+ {
432
+ files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
433
+ name: "curev:scripts-overrides",
434
+ rules: {
435
+ "no-console": "off"
436
+ }
437
+ }
438
+ ];
439
+ }
440
+
441
+ // src/configs/jsdoc.ts
442
+ init_esm_shims();
443
+
444
+ // src/utils.ts
445
+ init_esm_shims();
446
+ import process from "process";
447
+ import { isPackageExists } from "local-pkg";
448
+ var parserPlain = {
449
+ meta: {
450
+ name: "parser-plain"
451
+ },
452
+ parseForESLint: (code) => ({
453
+ ast: {
454
+ body: [],
455
+ comments: [],
456
+ loc: { end: code.length, start: 0 },
457
+ range: [0, code.length],
458
+ tokens: [],
459
+ type: "Program"
460
+ },
461
+ scopeManager: null,
462
+ services: { isPlain: true },
463
+ visitorKeys: {
464
+ Program: []
465
+ }
466
+ })
467
+ };
468
+ async function combine(...configs) {
469
+ const resolved = await Promise.all(configs);
470
+ return resolved.flat();
471
+ }
472
+ function renameRules(rules, from, to) {
473
+ return Object.fromEntries(
474
+ Object.entries(rules).map(([key, value]) => {
475
+ if (key.startsWith(from)) {
476
+ return [to + key.slice(from.length), value];
477
+ }
478
+ return [key, value];
479
+ })
480
+ );
481
+ }
482
+ function toArray(value) {
483
+ return Array.isArray(value) ? value : [value];
484
+ }
485
+ async function interopDefault(m) {
486
+ const resolved = await m;
487
+ return resolved.default || resolved;
488
+ }
489
+ async function ensurePackages(packages) {
490
+ if (process.env.CI || process.stdout.isTTY === false) {
491
+ return;
492
+ }
493
+ const nonExistingPackages = packages.filter((i) => !isPackageExists(i));
494
+ if (nonExistingPackages.length === 0) {
495
+ return;
496
+ }
497
+ const { default: prompts } = await import("prompts");
498
+ const { result } = await prompts([
499
+ {
500
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
501
+ name: "result",
502
+ type: "confirm"
503
+ }
504
+ ]);
505
+ if (result) {
506
+ await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
507
+ }
508
+ }
509
+
510
+ // src/configs/jsdoc.ts
511
+ async function jsdoc(options = {}) {
512
+ const {
513
+ stylistic: stylistic2 = true
514
+ } = options;
515
+ return [
516
+ {
517
+ name: "curev:jsdoc",
518
+ plugins: {
519
+ jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
520
+ },
521
+ rules: {
522
+ "jsdoc/check-access": "warn",
523
+ "jsdoc/check-param-names": "warn",
524
+ "jsdoc/check-property-names": "warn",
525
+ "jsdoc/check-types": "warn",
526
+ "jsdoc/empty-tags": "warn",
527
+ "jsdoc/implements-on-classes": "warn",
528
+ "jsdoc/no-defaults": "warn",
529
+ "jsdoc/no-multi-asterisks": "warn",
530
+ "jsdoc/require-param-name": "warn",
531
+ "jsdoc/require-property": "warn",
532
+ "jsdoc/require-property-description": "warn",
533
+ "jsdoc/require-property-name": "warn",
534
+ "jsdoc/require-returns-check": "warn",
535
+ "jsdoc/require-returns-description": "warn",
536
+ "jsdoc/require-yields-check": "warn",
537
+ ...stylistic2 ? {
538
+ "jsdoc/check-alignment": "warn",
539
+ "jsdoc/multiline-blocks": "warn"
540
+ } : {}
541
+ }
542
+ }
543
+ ];
544
+ }
545
+
546
+ // src/configs/jsonc.ts
547
+ init_esm_shims();
548
+ async function jsonc(options = {}) {
549
+ const {
550
+ files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
551
+ overrides = {},
552
+ stylistic: stylistic2 = true
553
+ } = options;
554
+ const {
555
+ indent = 2
556
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
557
+ const [
558
+ pluginJsonc,
559
+ parserJsonc
560
+ ] = await Promise.all([
561
+ interopDefault(import("eslint-plugin-jsonc")),
562
+ interopDefault(import("jsonc-eslint-parser"))
563
+ ]);
564
+ return [
565
+ {
566
+ name: "curev:jsonc:setup",
567
+ plugins: {
568
+ jsonc: pluginJsonc
569
+ }
570
+ },
571
+ {
572
+ files,
573
+ languageOptions: {
574
+ parser: parserJsonc
575
+ },
576
+ name: "curev:jsonc:rules",
577
+ rules: {
578
+ "jsonc/no-bigint-literals": "error",
579
+ "jsonc/no-binary-expression": "error",
580
+ "jsonc/no-binary-numeric-literals": "error",
581
+ "jsonc/no-dupe-keys": "error",
582
+ "jsonc/no-escape-sequence-in-identifier": "error",
583
+ "jsonc/no-floating-decimal": "error",
584
+ "jsonc/no-hexadecimal-numeric-literals": "error",
585
+ "jsonc/no-infinity": "error",
586
+ "jsonc/no-multi-str": "error",
587
+ "jsonc/no-nan": "error",
588
+ "jsonc/no-number-props": "error",
589
+ "jsonc/no-numeric-separators": "error",
590
+ "jsonc/no-octal": "error",
591
+ "jsonc/no-octal-escape": "error",
592
+ "jsonc/no-octal-numeric-literals": "error",
593
+ "jsonc/no-parenthesized": "error",
594
+ "jsonc/no-plus-sign": "error",
595
+ "jsonc/no-regexp-literals": "error",
596
+ "jsonc/no-sparse-arrays": "error",
597
+ "jsonc/no-template-literals": "error",
598
+ "jsonc/no-undefined-value": "error",
599
+ "jsonc/no-unicode-codepoint-escapes": "error",
600
+ "jsonc/no-useless-escape": "error",
601
+ "jsonc/space-unary-ops": "error",
602
+ "jsonc/valid-json-number": "error",
603
+ "jsonc/vue-custom-block/no-parsing-error": "error",
604
+ ...stylistic2 ? {
605
+ "jsonc/array-bracket-spacing": ["error", "never"],
606
+ "jsonc/comma-dangle": ["error", "never"],
607
+ "jsonc/comma-style": ["error", "last"],
608
+ "jsonc/indent": ["error", indent],
609
+ "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
610
+ "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
611
+ "jsonc/object-curly-spacing": ["error", "always"],
612
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
613
+ "jsonc/quote-props": "error",
614
+ "jsonc/quotes": "error"
615
+ } : {},
616
+ ...overrides
617
+ }
618
+ }
619
+ ];
620
+ }
621
+
622
+ // src/configs/markdown.ts
623
+ init_esm_shims();
624
+ import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
625
+ async function markdown(options = {}) {
626
+ const {
627
+ componentExts = [],
628
+ files = [GLOB_MARKDOWN],
629
+ overrides = {}
630
+ } = options;
631
+ const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
632
+ return [
633
+ {
634
+ name: "curev:markdown:setup",
635
+ plugins: {
636
+ markdown: markdown2
637
+ }
638
+ },
639
+ {
640
+ files,
641
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
642
+ name: "curev:markdown:processor",
643
+ // `eslint-plugin-markdown` only creates virtual files for code blocks,
644
+ // but not the markdown file itself. We use `eslint-merge-processors` to
645
+ // add a pass-through processor for the markdown file itself.
646
+ processor: mergeProcessors([
647
+ markdown2.processors.markdown,
648
+ processorPassThrough
649
+ ])
650
+ },
651
+ {
652
+ files,
653
+ languageOptions: {
654
+ parser: parserPlain
655
+ },
656
+ name: "curev:markdown:parser"
657
+ },
658
+ {
659
+ files: [
660
+ GLOB_MARKDOWN_CODE,
661
+ ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
662
+ ],
663
+ languageOptions: {
664
+ parserOptions: {
665
+ ecmaFeatures: {
666
+ impliedStrict: true
667
+ }
668
+ }
669
+ },
670
+ name: "curev:markdown:disables",
671
+ rules: {
672
+ "import/newline-after-import": "off",
673
+ "no-alert": "off",
674
+ "no-console": "off",
675
+ "no-labels": "off",
676
+ "no-lone-blocks": "off",
677
+ "no-restricted-syntax": "off",
678
+ "no-undef": "off",
679
+ "no-unused-expressions": "off",
680
+ "no-unused-labels": "off",
681
+ "no-unused-vars": "off",
682
+ "node/prefer-global/process": "off",
683
+ "style/comma-dangle": "off",
684
+ "style/eol-last": "off",
685
+ "ts/consistent-type-imports": "off",
686
+ "ts/no-namespace": "off",
687
+ "ts/no-redeclare": "off",
688
+ "ts/no-require-imports": "off",
689
+ "ts/no-unused-vars": "off",
690
+ "ts/no-use-before-define": "off",
691
+ "ts/no-var-requires": "off",
692
+ "unicode-bom": "off",
693
+ "unused-imports/no-unused-imports": "off",
694
+ "unused-imports/no-unused-vars": "off",
695
+ // Type aware rules
696
+ ...{
697
+ "ts/await-thenable": "off",
698
+ "ts/dot-notation": "off",
699
+ "ts/no-floating-promises": "off",
700
+ "ts/no-for-in-array": "off",
701
+ "ts/no-implied-eval": "off",
702
+ "ts/no-misused-promises": "off",
703
+ "ts/no-throw-literal": "off",
704
+ "ts/no-unnecessary-type-assertion": "off",
705
+ "ts/no-unsafe-argument": "off",
706
+ "ts/no-unsafe-assignment": "off",
707
+ "ts/no-unsafe-call": "off",
708
+ "ts/no-unsafe-member-access": "off",
709
+ "ts/no-unsafe-return": "off",
710
+ "ts/restrict-plus-operands": "off",
711
+ "ts/restrict-template-expressions": "off",
712
+ "ts/unbound-method": "off"
713
+ },
714
+ ...overrides
715
+ }
716
+ }
717
+ ];
718
+ }
719
+
720
+ // src/configs/node.ts
721
+ init_esm_shims();
722
+ async function node() {
723
+ return [
724
+ {
725
+ name: "curev:node",
726
+ plugins: {
727
+ node: default4
728
+ },
729
+ rules: {
730
+ "node/handle-callback-err": ["error", "^(err|error)$"],
731
+ "node/no-deprecated-api": "error",
732
+ "node/no-exports-assign": "error",
733
+ "node/no-new-require": "error",
734
+ "node/no-path-concat": "error",
735
+ "node/prefer-global/buffer": ["error", "never"],
736
+ "node/prefer-global/process": ["error", "never"],
737
+ "node/process-exit-as-throw": "error",
738
+ "node/no-callback-literal": "error"
739
+ }
740
+ }
741
+ ];
742
+ }
743
+
744
+ // src/configs/perfectionist.ts
745
+ init_esm_shims();
746
+ async function perfectionist() {
747
+ return [
748
+ {
749
+ name: "curev:perfectionist",
750
+ plugins: {
751
+ perfectionist: default7
752
+ }
753
+ }
754
+ ];
755
+ }
756
+
757
+ // src/configs/formatters.ts
758
+ init_esm_shims();
759
+
760
+ // src/configs/stylistic.ts
761
+ init_esm_shims();
762
+ var StylisticConfigDefaults = {
763
+ indent: 2,
764
+ jsx: true,
765
+ quotes: "double",
766
+ semi: true,
767
+ braceStyle: "1tbs",
768
+ commaDangle: "never"
769
+ };
770
+ async function stylistic(options = {}) {
771
+ const mergeOptions = {
772
+ ...StylisticConfigDefaults,
773
+ ...options
774
+ };
775
+ const { overrides = {} } = mergeOptions;
776
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
777
+ const config = pluginStylistic.configs.customize({
778
+ flat: true,
779
+ pluginName: "style",
780
+ ...mergeOptions
781
+ });
782
+ return [
783
+ {
784
+ name: "curev:stylistic",
785
+ plugins: {
786
+ curev: default2,
787
+ style: pluginStylistic
788
+ },
789
+ rules: {
790
+ ...config.rules,
791
+ "antfu/consistent-list-newline": "error",
792
+ "antfu/if-newline": "error",
793
+ "antfu/top-level-function": "error",
794
+ "semi-spacing": ["error", { before: false, after: true }],
795
+ "style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
796
+ "curly": ["error", "all"],
797
+ ...overrides
798
+ }
799
+ }
800
+ ];
801
+ }
802
+
803
+ // src/configs/formatters.ts
804
+ async function formatters(options = {}, stylistic2 = {}) {
805
+ await ensurePackages([
806
+ "eslint-plugin-format"
807
+ ]);
808
+ if (options === true) {
809
+ options = {
810
+ css: true,
811
+ graphql: true,
812
+ html: true,
813
+ markdown: true
814
+ };
815
+ }
816
+ const {
817
+ indent,
818
+ quotes,
819
+ semi
820
+ } = {
821
+ ...StylisticConfigDefaults,
822
+ ...stylistic2
823
+ };
824
+ const prettierOptions = Object.assign(
825
+ {
826
+ endOfLine: "auto",
827
+ semi,
828
+ singleQuote: quotes === "single",
829
+ tabWidth: typeof indent === "number" ? indent : 2,
830
+ trailingComma: "all",
831
+ useTabs: indent === "tab"
832
+ },
833
+ options.prettierOptions || {}
834
+ );
835
+ const dprintOptions = Object.assign(
836
+ {
837
+ indentWidth: typeof indent === "number" ? indent : 2,
838
+ quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
839
+ useTabs: indent === "tab"
840
+ },
841
+ options.dprintOptions || {}
842
+ );
843
+ const pluginFormat = await interopDefault(import("eslint-plugin-format"));
844
+ const configs = [
845
+ {
846
+ name: "curev:formatters:setup",
847
+ plugins: {
848
+ format: pluginFormat
849
+ }
850
+ }
851
+ ];
852
+ if (options.css) {
853
+ configs.push(
854
+ {
855
+ files: [GLOB_CSS, GLOB_POSTCSS],
856
+ languageOptions: {
857
+ parser: parserPlain
858
+ },
859
+ name: "curev:formatter:css",
860
+ rules: {
861
+ "format/prettier": [
862
+ "error",
863
+ {
864
+ ...prettierOptions,
865
+ parser: "css"
866
+ }
867
+ ]
868
+ }
869
+ },
870
+ {
871
+ files: [GLOB_SCSS],
872
+ languageOptions: {
873
+ parser: parserPlain
874
+ },
875
+ name: "curev:formatter:scss",
876
+ rules: {
877
+ "format/prettier": [
878
+ "error",
879
+ {
880
+ ...prettierOptions,
881
+ parser: "scss"
882
+ }
883
+ ]
884
+ }
885
+ },
886
+ {
887
+ files: [GLOB_LESS],
888
+ languageOptions: {
889
+ parser: parserPlain
890
+ },
891
+ name: "curev:formatter:less",
892
+ rules: {
893
+ "format/prettier": [
894
+ "error",
895
+ {
896
+ ...prettierOptions,
897
+ parser: "less"
898
+ }
899
+ ]
900
+ }
901
+ }
902
+ );
903
+ }
904
+ if (options.html) {
905
+ configs.push({
906
+ files: ["**/*.html"],
907
+ languageOptions: {
908
+ parser: parserPlain
909
+ },
910
+ name: "curev:formatter:html",
911
+ rules: {
912
+ "format/prettier": [
913
+ "error",
914
+ {
915
+ ...prettierOptions,
916
+ parser: "html"
917
+ }
918
+ ]
919
+ }
920
+ });
921
+ }
922
+ if (options.markdown) {
923
+ const formater = options.markdown === true ? "prettier" : options.markdown;
924
+ configs.push({
925
+ files: [GLOB_MARKDOWN],
926
+ languageOptions: {
927
+ parser: parserPlain
928
+ },
929
+ name: "curev:formatter:markdown",
930
+ rules: {
931
+ [`format/${formater}`]: [
932
+ "error",
933
+ formater === "prettier" ? {
934
+ printWidth: 120,
935
+ ...prettierOptions,
936
+ embeddedLanguageFormatting: "off",
937
+ parser: "markdown"
938
+ } : {
939
+ ...dprintOptions,
940
+ language: "markdown"
941
+ }
942
+ ]
943
+ }
944
+ });
945
+ }
946
+ if (options.graphql) {
947
+ configs.push({
948
+ files: ["**/*.graphql"],
949
+ languageOptions: {
950
+ parser: parserPlain
951
+ },
952
+ name: "curev:formatter:graphql",
953
+ rules: {
954
+ "format/prettier": [
955
+ "error",
956
+ {
957
+ ...prettierOptions,
958
+ parser: "graphql"
959
+ }
960
+ ]
961
+ }
962
+ });
963
+ }
964
+ return configs;
965
+ }
966
+
967
+ // src/configs/react.ts
968
+ init_esm_shims();
969
+ import { isPackageExists as isPackageExists2 } from "local-pkg";
970
+ var ReactRefreshAllowConstantExportPackages = [
971
+ "vite"
972
+ ];
973
+ async function react(options = {}) {
974
+ const {
975
+ files = [GLOB_JSX, GLOB_TSX],
976
+ overrides = {},
977
+ typescript: typescript2 = true
978
+ } = options;
979
+ await ensurePackages([
980
+ "eslint-plugin-react",
981
+ "eslint-plugin-react-hooks",
982
+ "eslint-plugin-react-refresh"
983
+ ]);
984
+ const [
985
+ pluginReact,
986
+ pluginReactHooks,
987
+ pluginReactRefresh
988
+ ] = await Promise.all([
989
+ interopDefault(import("eslint-plugin-react")),
990
+ interopDefault(import("eslint-plugin-react-hooks")),
991
+ interopDefault(import("eslint-plugin-react-refresh"))
992
+ ]);
993
+ const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
994
+ (i) => isPackageExists2(i)
995
+ );
996
+ return [
997
+ {
998
+ name: "curev:react:setup",
999
+ plugins: {
1000
+ "react": pluginReact,
1001
+ "react-hooks": pluginReactHooks,
1002
+ "react-refresh": pluginReactRefresh
1003
+ },
1004
+ settings: {
1005
+ react: {
1006
+ version: "detect"
1007
+ }
1008
+ }
1009
+ },
1010
+ {
1011
+ files,
1012
+ languageOptions: {
1013
+ parserOptions: {
1014
+ ecmaFeatures: {
1015
+ jsx: true
1016
+ }
1017
+ }
1018
+ },
1019
+ name: "curev:react:rules",
1020
+ rules: {
1021
+ // recommended rules react-hooks
1022
+ "react-hooks/exhaustive-deps": "warn",
1023
+ "react-hooks/rules-of-hooks": "error",
1024
+ // react refresh
1025
+ "react-refresh/only-export-components": [
1026
+ "warn",
1027
+ { allowConstantExport: isAllowConstantExport }
1028
+ ],
1029
+ // recommended rules react
1030
+ "react/display-name": "error",
1031
+ "react/jsx-key": "error",
1032
+ "react/jsx-no-comment-textnodes": "error",
1033
+ "react/jsx-no-duplicate-props": "error",
1034
+ "react/jsx-no-target-blank": "error",
1035
+ "react/jsx-no-undef": "error",
1036
+ "react/jsx-uses-react": "error",
1037
+ "react/jsx-uses-vars": "error",
1038
+ "react/no-children-prop": "error",
1039
+ "react/no-danger-with-children": "error",
1040
+ "react/no-deprecated": "error",
1041
+ "react/no-direct-mutation-state": "error",
1042
+ "react/no-find-dom-node": "error",
1043
+ "react/no-is-mounted": "error",
1044
+ "react/no-render-return-value": "error",
1045
+ "react/no-string-refs": "error",
1046
+ "react/no-unescaped-entities": "error",
1047
+ "react/no-unknown-property": "error",
1048
+ "react/no-unsafe": "off",
1049
+ "react/prop-types": "error",
1050
+ "react/react-in-jsx-scope": "off",
1051
+ "react/require-render-return": "error",
1052
+ ...typescript2 ? {
1053
+ "react/jsx-no-undef": "off",
1054
+ "react/prop-type": "off"
1055
+ } : {},
1056
+ // overrides
1057
+ ...overrides
1058
+ }
1059
+ }
1060
+ ];
1061
+ }
1062
+
1063
+ // src/configs/sort.ts
1064
+ init_esm_shims();
1065
+ async function sortPackageJson() {
1066
+ return [
1067
+ {
1068
+ files: ["**/package.json"],
1069
+ name: "curev:sort-package-json",
1070
+ rules: {
1071
+ "jsonc/sort-array-values": [
1072
+ "error",
1073
+ {
1074
+ order: { type: "asc" },
1075
+ pathPattern: "^files$"
1076
+ }
1077
+ ],
1078
+ "jsonc/sort-keys": [
1079
+ "error",
1080
+ {
1081
+ order: [
1082
+ "publisher",
1083
+ "name",
1084
+ "displayName",
1085
+ "type",
1086
+ "version",
1087
+ "private",
1088
+ "packageManager",
1089
+ "description",
1090
+ "author",
1091
+ "license",
1092
+ "funding",
1093
+ "homepage",
1094
+ "repository",
1095
+ "bugs",
1096
+ "keywords",
1097
+ "categories",
1098
+ "sideEffects",
1099
+ "exports",
1100
+ "main",
1101
+ "module",
1102
+ "unpkg",
1103
+ "jsdelivr",
1104
+ "types",
1105
+ "typesVersions",
1106
+ "bin",
1107
+ "icon",
1108
+ "files",
1109
+ "engines",
1110
+ "activationEvents",
1111
+ "contributes",
1112
+ "scripts",
1113
+ "peerDependencies",
1114
+ "peerDependenciesMeta",
1115
+ "dependencies",
1116
+ "optionalDependencies",
1117
+ "devDependencies",
1118
+ "pnpm",
1119
+ "overrides",
1120
+ "resolutions",
1121
+ "husky",
1122
+ "simple-git-hooks",
1123
+ "lint-staged",
1124
+ "eslintConfig"
1125
+ ],
1126
+ pathPattern: "^$"
1127
+ },
1128
+ {
1129
+ order: { type: "asc" },
1130
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
1131
+ },
1132
+ {
1133
+ order: { type: "asc" },
1134
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1135
+ },
1136
+ {
1137
+ order: [
1138
+ "types",
1139
+ "import",
1140
+ "require",
1141
+ "default"
1142
+ ],
1143
+ pathPattern: "^exports.*$"
1144
+ }
1145
+ ]
1146
+ }
1147
+ }
1148
+ ];
1149
+ }
1150
+ function sortTsconfig() {
1151
+ return [
1152
+ {
1153
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1154
+ name: "curev:sort-tsconfig",
1155
+ rules: {
1156
+ "jsonc/sort-keys": [
1157
+ "error",
1158
+ {
1159
+ order: [
1160
+ "extends",
1161
+ "compilerOptions",
1162
+ "references",
1163
+ "files",
1164
+ "include",
1165
+ "exclude"
1166
+ ],
1167
+ pathPattern: "^$"
1168
+ },
1169
+ {
1170
+ order: [
1171
+ /* Projects */
1172
+ "incremental",
1173
+ "composite",
1174
+ "tsBuildInfoFile",
1175
+ "disableSourceOfProjectReferenceRedirect",
1176
+ "disableSolutionSearching",
1177
+ "disableReferencedProjectLoad",
1178
+ /* Language and Environment */
1179
+ "target",
1180
+ "jsx",
1181
+ "jsxFactory",
1182
+ "jsxFragmentFactory",
1183
+ "jsxImportSource",
1184
+ "lib",
1185
+ "moduleDetection",
1186
+ "noLib",
1187
+ "reactNamespace",
1188
+ "useDefineForClassFields",
1189
+ "emitDecoratorMetadata",
1190
+ "experimentalDecorators",
1191
+ /* Modules */
1192
+ "baseUrl",
1193
+ "rootDir",
1194
+ "rootDirs",
1195
+ "customConditions",
1196
+ "module",
1197
+ "moduleResolution",
1198
+ "moduleSuffixes",
1199
+ "noResolve",
1200
+ "paths",
1201
+ "resolveJsonModule",
1202
+ "resolvePackageJsonExports",
1203
+ "resolvePackageJsonImports",
1204
+ "typeRoots",
1205
+ "types",
1206
+ "allowArbitraryExtensions",
1207
+ "allowImportingTsExtensions",
1208
+ "allowUmdGlobalAccess",
1209
+ /* JavaScript Support */
1210
+ "allowJs",
1211
+ "checkJs",
1212
+ "maxNodeModuleJsDepth",
1213
+ /* Type Checking */
1214
+ "strict",
1215
+ "strictBindCallApply",
1216
+ "strictFunctionTypes",
1217
+ "strictNullChecks",
1218
+ "strictPropertyInitialization",
1219
+ "allowUnreachableCode",
1220
+ "allowUnusedLabels",
1221
+ "alwaysStrict",
1222
+ "exactOptionalPropertyTypes",
1223
+ "noFallthroughCasesInSwitch",
1224
+ "noImplicitAny",
1225
+ "noImplicitOverride",
1226
+ "noImplicitReturns",
1227
+ "noImplicitThis",
1228
+ "noPropertyAccessFromIndexSignature",
1229
+ "noUncheckedIndexedAccess",
1230
+ "noUnusedLocals",
1231
+ "noUnusedParameters",
1232
+ "useUnknownInCatchVariables",
1233
+ /* Emit */
1234
+ "declaration",
1235
+ "declarationDir",
1236
+ "declarationMap",
1237
+ "downlevelIteration",
1238
+ "emitBOM",
1239
+ "emitDeclarationOnly",
1240
+ "importHelpers",
1241
+ "importsNotUsedAsValues",
1242
+ "inlineSourceMap",
1243
+ "inlineSources",
1244
+ "mapRoot",
1245
+ "newLine",
1246
+ "noEmit",
1247
+ "noEmitHelpers",
1248
+ "noEmitOnError",
1249
+ "outDir",
1250
+ "outFile",
1251
+ "preserveConstEnums",
1252
+ "preserveValueImports",
1253
+ "removeComments",
1254
+ "sourceMap",
1255
+ "sourceRoot",
1256
+ "stripInternal",
1257
+ /* Interop Constraints */
1258
+ "allowSyntheticDefaultImports",
1259
+ "esModuleInterop",
1260
+ "forceConsistentCasingInFileNames",
1261
+ "isolatedModules",
1262
+ "preserveSymlinks",
1263
+ "verbatimModuleSyntax",
1264
+ /* Completeness */
1265
+ "skipDefaultLibCheck",
1266
+ "skipLibCheck"
1267
+ ],
1268
+ pathPattern: "^compilerOptions$"
1269
+ }
1270
+ ]
1271
+ }
1272
+ }
1273
+ ];
1274
+ }
1275
+
1276
+ // src/configs/svelte.ts
1277
+ init_esm_shims();
1278
+ async function svelte(options = {}) {
1279
+ const {
1280
+ files = [GLOB_SVELTE],
1281
+ overrides = {},
1282
+ stylistic: stylistic2 = true
1283
+ } = options;
1284
+ const {
1285
+ indent = 2,
1286
+ quotes = "single"
1287
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1288
+ await ensurePackages([
1289
+ "eslint-plugin-svelte"
1290
+ ]);
1291
+ const [
1292
+ pluginSvelte,
1293
+ parserSvelte
1294
+ ] = await Promise.all([
1295
+ interopDefault(import("eslint-plugin-svelte")),
1296
+ interopDefault(import("svelte-eslint-parser"))
1297
+ ]);
1298
+ return [
1299
+ {
1300
+ name: "curev:svelte:setup",
1301
+ plugins: {
1302
+ svelte: pluginSvelte
1303
+ }
1304
+ },
1305
+ {
1306
+ files,
1307
+ languageOptions: {
1308
+ parser: parserSvelte,
1309
+ parserOptions: {
1310
+ extraFileExtensions: [".svelte"],
1311
+ parser: options.typescript ? await interopDefault(import("./dist-QAUNCL3U.js")) : null
1312
+ }
1313
+ },
1314
+ name: "curev:svelte:rules",
1315
+ processor: pluginSvelte.processors[".svelte"],
1316
+ rules: {
1317
+ "import/no-mutable-exports": "off",
1318
+ "no-undef": "off",
1319
+ // incompatible with most recent (attribute-form) generic types RFC
1320
+ "no-unused-vars": ["error", {
1321
+ args: "none",
1322
+ caughtErrors: "none",
1323
+ ignoreRestSiblings: true,
1324
+ vars: "all",
1325
+ varsIgnorePattern: "^\\$\\$Props$"
1326
+ }],
1327
+ "svelte/comment-directive": "error",
1328
+ "svelte/no-at-debug-tags": "warn",
1329
+ "svelte/no-at-html-tags": "error",
1330
+ "svelte/no-dupe-else-if-blocks": "error",
1331
+ "svelte/no-dupe-style-properties": "error",
1332
+ "svelte/no-dupe-use-directives": "error",
1333
+ "svelte/no-dynamic-slot-name": "error",
1334
+ "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1335
+ "svelte/no-inner-declarations": "error",
1336
+ "svelte/no-not-function-handler": "error",
1337
+ "svelte/no-object-in-text-mustaches": "error",
1338
+ "svelte/no-reactive-functions": "error",
1339
+ "svelte/no-reactive-literals": "error",
1340
+ "svelte/no-shorthand-style-property-overrides": "error",
1341
+ "svelte/no-unknown-style-directive-property": "error",
1342
+ "svelte/no-unused-svelte-ignore": "error",
1343
+ "svelte/no-useless-mustaches": "error",
1344
+ "svelte/require-store-callbacks-use-set-param": "error",
1345
+ "svelte/system": "error",
1346
+ "svelte/valid-compile": "error",
1347
+ "svelte/valid-each-key": "error",
1348
+ "unused-imports/no-unused-vars": [
1349
+ "error",
1350
+ { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$)" }
1351
+ ],
1352
+ ...stylistic2 ? {
1353
+ "style/no-trailing-spaces": "off",
1354
+ // superseded by svelte/no-trailing-spaces
1355
+ "svelte/derived-has-same-inputs-outputs": "error",
1356
+ "svelte/html-closing-bracket-spacing": "error",
1357
+ "svelte/html-quotes": ["error", { prefer: quotes }],
1358
+ "svelte/indent": ["error", { alignAttributesVertically: true, indent }],
1359
+ "svelte/mustache-spacing": "error",
1360
+ "svelte/no-spaces-around-equal-signs-in-attribute": "error",
1361
+ "svelte/no-trailing-spaces": "error",
1362
+ "svelte/spaced-html-comment": "error"
1363
+ } : {},
1364
+ ...overrides
1365
+ }
1366
+ }
1367
+ ];
1368
+ }
1369
+
1370
+ // src/configs/test.ts
1371
+ init_esm_shims();
1372
+ async function test(options = {}) {
1373
+ const {
1374
+ files = GLOB_TESTS,
1375
+ isInEditor = false,
1376
+ overrides = {}
1377
+ } = options;
1378
+ const [
1379
+ pluginVitest,
1380
+ pluginNoOnlyTests
1381
+ ] = await Promise.all([
1382
+ interopDefault(import("eslint-plugin-vitest")),
1383
+ // @ts-expect-error missing types
1384
+ interopDefault(import("eslint-plugin-no-only-tests"))
1385
+ ]);
1386
+ return [
1387
+ {
1388
+ name: "curev:test:setup",
1389
+ plugins: {
1390
+ test: {
1391
+ ...pluginVitest,
1392
+ rules: {
1393
+ ...pluginVitest.rules,
1394
+ // extend `test/no-only-tests` rule
1395
+ ...pluginNoOnlyTests.rules
1396
+ }
1397
+ }
1398
+ }
1399
+ },
1400
+ {
1401
+ files,
1402
+ name: "curev:test:rules",
1403
+ rules: {
1404
+ "node/prefer-global/process": "off",
1405
+ "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1406
+ "test/no-identical-title": "error",
1407
+ "test/no-import-node-test": "error",
1408
+ "test/no-only-tests": isInEditor ? "off" : "error",
1409
+ "test/prefer-hooks-in-order": "error",
1410
+ "test/prefer-lowercase-title": "error",
1411
+ ...overrides
1412
+ }
1413
+ }
1414
+ ];
1415
+ }
1416
+
1417
+ // src/configs/typescript.ts
1418
+ init_esm_shims();
1419
+ import process2 from "process";
1420
+ async function typescript(options = {}) {
1421
+ const {
1422
+ componentExts = [],
1423
+ overrides = {},
1424
+ parserOptions = {}
1425
+ } = options;
1426
+ const files = options.files ?? [
1427
+ GLOB_SRC,
1428
+ ...componentExts.map((ext) => `**/*.${ext}`)
1429
+ ];
1430
+ const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1431
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1432
+ const isTypeAware = !!tsconfigPath;
1433
+ const typeAwareRules = {
1434
+ "dot-notation": "off",
1435
+ "no-implied-eval": "off",
1436
+ "no-throw-literal": "off",
1437
+ "ts/await-thenable": "error",
1438
+ "ts/dot-notation": ["error", { allowKeywords: true }],
1439
+ "ts/no-floating-promises": "error",
1440
+ "ts/no-for-in-array": "error",
1441
+ "ts/no-implied-eval": "error",
1442
+ "ts/no-misused-promises": "error",
1443
+ "ts/no-throw-literal": "error",
1444
+ "ts/no-unnecessary-type-assertion": "error",
1445
+ "ts/no-unsafe-argument": "error",
1446
+ "ts/no-unsafe-assignment": "error",
1447
+ "ts/no-unsafe-call": "error",
1448
+ "ts/no-unsafe-member-access": "error",
1449
+ "ts/no-unsafe-return": "error",
1450
+ "ts/restrict-plus-operands": "error",
1451
+ "ts/restrict-template-expressions": "error",
1452
+ "ts/unbound-method": "error"
1453
+ };
1454
+ const [
1455
+ pluginTs,
1456
+ parserTs
1457
+ ] = await Promise.all([
1458
+ interopDefault(import("@typescript-eslint/eslint-plugin")),
1459
+ interopDefault(import("./dist-QAUNCL3U.js"))
1460
+ ]);
1461
+ function makeParser(typeAware, files2, ignores2) {
1462
+ return {
1463
+ files: files2,
1464
+ ...ignores2 ? { ignores: ignores2 } : {},
1465
+ languageOptions: {
1466
+ parser: parserTs,
1467
+ parserOptions: {
1468
+ extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1469
+ sourceType: "module",
1470
+ ...typeAware ? {
1471
+ project: tsconfigPath,
1472
+ tsconfigRootDir: process2.cwd()
1473
+ } : {},
1474
+ ...parserOptions
1475
+ }
1476
+ },
1477
+ name: `curev:typescript:${typeAware ? "type-aware-parser" : "parser"}`
1478
+ };
1479
+ }
1480
+ return [
1481
+ {
1482
+ // Install the plugins without globs, so they can be configured separately.
1483
+ name: "curev:typescript:setup",
1484
+ plugins: {
1485
+ curev: default2,
1486
+ ts: pluginTs
1487
+ }
1488
+ },
1489
+ // assign type-aware parser for type-aware files and type-unaware parser for the rest
1490
+ ...isTypeAware ? [
1491
+ makeParser(true, filesTypeAware),
1492
+ makeParser(false, files, filesTypeAware)
1493
+ ] : [makeParser(false, files)],
1494
+ {
1495
+ files,
1496
+ name: "curev:typescript:rules",
1497
+ rules: {
1498
+ ...renameRules(
1499
+ pluginTs.configs["eslint-recommended"].overrides[0].rules,
1500
+ "@typescript-eslint/",
1501
+ "ts/"
1502
+ ),
1503
+ ...renameRules(
1504
+ pluginTs.configs.strict.rules,
1505
+ "@typescript-eslint/",
1506
+ "ts/"
1507
+ ),
1508
+ "no-dupe-class-members": "off",
1509
+ "no-loss-of-precision": "off",
1510
+ "no-redeclare": "off",
1511
+ "no-use-before-define": "off",
1512
+ "no-useless-constructor": "off",
1513
+ "ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
1514
+ "ts/ban-types": ["error", { types: { Function: false } }],
1515
+ "ts/consistent-type-definitions": ["error", "interface"],
1516
+ "ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
1517
+ "ts/no-dupe-class-members": "error",
1518
+ "ts/no-dynamic-delete": "off",
1519
+ "ts/no-explicit-any": "off",
1520
+ "ts/no-extraneous-class": "off",
1521
+ "ts/no-import-type-side-effects": "error",
1522
+ "ts/no-invalid-void-type": "off",
1523
+ "ts/no-loss-of-precision": "error",
1524
+ "ts/no-non-null-assertion": "off",
1525
+ "ts/no-redeclare": "error",
1526
+ "ts/no-require-imports": "error",
1527
+ "ts/no-unused-vars": "off",
1528
+ "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
1529
+ "ts/no-useless-constructor": "off",
1530
+ "ts/prefer-ts-expect-error": "error",
1531
+ "ts/triple-slash-reference": "off",
1532
+ "ts/unified-signatures": "off",
1533
+ ...overrides
1534
+ }
1535
+ },
1536
+ {
1537
+ files: filesTypeAware,
1538
+ name: "curev:typescript:rules-type-aware",
1539
+ rules: {
1540
+ ...tsconfigPath ? typeAwareRules : {},
1541
+ ...overrides
1542
+ }
1543
+ },
1544
+ {
1545
+ files: ["**/*.d.ts"],
1546
+ name: "curev:typescript:dts-overrides",
1547
+ rules: {
1548
+ "eslint-comments/no-unlimited-disable": "off",
1549
+ "import/no-duplicates": "off",
1550
+ "no-restricted-syntax": "off",
1551
+ "unused-imports/no-unused-vars": "off"
1552
+ }
1553
+ },
1554
+ {
1555
+ files: ["**/*.{test,spec}.ts?(x)"],
1556
+ name: "curev:typescript:tests-overrides",
1557
+ rules: {
1558
+ "no-unused-expressions": "off"
1559
+ }
1560
+ },
1561
+ {
1562
+ files: ["**/*.js", "**/*.cjs"],
1563
+ name: "curev:typescript:javascript-overrides",
1564
+ rules: {
1565
+ "ts/no-require-imports": "off",
1566
+ "ts/no-var-requires": "off"
1567
+ }
1568
+ }
1569
+ ];
1570
+ }
1571
+
1572
+ // src/configs/unicorn.ts
1573
+ init_esm_shims();
1574
+ async function unicorn() {
1575
+ return [
1576
+ {
1577
+ name: "curev:unicorn",
1578
+ plugins: {
1579
+ unicorn: default5
1580
+ },
1581
+ rules: {
1582
+ // Pass error message when throwing errors
1583
+ "unicorn/error-message": "error",
1584
+ // Uppercase regex escapes
1585
+ "unicorn/escape-case": "error",
1586
+ // Array.isArray instead of instanceof
1587
+ "unicorn/no-instanceof-array": "error",
1588
+ // Ban `new Array` as `Array` constructor's params are ambiguous
1589
+ "unicorn/no-new-array": "error",
1590
+ // Prevent deprecated `new Buffer()`
1591
+ "unicorn/no-new-buffer": "error",
1592
+ // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
1593
+ "unicorn/number-literal-case": "error",
1594
+ // textContent instead of innerText
1595
+ "unicorn/prefer-dom-node-text-content": "error",
1596
+ // includes over indexOf when checking for existence
1597
+ "unicorn/prefer-includes": "error",
1598
+ // Prefer using the node: protocol
1599
+ "unicorn/prefer-node-protocol": "error",
1600
+ // Prefer using number properties like `Number.isNaN` rather than `isNaN`
1601
+ "unicorn/prefer-number-properties": "error",
1602
+ // String methods startsWith/endsWith instead of more complicated stuff
1603
+ "unicorn/prefer-string-starts-ends-with": "error",
1604
+ // Enforce throwing type error when throwing error while checking typeof
1605
+ "unicorn/prefer-type-error": "error",
1606
+ // Use new when throwing error
1607
+ "unicorn/throw-new-error": "error"
1608
+ }
1609
+ }
1610
+ ];
1611
+ }
1612
+
1613
+ // src/configs/unocss.ts
1614
+ init_esm_shims();
1615
+ async function unocss(options = {}) {
1616
+ const {
1617
+ attributify = true,
1618
+ strict = false
1619
+ } = options;
1620
+ await ensurePackages([
1621
+ "@unocss/eslint-plugin"
1622
+ ]);
1623
+ const [
1624
+ pluginUnoCSS
1625
+ ] = await Promise.all([
1626
+ interopDefault(import("@unocss/eslint-plugin"))
1627
+ ]);
1628
+ return [
1629
+ {
1630
+ name: "curev:unocss",
1631
+ plugins: {
1632
+ unocss: pluginUnoCSS
1633
+ },
1634
+ rules: {
1635
+ "unocss/order": "warn",
1636
+ ...attributify ? {
1637
+ "unocss/order-attributify": "warn"
1638
+ } : {},
1639
+ ...strict ? {
1640
+ "unocss/blocklist": "error"
1641
+ } : {}
1642
+ }
1643
+ }
1644
+ ];
1645
+ }
1646
+
1647
+ // src/configs/vue.ts
1648
+ init_esm_shims();
1649
+ import { mergeProcessors as mergeProcessors2 } from "eslint-merge-processors";
1650
+ async function vue(options = {}) {
1651
+ const {
1652
+ files = [GLOB_VUE],
1653
+ overrides = {},
1654
+ stylistic: stylistic2 = true,
1655
+ vueVersion = 3
1656
+ } = options;
1657
+ const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
1658
+ const {
1659
+ indent = 2
1660
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1661
+ const [
1662
+ pluginVue,
1663
+ parserVue,
1664
+ processorVueBlocks
1665
+ ] = await Promise.all([
1666
+ // @ts-expect-error missing types
1667
+ interopDefault(import("eslint-plugin-vue")),
1668
+ interopDefault(import("vue-eslint-parser")),
1669
+ interopDefault(import("eslint-processor-vue-blocks"))
1670
+ ]);
1671
+ return [
1672
+ {
1673
+ name: "curev:vue:setup",
1674
+ plugins: {
1675
+ vue: pluginVue
1676
+ }
1677
+ },
1678
+ {
1679
+ files,
1680
+ languageOptions: {
1681
+ parser: parserVue,
1682
+ parserOptions: {
1683
+ ecmaFeatures: {
1684
+ jsx: true
1685
+ },
1686
+ extraFileExtensions: [".vue"],
1687
+ parser: options.typescript ? await interopDefault(import("./dist-QAUNCL3U.js")) : null,
1688
+ sourceType: "module"
1689
+ }
1690
+ },
1691
+ name: "curev:vue:rules",
1692
+ processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors2([
1693
+ pluginVue.processors[".vue"],
1694
+ processorVueBlocks({
1695
+ ...sfcBlocks,
1696
+ blocks: {
1697
+ styles: true,
1698
+ ...sfcBlocks.blocks
1699
+ }
1700
+ })
1701
+ ]),
1702
+ rules: {
1703
+ ...pluginVue.configs.base.rules,
1704
+ ...vueVersion === 2 ? {
1705
+ ...pluginVue.configs.essential.rules,
1706
+ ...pluginVue.configs["strongly-recommended"].rules,
1707
+ ...pluginVue.configs.recommended.rules
1708
+ } : {
1709
+ ...pluginVue.configs["vue3-essential"].rules,
1710
+ ...pluginVue.configs["vue3-strongly-recommended"].rules,
1711
+ ...pluginVue.configs["vue3-recommended"].rules
1712
+ },
1713
+ "node/prefer-global/process": "off",
1714
+ "vue/block-order": ["error", {
1715
+ order: ["script", "template", "style"]
1716
+ }],
1717
+ "vue/component-name-in-template-casing": ["error", "PascalCase"],
1718
+ "vue/component-options-name-casing": ["error", "PascalCase"],
1719
+ // this is deprecated
1720
+ "vue/component-tags-order": "off",
1721
+ "vue/custom-event-name-casing": ["error", "camelCase"],
1722
+ "vue/define-macros-order": ["error", {
1723
+ order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
1724
+ }],
1725
+ "vue/dot-location": ["error", "property"],
1726
+ "vue/dot-notation": ["error", { allowKeywords: true }],
1727
+ "vue/eqeqeq": ["error", "smart"],
1728
+ "vue/html-indent": ["error", indent],
1729
+ "vue/html-quotes": ["error", "double"],
1730
+ "vue/max-attributes-per-line": "off",
1731
+ "vue/multi-word-component-names": "off",
1732
+ "vue/no-dupe-keys": "off",
1733
+ "vue/no-empty-pattern": "error",
1734
+ "vue/no-irregular-whitespace": "error",
1735
+ "vue/no-loss-of-precision": "error",
1736
+ "vue/no-restricted-syntax": [
1737
+ "error",
1738
+ "DebuggerStatement",
1739
+ "LabeledStatement",
1740
+ "WithStatement"
1741
+ ],
1742
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
1743
+ "vue/no-setup-props-reactivity-loss": "off",
1744
+ "vue/no-sparse-arrays": "error",
1745
+ "vue/no-unused-refs": "error",
1746
+ "vue/no-useless-v-bind": "error",
1747
+ "vue/no-v-html": "off",
1748
+ "vue/object-shorthand": [
1749
+ "error",
1750
+ "always",
1751
+ {
1752
+ avoidQuotes: true,
1753
+ ignoreConstructors: false
1754
+ }
1755
+ ],
1756
+ "vue/prefer-separate-static-class": "error",
1757
+ "vue/prefer-template": "error",
1758
+ "vue/prop-name-casing": ["error", "camelCase"],
1759
+ "vue/require-default-prop": "off",
1760
+ "vue/require-prop-types": "off",
1761
+ "vue/space-infix-ops": "error",
1762
+ "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
1763
+ ...stylistic2 ? {
1764
+ "vue/array-bracket-spacing": ["error", "never"],
1765
+ "vue/arrow-spacing": ["error", { after: true, before: true }],
1766
+ "vue/block-spacing": ["error", "always"],
1767
+ "vue/block-tag-newline": ["error", {
1768
+ multiline: "always",
1769
+ singleline: "always"
1770
+ }],
1771
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
1772
+ "vue/comma-dangle": ["error", "always-multiline"],
1773
+ "vue/comma-spacing": ["error", { after: true, before: false }],
1774
+ "vue/comma-style": ["error", "last"],
1775
+ "vue/html-comment-content-spacing": ["error", "always", {
1776
+ exceptions: ["-"]
1777
+ }],
1778
+ "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1779
+ "vue/keyword-spacing": ["error", { after: true, before: true }],
1780
+ "vue/object-curly-newline": "off",
1781
+ "vue/object-curly-spacing": ["error", "always"],
1782
+ "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
1783
+ "vue/operator-linebreak": ["error", "before"],
1784
+ "vue/padding-line-between-blocks": ["error", "always"],
1785
+ "vue/quote-props": ["error", "consistent-as-needed"],
1786
+ "vue/space-in-parens": ["error", "never"],
1787
+ "vue/template-curly-spacing": "error"
1788
+ } : {},
1789
+ ...overrides
1790
+ }
1791
+ }
1792
+ ];
1793
+ }
1794
+
1795
+ // src/configs/yaml.ts
1796
+ init_esm_shims();
1797
+ async function yaml(options = {}) {
1798
+ const {
1799
+ files = [GLOB_YAML],
1800
+ overrides = {},
1801
+ stylistic: stylistic2 = true
1802
+ } = options;
1803
+ const {
1804
+ indent = 2,
1805
+ quotes = "single"
1806
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1807
+ const [
1808
+ pluginYaml,
1809
+ parserYaml
1810
+ ] = await Promise.all([
1811
+ interopDefault(import("eslint-plugin-yml")),
1812
+ interopDefault(import("yaml-eslint-parser"))
1813
+ ]);
1814
+ return [
1815
+ {
1816
+ name: "curev:yaml:setup",
1817
+ plugins: {
1818
+ yaml: pluginYaml
1819
+ }
1820
+ },
1821
+ {
1822
+ files,
1823
+ languageOptions: {
1824
+ parser: parserYaml
1825
+ },
1826
+ name: "curev:yaml:rules",
1827
+ rules: {
1828
+ "style/spaced-comment": "off",
1829
+ "yaml/block-mapping": "error",
1830
+ "yaml/block-sequence": "error",
1831
+ "yaml/no-empty-key": "error",
1832
+ "yaml/no-empty-sequence-entry": "error",
1833
+ "yaml/no-irregular-whitespace": "error",
1834
+ "yaml/plain-scalar": "error",
1835
+ "yaml/vue-custom-block/no-parsing-error": "error",
1836
+ ...stylistic2 ? {
1837
+ "yaml/block-mapping-question-indicator-newline": "error",
1838
+ "yaml/block-sequence-hyphen-indicator-newline": "error",
1839
+ "yaml/flow-mapping-curly-newline": "error",
1840
+ "yaml/flow-mapping-curly-spacing": "error",
1841
+ "yaml/flow-sequence-bracket-newline": "error",
1842
+ "yaml/flow-sequence-bracket-spacing": "error",
1843
+ "yaml/indent": ["error", indent === "tab" ? 2 : indent],
1844
+ "yaml/key-spacing": "error",
1845
+ "yaml/no-tab-indent": "error",
1846
+ "yaml/quotes": ["error", { avoidEscape: false, prefer: quotes }],
1847
+ "yaml/spaced-comment": "error"
1848
+ } : {},
1849
+ ...overrides
1850
+ }
1851
+ }
1852
+ ];
1853
+ }
1854
+
1855
+ // src/configs/toml.ts
1856
+ init_esm_shims();
1857
+ async function toml(options = {}) {
1858
+ const {
1859
+ files = [GLOB_TOML],
1860
+ overrides = {},
1861
+ stylistic: stylistic2 = true
1862
+ } = options;
1863
+ const {
1864
+ indent = 2
1865
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1866
+ const [
1867
+ pluginToml,
1868
+ parserToml
1869
+ ] = await Promise.all([
1870
+ interopDefault(import("eslint-plugin-toml")),
1871
+ interopDefault(import("toml-eslint-parser"))
1872
+ ]);
1873
+ return [
1874
+ {
1875
+ name: "curev:toml:setup",
1876
+ plugins: {
1877
+ toml: pluginToml
1878
+ }
1879
+ },
1880
+ {
1881
+ files,
1882
+ languageOptions: {
1883
+ parser: parserToml
1884
+ },
1885
+ name: "curev:toml:rules",
1886
+ rules: {
1887
+ "style/spaced-comment": "off",
1888
+ "toml/comma-style": "error",
1889
+ "toml/keys-order": "error",
1890
+ "toml/no-space-dots": "error",
1891
+ "toml/no-unreadable-number-separator": "error",
1892
+ "toml/precision-of-fractional-seconds": "error",
1893
+ "toml/precision-of-integer": "error",
1894
+ "toml/tables-order": "error",
1895
+ "toml/vue-custom-block/no-parsing-error": "error",
1896
+ ...stylistic2 ? {
1897
+ "toml/array-bracket-newline": "error",
1898
+ "toml/array-bracket-spacing": "error",
1899
+ "toml/array-element-newline": "error",
1900
+ "toml/indent": ["error", indent === "tab" ? 2 : indent],
1901
+ "toml/inline-table-curly-spacing": "error",
1902
+ "toml/key-spacing": "error",
1903
+ "toml/padding-line-between-pairs": "error",
1904
+ "toml/padding-line-between-tables": "error",
1905
+ "toml/quoted-keys": "error",
1906
+ "toml/spaced-comment": "error",
1907
+ "toml/table-bracket-spacing": "error"
1908
+ } : {},
1909
+ ...overrides
1910
+ }
1911
+ }
1912
+ ];
1913
+ }
1914
+
1915
+ // src/factory.ts
1916
+ var flatConfigProps = [
1917
+ "name",
1918
+ "files",
1919
+ "ignores",
1920
+ "languageOptions",
1921
+ "linterOptions",
1922
+ "processor",
1923
+ "plugins",
1924
+ "rules",
1925
+ "settings"
1926
+ ];
1927
+ var VuePackages = [
1928
+ "vue",
1929
+ "nuxt",
1930
+ "vitepress",
1931
+ "@slidev/cli"
1932
+ ];
1933
+ async function curev(options = {}, ...userConfigs) {
1934
+ const {
1935
+ componentExts = [],
1936
+ gitignore: enableGitignore = true,
1937
+ isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI),
1938
+ react: enableReact = false,
1939
+ svelte: enableSvelte = false,
1940
+ typescript: enableTypeScript = isPackageExists3("typescript"),
1941
+ unocss: enableUnoCSS = false,
1942
+ vue: enableVue = VuePackages.some((i) => isPackageExists3(i))
1943
+ } = options;
1944
+ const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
1945
+ if (stylisticOptions && !("jsx" in stylisticOptions)) {
1946
+ stylisticOptions.jsx = options.jsx ?? true;
1947
+ }
1948
+ const configs = [];
1949
+ if (enableGitignore) {
1950
+ if (typeof enableGitignore !== "boolean") {
1951
+ configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
1952
+ } else {
1953
+ if (fs.existsSync(".gitignore")) {
1954
+ configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
1955
+ }
1956
+ }
1957
+ }
1958
+ configs.push(
1959
+ ignores(),
1960
+ javascript({
1961
+ isInEditor,
1962
+ overrides: getOverrides(options, "javascript")
1963
+ }),
1964
+ comments(),
1965
+ node(),
1966
+ jsdoc({
1967
+ stylistic: stylisticOptions
1968
+ }),
1969
+ imports({
1970
+ stylistic: stylisticOptions
1971
+ }),
1972
+ unicorn(),
1973
+ // Optional plugins (installed but not enabled by default)
1974
+ perfectionist()
1975
+ );
1976
+ if (enableVue) {
1977
+ componentExts.push("vue");
1978
+ }
1979
+ if (enableTypeScript) {
1980
+ configs.push(typescript({
1981
+ ...resolveSubOptions(options, "typescript"),
1982
+ componentExts,
1983
+ overrides: getOverrides(options, "typescript")
1984
+ }));
1985
+ }
1986
+ if (stylisticOptions) {
1987
+ configs.push(stylistic({
1988
+ ...stylisticOptions,
1989
+ overrides: getOverrides(options, "stylistic")
1990
+ }));
1991
+ }
1992
+ if (options.test ?? true) {
1993
+ configs.push(test({
1994
+ isInEditor,
1995
+ overrides: getOverrides(options, "test")
1996
+ }));
1997
+ }
1998
+ if (enableVue) {
1999
+ configs.push(vue({
2000
+ ...resolveSubOptions(options, "vue"),
2001
+ overrides: getOverrides(options, "vue"),
2002
+ stylistic: stylisticOptions,
2003
+ typescript: !!enableTypeScript
2004
+ }));
2005
+ }
2006
+ if (enableReact) {
2007
+ configs.push(react({
2008
+ overrides: getOverrides(options, "react"),
2009
+ typescript: !!enableTypeScript
2010
+ }));
2011
+ }
2012
+ if (enableSvelte) {
2013
+ configs.push(svelte({
2014
+ overrides: getOverrides(options, "svelte"),
2015
+ stylistic: stylisticOptions,
2016
+ typescript: !!enableTypeScript
2017
+ }));
2018
+ }
2019
+ if (enableUnoCSS) {
2020
+ configs.push(unocss({
2021
+ ...resolveSubOptions(options, "unocss"),
2022
+ overrides: getOverrides(options, "unocss")
2023
+ }));
2024
+ }
2025
+ if (options.jsonc ?? true) {
2026
+ configs.push(
2027
+ jsonc({
2028
+ overrides: getOverrides(options, "jsonc"),
2029
+ stylistic: stylisticOptions
2030
+ }),
2031
+ sortPackageJson(),
2032
+ sortTsconfig()
2033
+ );
2034
+ }
2035
+ if (options.yaml ?? true) {
2036
+ configs.push(yaml({
2037
+ overrides: getOverrides(options, "yaml"),
2038
+ stylistic: stylisticOptions
2039
+ }));
2040
+ }
2041
+ if (options.toml ?? true) {
2042
+ configs.push(toml({
2043
+ overrides: getOverrides(options, "toml"),
2044
+ stylistic: stylisticOptions
2045
+ }));
2046
+ }
2047
+ if (options.markdown ?? true) {
2048
+ configs.push(
2049
+ markdown(
2050
+ {
2051
+ componentExts,
2052
+ overrides: getOverrides(options, "markdown")
2053
+ }
2054
+ )
2055
+ );
2056
+ }
2057
+ if (options.formatters) {
2058
+ configs.push(formatters(
2059
+ options.formatters,
2060
+ typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2061
+ ));
2062
+ }
2063
+ const fusedConfig = flatConfigProps.reduce((acc, key) => {
2064
+ if (key in options) {
2065
+ acc[key] = options[key];
2066
+ }
2067
+ return acc;
2068
+ }, {});
2069
+ if (Object.keys(fusedConfig).length) {
2070
+ configs.push([fusedConfig]);
2071
+ }
2072
+ const merged = combine(
2073
+ ...configs,
2074
+ ...userConfigs
2075
+ );
2076
+ return merged;
2077
+ }
2078
+ function resolveSubOptions(options, key) {
2079
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
2080
+ }
2081
+ function getOverrides(options, key) {
2082
+ const sub = resolveSubOptions(options, key);
2083
+ return {
2084
+ ...options.overrides?.[key],
2085
+ ..."overrides" in sub ? sub.overrides : {}
2086
+ };
2087
+ }
2088
+
2089
+ // src/types.ts
2090
+ init_esm_shims();
2091
+
2092
+ // src/index.ts
2093
+ var src_default = curev;
2094
+ export {
2095
+ GLOB_ALL_SRC,
2096
+ GLOB_CSS,
2097
+ GLOB_EXCLUDE,
2098
+ GLOB_HTML,
2099
+ GLOB_JS,
2100
+ GLOB_JSON,
2101
+ GLOB_JSON5,
2102
+ GLOB_JSONC,
2103
+ GLOB_JSX,
2104
+ GLOB_LESS,
2105
+ GLOB_MARKDOWN,
2106
+ GLOB_MARKDOWN_CODE,
2107
+ GLOB_MARKDOWN_IN_MARKDOWN,
2108
+ GLOB_POSTCSS,
2109
+ GLOB_SCSS,
2110
+ GLOB_SRC,
2111
+ GLOB_SRC_EXT,
2112
+ GLOB_STYLE,
2113
+ GLOB_SVELTE,
2114
+ GLOB_TESTS,
2115
+ GLOB_TOML,
2116
+ GLOB_TS,
2117
+ GLOB_TSX,
2118
+ GLOB_VUE,
2119
+ GLOB_YAML,
2120
+ StylisticConfigDefaults,
2121
+ combine,
2122
+ comments,
2123
+ curev,
2124
+ src_default as default,
2125
+ ensurePackages,
2126
+ formatters,
2127
+ getOverrides,
2128
+ ignores,
2129
+ imports,
2130
+ interopDefault,
2131
+ javascript,
2132
+ jsdoc,
2133
+ jsonc,
2134
+ markdown,
2135
+ node,
2136
+ parserPlain,
2137
+ perfectionist,
2138
+ react,
2139
+ renameRules,
2140
+ resolveSubOptions,
2141
+ sortPackageJson,
2142
+ sortTsconfig,
2143
+ stylistic,
2144
+ svelte,
2145
+ test,
2146
+ toArray,
2147
+ toml,
2148
+ typescript,
2149
+ unicorn,
2150
+ unocss,
2151
+ vue,
2152
+ yaml
2153
+ };