@curev/eslint-config 0.3.3 → 0.3.5

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