@curev/eslint-config 0.3.3 → 0.3.4

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,2102 @@
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
+ };
749
+ async function stylistic(options = {}) {
750
+ const mergeOptions = {
751
+ ...StylisticConfigDefaults,
752
+ ...options
753
+ };
754
+ const { overrides = {} } = mergeOptions;
755
+ const pluginStylistic = await interopDefault(import('@stylistic/eslint-plugin'));
756
+ const config = pluginStylistic.configs.customize({
757
+ flat: true,
758
+ pluginName: "style",
759
+ ...mergeOptions
760
+ });
761
+ return [
762
+ {
763
+ name: "curev:stylistic",
764
+ plugins: {
765
+ curev: pluginCurev__default,
766
+ style: pluginStylistic
767
+ },
768
+ rules: {
769
+ ...config.rules,
770
+ "curev/consistent-list-newline": "error",
771
+ "curev/if-newline": "off",
772
+ "curev/top-level-function": "error",
773
+ "semi-spacing": ["error", { before: false, after: true }],
774
+ "style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
775
+ "curly": ["error", "all"],
776
+ "style/max-statements-per-line": ["off"],
777
+ "curev/max-statements-per-line": ["error", { max: 1 }],
778
+ ...overrides
779
+ }
780
+ }
781
+ ];
782
+ }
783
+
784
+ async function formatters(options = {}, stylistic = {}) {
785
+ await ensurePackages([
786
+ "eslint-plugin-format"
787
+ ]);
788
+ if (options === true) {
789
+ options = {
790
+ css: true,
791
+ graphql: true,
792
+ html: true,
793
+ markdown: true
794
+ };
795
+ }
796
+ const {
797
+ indent,
798
+ quotes,
799
+ semi
800
+ } = {
801
+ ...StylisticConfigDefaults,
802
+ ...stylistic
803
+ };
804
+ const prettierOptions = Object.assign(
805
+ {
806
+ endOfLine: "auto",
807
+ semi,
808
+ singleQuote: quotes === "single",
809
+ tabWidth: typeof indent === "number" ? indent : 2,
810
+ trailingComma: "all",
811
+ useTabs: indent === "tab"
812
+ },
813
+ options.prettierOptions || {}
814
+ );
815
+ const dprintOptions = Object.assign(
816
+ {
817
+ indentWidth: typeof indent === "number" ? indent : 2,
818
+ quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
819
+ useTabs: indent === "tab"
820
+ },
821
+ options.dprintOptions || {}
822
+ );
823
+ const pluginFormat = await interopDefault(import('eslint-plugin-format'));
824
+ const configs = [
825
+ {
826
+ name: "curev:formatters:setup",
827
+ plugins: {
828
+ format: pluginFormat
829
+ }
830
+ }
831
+ ];
832
+ if (options.css) {
833
+ configs.push(
834
+ {
835
+ files: [GLOB_CSS, GLOB_POSTCSS],
836
+ languageOptions: {
837
+ parser: parserPlain
838
+ },
839
+ name: "curev:formatter:css",
840
+ rules: {
841
+ "format/prettier": [
842
+ "error",
843
+ {
844
+ ...prettierOptions,
845
+ parser: "css"
846
+ }
847
+ ]
848
+ }
849
+ },
850
+ {
851
+ files: [GLOB_SCSS],
852
+ languageOptions: {
853
+ parser: parserPlain
854
+ },
855
+ name: "curev:formatter:scss",
856
+ rules: {
857
+ "format/prettier": [
858
+ "error",
859
+ {
860
+ ...prettierOptions,
861
+ parser: "scss"
862
+ }
863
+ ]
864
+ }
865
+ },
866
+ {
867
+ files: [GLOB_LESS],
868
+ languageOptions: {
869
+ parser: parserPlain
870
+ },
871
+ name: "curev:formatter:less",
872
+ rules: {
873
+ "format/prettier": [
874
+ "error",
875
+ {
876
+ ...prettierOptions,
877
+ parser: "less"
878
+ }
879
+ ]
880
+ }
881
+ }
882
+ );
883
+ }
884
+ if (options.html) {
885
+ configs.push({
886
+ files: ["**/*.html"],
887
+ languageOptions: {
888
+ parser: parserPlain
889
+ },
890
+ name: "curev:formatter:html",
891
+ rules: {
892
+ "format/prettier": [
893
+ "error",
894
+ {
895
+ ...prettierOptions,
896
+ parser: "html"
897
+ }
898
+ ]
899
+ }
900
+ });
901
+ }
902
+ if (options.markdown) {
903
+ const formater = options.markdown === true ? "prettier" : options.markdown;
904
+ configs.push({
905
+ files: [GLOB_MARKDOWN],
906
+ languageOptions: {
907
+ parser: parserPlain
908
+ },
909
+ name: "curev:formatter:markdown",
910
+ rules: {
911
+ [`format/${formater}`]: [
912
+ "error",
913
+ formater === "prettier" ? {
914
+ printWidth: 120,
915
+ ...prettierOptions,
916
+ embeddedLanguageFormatting: "off",
917
+ parser: "markdown"
918
+ } : {
919
+ ...dprintOptions,
920
+ language: "markdown"
921
+ }
922
+ ]
923
+ }
924
+ });
925
+ }
926
+ if (options.graphql) {
927
+ configs.push({
928
+ files: ["**/*.graphql"],
929
+ languageOptions: {
930
+ parser: parserPlain
931
+ },
932
+ name: "curev:formatter:graphql",
933
+ rules: {
934
+ "format/prettier": [
935
+ "error",
936
+ {
937
+ ...prettierOptions,
938
+ parser: "graphql"
939
+ }
940
+ ]
941
+ }
942
+ });
943
+ }
944
+ return configs;
945
+ }
946
+
947
+ const ReactRefreshAllowConstantExportPackages = [
948
+ "vite"
949
+ ];
950
+ async function react(options = {}) {
951
+ const {
952
+ files = [GLOB_JSX, GLOB_TSX],
953
+ overrides = {},
954
+ typescript = true
955
+ } = options;
956
+ await ensurePackages([
957
+ "eslint-plugin-react",
958
+ "eslint-plugin-react-hooks",
959
+ "eslint-plugin-react-refresh"
960
+ ]);
961
+ const [
962
+ pluginReact,
963
+ pluginReactHooks,
964
+ pluginReactRefresh
965
+ ] = await Promise.all([
966
+ interopDefault(import('eslint-plugin-react')),
967
+ interopDefault(import('eslint-plugin-react-hooks')),
968
+ interopDefault(import('eslint-plugin-react-refresh'))
969
+ ]);
970
+ const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
971
+ (i) => localPkg.isPackageExists(i)
972
+ );
973
+ return [
974
+ {
975
+ name: "curev:react:setup",
976
+ plugins: {
977
+ "react": pluginReact,
978
+ "react-hooks": pluginReactHooks,
979
+ "react-refresh": pluginReactRefresh
980
+ },
981
+ settings: {
982
+ react: {
983
+ version: "detect"
984
+ }
985
+ }
986
+ },
987
+ {
988
+ files,
989
+ languageOptions: {
990
+ parserOptions: {
991
+ ecmaFeatures: {
992
+ jsx: true
993
+ }
994
+ }
995
+ },
996
+ name: "curev:react:rules",
997
+ rules: {
998
+ // recommended rules react-hooks
999
+ "react-hooks/exhaustive-deps": "warn",
1000
+ "react-hooks/rules-of-hooks": "error",
1001
+ // react refresh
1002
+ "react-refresh/only-export-components": [
1003
+ "warn",
1004
+ { allowConstantExport: isAllowConstantExport }
1005
+ ],
1006
+ // recommended rules react
1007
+ "react/display-name": "error",
1008
+ "react/jsx-key": "error",
1009
+ "react/jsx-no-comment-textnodes": "error",
1010
+ "react/jsx-no-duplicate-props": "error",
1011
+ "react/jsx-no-target-blank": "error",
1012
+ "react/jsx-no-undef": "error",
1013
+ "react/jsx-uses-react": "error",
1014
+ "react/jsx-uses-vars": "error",
1015
+ "react/no-children-prop": "error",
1016
+ "react/no-danger-with-children": "error",
1017
+ "react/no-deprecated": "error",
1018
+ "react/no-direct-mutation-state": "error",
1019
+ "react/no-find-dom-node": "error",
1020
+ "react/no-is-mounted": "error",
1021
+ "react/no-render-return-value": "error",
1022
+ "react/no-string-refs": "error",
1023
+ "react/no-unescaped-entities": "error",
1024
+ "react/no-unknown-property": "error",
1025
+ "react/no-unsafe": "off",
1026
+ "react/prop-types": "error",
1027
+ "react/react-in-jsx-scope": "off",
1028
+ "react/require-render-return": "error",
1029
+ ...typescript ? {
1030
+ "react/jsx-no-undef": "off",
1031
+ "react/prop-type": "off"
1032
+ } : {},
1033
+ // overrides
1034
+ ...overrides
1035
+ }
1036
+ }
1037
+ ];
1038
+ }
1039
+
1040
+ async function sortPackageJson() {
1041
+ return [
1042
+ {
1043
+ files: ["**/package.json"],
1044
+ name: "curev:sort-package-json",
1045
+ rules: {
1046
+ "jsonc/sort-array-values": [
1047
+ "error",
1048
+ {
1049
+ order: { type: "asc" },
1050
+ pathPattern: "^files$"
1051
+ }
1052
+ ],
1053
+ "jsonc/sort-keys": [
1054
+ "error",
1055
+ {
1056
+ order: [
1057
+ "publisher",
1058
+ "name",
1059
+ "displayName",
1060
+ "type",
1061
+ "version",
1062
+ "private",
1063
+ "packageManager",
1064
+ "description",
1065
+ "author",
1066
+ "license",
1067
+ "funding",
1068
+ "homepage",
1069
+ "repository",
1070
+ "bugs",
1071
+ "keywords",
1072
+ "categories",
1073
+ "sideEffects",
1074
+ "exports",
1075
+ "main",
1076
+ "module",
1077
+ "unpkg",
1078
+ "jsdelivr",
1079
+ "types",
1080
+ "typesVersions",
1081
+ "bin",
1082
+ "icon",
1083
+ "files",
1084
+ "engines",
1085
+ "activationEvents",
1086
+ "contributes",
1087
+ "scripts",
1088
+ "peerDependencies",
1089
+ "peerDependenciesMeta",
1090
+ "dependencies",
1091
+ "optionalDependencies",
1092
+ "devDependencies",
1093
+ "pnpm",
1094
+ "overrides",
1095
+ "resolutions",
1096
+ "husky",
1097
+ "simple-git-hooks",
1098
+ "lint-staged",
1099
+ "eslintConfig"
1100
+ ],
1101
+ pathPattern: "^$"
1102
+ },
1103
+ {
1104
+ order: { type: "asc" },
1105
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
1106
+ },
1107
+ {
1108
+ order: { type: "asc" },
1109
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1110
+ },
1111
+ {
1112
+ order: [
1113
+ "types",
1114
+ "import",
1115
+ "require",
1116
+ "default"
1117
+ ],
1118
+ pathPattern: "^exports.*$"
1119
+ }
1120
+ ]
1121
+ }
1122
+ }
1123
+ ];
1124
+ }
1125
+ function sortTsconfig() {
1126
+ return [
1127
+ {
1128
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1129
+ name: "curev:sort-tsconfig",
1130
+ rules: {
1131
+ "jsonc/sort-keys": [
1132
+ "error",
1133
+ {
1134
+ order: [
1135
+ "extends",
1136
+ "compilerOptions",
1137
+ "references",
1138
+ "files",
1139
+ "include",
1140
+ "exclude"
1141
+ ],
1142
+ pathPattern: "^$"
1143
+ },
1144
+ {
1145
+ order: [
1146
+ /* Projects */
1147
+ "incremental",
1148
+ "composite",
1149
+ "tsBuildInfoFile",
1150
+ "disableSourceOfProjectReferenceRedirect",
1151
+ "disableSolutionSearching",
1152
+ "disableReferencedProjectLoad",
1153
+ /* Language and Environment */
1154
+ "target",
1155
+ "jsx",
1156
+ "jsxFactory",
1157
+ "jsxFragmentFactory",
1158
+ "jsxImportSource",
1159
+ "lib",
1160
+ "moduleDetection",
1161
+ "noLib",
1162
+ "reactNamespace",
1163
+ "useDefineForClassFields",
1164
+ "emitDecoratorMetadata",
1165
+ "experimentalDecorators",
1166
+ /* Modules */
1167
+ "baseUrl",
1168
+ "rootDir",
1169
+ "rootDirs",
1170
+ "customConditions",
1171
+ "module",
1172
+ "moduleResolution",
1173
+ "moduleSuffixes",
1174
+ "noResolve",
1175
+ "paths",
1176
+ "resolveJsonModule",
1177
+ "resolvePackageJsonExports",
1178
+ "resolvePackageJsonImports",
1179
+ "typeRoots",
1180
+ "types",
1181
+ "allowArbitraryExtensions",
1182
+ "allowImportingTsExtensions",
1183
+ "allowUmdGlobalAccess",
1184
+ /* JavaScript Support */
1185
+ "allowJs",
1186
+ "checkJs",
1187
+ "maxNodeModuleJsDepth",
1188
+ /* Type Checking */
1189
+ "strict",
1190
+ "strictBindCallApply",
1191
+ "strictFunctionTypes",
1192
+ "strictNullChecks",
1193
+ "strictPropertyInitialization",
1194
+ "allowUnreachableCode",
1195
+ "allowUnusedLabels",
1196
+ "alwaysStrict",
1197
+ "exactOptionalPropertyTypes",
1198
+ "noFallthroughCasesInSwitch",
1199
+ "noImplicitAny",
1200
+ "noImplicitOverride",
1201
+ "noImplicitReturns",
1202
+ "noImplicitThis",
1203
+ "noPropertyAccessFromIndexSignature",
1204
+ "noUncheckedIndexedAccess",
1205
+ "noUnusedLocals",
1206
+ "noUnusedParameters",
1207
+ "useUnknownInCatchVariables",
1208
+ /* Emit */
1209
+ "declaration",
1210
+ "declarationDir",
1211
+ "declarationMap",
1212
+ "downlevelIteration",
1213
+ "emitBOM",
1214
+ "emitDeclarationOnly",
1215
+ "importHelpers",
1216
+ "importsNotUsedAsValues",
1217
+ "inlineSourceMap",
1218
+ "inlineSources",
1219
+ "mapRoot",
1220
+ "newLine",
1221
+ "noEmit",
1222
+ "noEmitHelpers",
1223
+ "noEmitOnError",
1224
+ "outDir",
1225
+ "outFile",
1226
+ "preserveConstEnums",
1227
+ "preserveValueImports",
1228
+ "removeComments",
1229
+ "sourceMap",
1230
+ "sourceRoot",
1231
+ "stripInternal",
1232
+ /* Interop Constraints */
1233
+ "allowSyntheticDefaultImports",
1234
+ "esModuleInterop",
1235
+ "forceConsistentCasingInFileNames",
1236
+ "isolatedModules",
1237
+ "preserveSymlinks",
1238
+ "verbatimModuleSyntax",
1239
+ /* Completeness */
1240
+ "skipDefaultLibCheck",
1241
+ "skipLibCheck"
1242
+ ],
1243
+ pathPattern: "^compilerOptions$"
1244
+ }
1245
+ ]
1246
+ }
1247
+ }
1248
+ ];
1249
+ }
1250
+
1251
+ async function svelte(options = {}) {
1252
+ const {
1253
+ files = [GLOB_SVELTE],
1254
+ overrides = {},
1255
+ stylistic = true
1256
+ } = options;
1257
+ const {
1258
+ indent = 2,
1259
+ quotes = "single"
1260
+ } = typeof stylistic === "boolean" ? {} : stylistic;
1261
+ await ensurePackages([
1262
+ "eslint-plugin-svelte"
1263
+ ]);
1264
+ const [
1265
+ pluginSvelte,
1266
+ parserSvelte
1267
+ ] = await Promise.all([
1268
+ interopDefault(import('eslint-plugin-svelte')),
1269
+ interopDefault(import('svelte-eslint-parser'))
1270
+ ]);
1271
+ return [
1272
+ {
1273
+ name: "curev:svelte:setup",
1274
+ plugins: {
1275
+ svelte: pluginSvelte
1276
+ }
1277
+ },
1278
+ {
1279
+ files,
1280
+ languageOptions: {
1281
+ parser: parserSvelte,
1282
+ parserOptions: {
1283
+ extraFileExtensions: [".svelte"],
1284
+ parser: options.typescript ? await interopDefault(import('@typescript-eslint/parser')) : null
1285
+ }
1286
+ },
1287
+ name: "curev:svelte:rules",
1288
+ processor: pluginSvelte.processors[".svelte"],
1289
+ rules: {
1290
+ "import/no-mutable-exports": "off",
1291
+ "no-undef": "off",
1292
+ // incompatible with most recent (attribute-form) generic types RFC
1293
+ "no-unused-vars": ["error", {
1294
+ args: "none",
1295
+ caughtErrors: "none",
1296
+ ignoreRestSiblings: true,
1297
+ vars: "all",
1298
+ varsIgnorePattern: "^\\$\\$Props$"
1299
+ }],
1300
+ "svelte/comment-directive": "error",
1301
+ "svelte/no-at-debug-tags": "warn",
1302
+ "svelte/no-at-html-tags": "error",
1303
+ "svelte/no-dupe-else-if-blocks": "error",
1304
+ "svelte/no-dupe-style-properties": "error",
1305
+ "svelte/no-dupe-use-directives": "error",
1306
+ "svelte/no-dynamic-slot-name": "error",
1307
+ "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1308
+ "svelte/no-inner-declarations": "error",
1309
+ "svelte/no-not-function-handler": "error",
1310
+ "svelte/no-object-in-text-mustaches": "error",
1311
+ "svelte/no-reactive-functions": "error",
1312
+ "svelte/no-reactive-literals": "error",
1313
+ "svelte/no-shorthand-style-property-overrides": "error",
1314
+ "svelte/no-unknown-style-directive-property": "error",
1315
+ "svelte/no-unused-svelte-ignore": "error",
1316
+ "svelte/no-useless-mustaches": "error",
1317
+ "svelte/require-store-callbacks-use-set-param": "error",
1318
+ "svelte/system": "error",
1319
+ "svelte/valid-compile": "error",
1320
+ "svelte/valid-each-key": "error",
1321
+ "unused-imports/no-unused-vars": [
1322
+ "error",
1323
+ { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$)" }
1324
+ ],
1325
+ ...stylistic ? {
1326
+ "style/no-trailing-spaces": "off",
1327
+ // superseded by svelte/no-trailing-spaces
1328
+ "svelte/derived-has-same-inputs-outputs": "error",
1329
+ "svelte/html-closing-bracket-spacing": "error",
1330
+ "svelte/html-quotes": ["error", { prefer: quotes }],
1331
+ "svelte/indent": ["error", { alignAttributesVertically: true, indent }],
1332
+ "svelte/mustache-spacing": "error",
1333
+ "svelte/no-spaces-around-equal-signs-in-attribute": "error",
1334
+ "svelte/no-trailing-spaces": "error",
1335
+ "svelte/spaced-html-comment": "error"
1336
+ } : {},
1337
+ ...overrides
1338
+ }
1339
+ }
1340
+ ];
1341
+ }
1342
+
1343
+ async function test(options = {}) {
1344
+ const {
1345
+ files = GLOB_TESTS,
1346
+ isInEditor = false,
1347
+ overrides = {}
1348
+ } = options;
1349
+ const [
1350
+ pluginVitest,
1351
+ pluginNoOnlyTests
1352
+ ] = await Promise.all([
1353
+ interopDefault(import('eslint-plugin-vitest')),
1354
+ // @ts-expect-error missing types
1355
+ interopDefault(import('eslint-plugin-no-only-tests'))
1356
+ ]);
1357
+ return [
1358
+ {
1359
+ name: "curev:test:setup",
1360
+ plugins: {
1361
+ test: {
1362
+ ...pluginVitest,
1363
+ rules: {
1364
+ ...pluginVitest.rules,
1365
+ // extend `test/no-only-tests` rule
1366
+ ...pluginNoOnlyTests.rules
1367
+ }
1368
+ }
1369
+ }
1370
+ },
1371
+ {
1372
+ files,
1373
+ name: "curev:test:rules",
1374
+ rules: {
1375
+ "node/prefer-global/process": "off",
1376
+ "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1377
+ "test/no-identical-title": "error",
1378
+ "test/no-import-node-test": "error",
1379
+ "test/no-only-tests": isInEditor ? "off" : "error",
1380
+ "test/prefer-hooks-in-order": "error",
1381
+ "test/prefer-lowercase-title": "error",
1382
+ ...overrides
1383
+ }
1384
+ }
1385
+ ];
1386
+ }
1387
+
1388
+ async function typescript(options = {}) {
1389
+ const {
1390
+ componentExts = [],
1391
+ overrides = {},
1392
+ parserOptions = {}
1393
+ } = options;
1394
+ const files = options.files ?? [
1395
+ GLOB_SRC,
1396
+ ...componentExts.map((ext) => `**/*.${ext}`)
1397
+ ];
1398
+ const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1399
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1400
+ const isTypeAware = !!tsconfigPath;
1401
+ const typeAwareRules = {
1402
+ "dot-notation": "off",
1403
+ "no-implied-eval": "off",
1404
+ "no-throw-literal": "off",
1405
+ "ts/await-thenable": "error",
1406
+ "ts/dot-notation": ["error", { allowKeywords: true }],
1407
+ "ts/no-floating-promises": "error",
1408
+ "ts/no-for-in-array": "error",
1409
+ "ts/no-implied-eval": "error",
1410
+ "ts/no-misused-promises": "error",
1411
+ "ts/no-throw-literal": "error",
1412
+ "ts/no-unnecessary-type-assertion": "error",
1413
+ "ts/no-unsafe-argument": "error",
1414
+ "ts/no-unsafe-assignment": "error",
1415
+ "ts/no-unsafe-call": "error",
1416
+ "ts/no-unsafe-member-access": "error",
1417
+ "ts/no-unsafe-return": "error",
1418
+ "ts/restrict-plus-operands": "error",
1419
+ "ts/restrict-template-expressions": "error",
1420
+ "ts/unbound-method": "error"
1421
+ };
1422
+ const [
1423
+ pluginTs,
1424
+ parserTs
1425
+ ] = await Promise.all([
1426
+ interopDefault(import('@typescript-eslint/eslint-plugin')),
1427
+ interopDefault(import('@typescript-eslint/parser'))
1428
+ ]);
1429
+ function makeParser(typeAware, files2, ignores) {
1430
+ return {
1431
+ files: files2,
1432
+ ...ignores ? { ignores } : {},
1433
+ languageOptions: {
1434
+ parser: parserTs,
1435
+ parserOptions: {
1436
+ extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1437
+ sourceType: "module",
1438
+ ...typeAware ? {
1439
+ project: tsconfigPath,
1440
+ tsconfigRootDir: process__default.cwd()
1441
+ } : {},
1442
+ ...parserOptions
1443
+ }
1444
+ },
1445
+ name: `curev:typescript:${typeAware ? "type-aware-parser" : "parser"}`
1446
+ };
1447
+ }
1448
+ return [
1449
+ {
1450
+ // Install the plugins without globs, so they can be configured separately.
1451
+ name: "curev:typescript:setup",
1452
+ plugins: {
1453
+ curev: pluginCurev__default,
1454
+ ts: pluginTs
1455
+ }
1456
+ },
1457
+ // assign type-aware parser for type-aware files and type-unaware parser for the rest
1458
+ ...isTypeAware ? [
1459
+ makeParser(true, filesTypeAware),
1460
+ makeParser(false, files, filesTypeAware)
1461
+ ] : [makeParser(false, files)],
1462
+ {
1463
+ files,
1464
+ name: "curev:typescript:rules",
1465
+ rules: {
1466
+ ...renameRules(
1467
+ pluginTs.configs["eslint-recommended"].overrides[0].rules,
1468
+ "@typescript-eslint/",
1469
+ "ts/"
1470
+ ),
1471
+ ...renameRules(
1472
+ pluginTs.configs.strict.rules,
1473
+ "@typescript-eslint/",
1474
+ "ts/"
1475
+ ),
1476
+ "no-dupe-class-members": "off",
1477
+ "no-loss-of-precision": "off",
1478
+ "no-redeclare": "off",
1479
+ "no-use-before-define": "off",
1480
+ "no-useless-constructor": "off",
1481
+ "ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
1482
+ "ts/ban-types": ["error", { types: { Function: false } }],
1483
+ "ts/consistent-type-definitions": ["error", "interface"],
1484
+ "ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
1485
+ "ts/no-dupe-class-members": "error",
1486
+ "ts/no-dynamic-delete": "off",
1487
+ "ts/no-explicit-any": "off",
1488
+ "ts/no-extraneous-class": "off",
1489
+ "ts/no-import-type-side-effects": "error",
1490
+ "ts/no-invalid-void-type": "off",
1491
+ "ts/no-loss-of-precision": "error",
1492
+ "ts/no-non-null-assertion": "off",
1493
+ "ts/no-redeclare": "error",
1494
+ "ts/no-require-imports": "error",
1495
+ "ts/no-unused-vars": "off",
1496
+ "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
1497
+ "ts/no-useless-constructor": "off",
1498
+ "ts/prefer-ts-expect-error": "error",
1499
+ "ts/triple-slash-reference": "off",
1500
+ "ts/unified-signatures": "off",
1501
+ ...overrides
1502
+ }
1503
+ },
1504
+ {
1505
+ files: filesTypeAware,
1506
+ name: "curev:typescript:rules-type-aware",
1507
+ rules: {
1508
+ ...tsconfigPath ? typeAwareRules : {},
1509
+ ...overrides
1510
+ }
1511
+ },
1512
+ {
1513
+ files: ["**/*.d.ts"],
1514
+ name: "curev:typescript:dts-overrides",
1515
+ rules: {
1516
+ "eslint-comments/no-unlimited-disable": "off",
1517
+ "import/no-duplicates": "off",
1518
+ "no-restricted-syntax": "off",
1519
+ "unused-imports/no-unused-vars": "off"
1520
+ }
1521
+ },
1522
+ {
1523
+ files: ["**/*.{test,spec}.ts?(x)"],
1524
+ name: "curev:typescript:tests-overrides",
1525
+ rules: {
1526
+ "no-unused-expressions": "off"
1527
+ }
1528
+ },
1529
+ {
1530
+ files: ["**/*.js", "**/*.cjs"],
1531
+ name: "curev:typescript:javascript-overrides",
1532
+ rules: {
1533
+ "ts/no-require-imports": "off",
1534
+ "ts/no-var-requires": "off"
1535
+ }
1536
+ }
1537
+ ];
1538
+ }
1539
+
1540
+ async function unicorn() {
1541
+ return [
1542
+ {
1543
+ name: "curev:unicorn",
1544
+ plugins: {
1545
+ unicorn: pluginUnicorn__default
1546
+ },
1547
+ rules: {
1548
+ // Pass error message when throwing errors
1549
+ "unicorn/error-message": "error",
1550
+ // Uppercase regex escapes
1551
+ "unicorn/escape-case": "error",
1552
+ // Array.isArray instead of instanceof
1553
+ "unicorn/no-instanceof-array": "error",
1554
+ // Ban `new Array` as `Array` constructor's params are ambiguous
1555
+ "unicorn/no-new-array": "error",
1556
+ // Prevent deprecated `new Buffer()`
1557
+ "unicorn/no-new-buffer": "error",
1558
+ // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
1559
+ "unicorn/number-literal-case": "error",
1560
+ // textContent instead of innerText
1561
+ "unicorn/prefer-dom-node-text-content": "error",
1562
+ // includes over indexOf when checking for existence
1563
+ "unicorn/prefer-includes": "error",
1564
+ // Prefer using the node: protocol
1565
+ "unicorn/prefer-node-protocol": "error",
1566
+ // Prefer using number properties like `Number.isNaN` rather than `isNaN`
1567
+ "unicorn/prefer-number-properties": "error",
1568
+ // String methods startsWith/endsWith instead of more complicated stuff
1569
+ "unicorn/prefer-string-starts-ends-with": "error",
1570
+ // Enforce throwing type error when throwing error while checking typeof
1571
+ "unicorn/prefer-type-error": "error",
1572
+ // Use new when throwing error
1573
+ "unicorn/throw-new-error": "error"
1574
+ }
1575
+ }
1576
+ ];
1577
+ }
1578
+
1579
+ async function unocss(options = {}) {
1580
+ const {
1581
+ attributify = true,
1582
+ strict = false
1583
+ } = options;
1584
+ await ensurePackages([
1585
+ "@unocss/eslint-plugin"
1586
+ ]);
1587
+ const [
1588
+ pluginUnoCSS
1589
+ ] = await Promise.all([
1590
+ interopDefault(import('@unocss/eslint-plugin'))
1591
+ ]);
1592
+ return [
1593
+ {
1594
+ name: "curev:unocss",
1595
+ plugins: {
1596
+ unocss: pluginUnoCSS
1597
+ },
1598
+ rules: {
1599
+ "unocss/order": "warn",
1600
+ ...attributify ? {
1601
+ "unocss/order-attributify": "warn"
1602
+ } : {},
1603
+ ...strict ? {
1604
+ "unocss/blocklist": "error"
1605
+ } : {}
1606
+ }
1607
+ }
1608
+ ];
1609
+ }
1610
+
1611
+ async function vue(options = {}) {
1612
+ const {
1613
+ files = [GLOB_VUE],
1614
+ overrides = {},
1615
+ stylistic = true,
1616
+ vueVersion = 3
1617
+ } = options;
1618
+ const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
1619
+ const {
1620
+ indent = 2
1621
+ } = typeof stylistic === "boolean" ? {} : stylistic;
1622
+ const [
1623
+ pluginVue,
1624
+ parserVue,
1625
+ processorVueBlocks
1626
+ ] = await Promise.all([
1627
+ // @ts-expect-error missing types
1628
+ interopDefault(import('eslint-plugin-vue')),
1629
+ interopDefault(import('vue-eslint-parser')),
1630
+ interopDefault(import('eslint-processor-vue-blocks'))
1631
+ ]);
1632
+ return [
1633
+ {
1634
+ name: "curev:vue:setup",
1635
+ plugins: {
1636
+ vue: pluginVue
1637
+ }
1638
+ },
1639
+ {
1640
+ files,
1641
+ languageOptions: {
1642
+ parser: parserVue,
1643
+ parserOptions: {
1644
+ ecmaFeatures: {
1645
+ jsx: true
1646
+ },
1647
+ extraFileExtensions: [".vue"],
1648
+ parser: options.typescript ? await interopDefault(import('@typescript-eslint/parser')) : null,
1649
+ sourceType: "module"
1650
+ }
1651
+ },
1652
+ name: "curev:vue:rules",
1653
+ processor: sfcBlocks === false ? pluginVue.processors[".vue"] : eslintMergeProcessors.mergeProcessors([
1654
+ pluginVue.processors[".vue"],
1655
+ processorVueBlocks({
1656
+ ...sfcBlocks,
1657
+ blocks: {
1658
+ styles: true,
1659
+ ...sfcBlocks.blocks
1660
+ }
1661
+ })
1662
+ ]),
1663
+ rules: {
1664
+ ...pluginVue.configs.base.rules,
1665
+ ...vueVersion === 2 ? {
1666
+ ...pluginVue.configs.essential.rules,
1667
+ ...pluginVue.configs["strongly-recommended"].rules,
1668
+ ...pluginVue.configs.recommended.rules
1669
+ } : {
1670
+ ...pluginVue.configs["vue3-essential"].rules,
1671
+ ...pluginVue.configs["vue3-strongly-recommended"].rules,
1672
+ ...pluginVue.configs["vue3-recommended"].rules
1673
+ },
1674
+ "node/prefer-global/process": "off",
1675
+ "vue/block-order": ["error", {
1676
+ order: ["script", "template", "style"]
1677
+ }],
1678
+ "vue/component-name-in-template-casing": ["error", "PascalCase"],
1679
+ "vue/component-options-name-casing": ["error", "PascalCase"],
1680
+ // this is deprecated
1681
+ "vue/component-tags-order": "off",
1682
+ "vue/custom-event-name-casing": ["error", "camelCase"],
1683
+ "vue/define-macros-order": ["error", {
1684
+ order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
1685
+ }],
1686
+ "vue/dot-location": ["error", "property"],
1687
+ "vue/dot-notation": ["error", { allowKeywords: true }],
1688
+ "vue/eqeqeq": ["error", "smart"],
1689
+ "vue/html-indent": ["error", indent],
1690
+ "vue/html-quotes": ["error", "double"],
1691
+ "vue/max-attributes-per-line": "off",
1692
+ "vue/multi-word-component-names": "off",
1693
+ "vue/no-dupe-keys": "off",
1694
+ "vue/no-empty-pattern": "error",
1695
+ "vue/no-irregular-whitespace": "error",
1696
+ "vue/no-loss-of-precision": "error",
1697
+ "vue/no-restricted-syntax": [
1698
+ "error",
1699
+ "DebuggerStatement",
1700
+ "LabeledStatement",
1701
+ "WithStatement"
1702
+ ],
1703
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
1704
+ "vue/no-setup-props-reactivity-loss": "off",
1705
+ "vue/no-sparse-arrays": "error",
1706
+ "vue/no-unused-refs": "error",
1707
+ "vue/no-useless-v-bind": "error",
1708
+ "vue/no-v-html": "off",
1709
+ "vue/object-shorthand": [
1710
+ "error",
1711
+ "always",
1712
+ {
1713
+ avoidQuotes: true,
1714
+ ignoreConstructors: false
1715
+ }
1716
+ ],
1717
+ "vue/prefer-separate-static-class": "error",
1718
+ "vue/prefer-template": "error",
1719
+ "vue/prop-name-casing": ["error", "camelCase"],
1720
+ "vue/require-default-prop": "off",
1721
+ "vue/require-prop-types": "off",
1722
+ "vue/space-infix-ops": "error",
1723
+ "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
1724
+ ...stylistic ? {
1725
+ "vue/array-bracket-spacing": ["error", "never"],
1726
+ "vue/arrow-spacing": ["error", { after: true, before: true }],
1727
+ "vue/block-spacing": ["error", "always"],
1728
+ "vue/block-tag-newline": ["error", {
1729
+ multiline: "always",
1730
+ singleline: "always"
1731
+ }],
1732
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
1733
+ "vue/comma-dangle": ["error", "always-multiline"],
1734
+ "vue/comma-spacing": ["error", { after: true, before: false }],
1735
+ "vue/comma-style": ["error", "last"],
1736
+ "vue/html-comment-content-spacing": ["error", "always", {
1737
+ exceptions: ["-"]
1738
+ }],
1739
+ "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1740
+ "vue/keyword-spacing": ["error", { after: true, before: true }],
1741
+ "vue/object-curly-newline": "off",
1742
+ "vue/object-curly-spacing": ["error", "always"],
1743
+ "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
1744
+ "vue/operator-linebreak": ["error", "before"],
1745
+ "vue/padding-line-between-blocks": ["error", "always"],
1746
+ "vue/quote-props": ["error", "consistent-as-needed"],
1747
+ "vue/space-in-parens": ["error", "never"],
1748
+ "vue/template-curly-spacing": "error"
1749
+ } : {},
1750
+ ...overrides
1751
+ }
1752
+ }
1753
+ ];
1754
+ }
1755
+
1756
+ async function yaml(options = {}) {
1757
+ const {
1758
+ files = [GLOB_YAML],
1759
+ overrides = {},
1760
+ stylistic = true
1761
+ } = options;
1762
+ const {
1763
+ indent = 2,
1764
+ quotes = "single"
1765
+ } = typeof stylistic === "boolean" ? {} : stylistic;
1766
+ const [
1767
+ pluginYaml,
1768
+ parserYaml
1769
+ ] = await Promise.all([
1770
+ interopDefault(import('eslint-plugin-yml')),
1771
+ interopDefault(import('yaml-eslint-parser'))
1772
+ ]);
1773
+ return [
1774
+ {
1775
+ name: "curev:yaml:setup",
1776
+ plugins: {
1777
+ yaml: pluginYaml
1778
+ }
1779
+ },
1780
+ {
1781
+ files,
1782
+ languageOptions: {
1783
+ parser: parserYaml
1784
+ },
1785
+ name: "curev:yaml:rules",
1786
+ rules: {
1787
+ "style/spaced-comment": "off",
1788
+ "yaml/block-mapping": "error",
1789
+ "yaml/block-sequence": "error",
1790
+ "yaml/no-empty-key": "error",
1791
+ "yaml/no-empty-sequence-entry": "error",
1792
+ "yaml/no-irregular-whitespace": "error",
1793
+ "yaml/plain-scalar": "error",
1794
+ "yaml/vue-custom-block/no-parsing-error": "error",
1795
+ ...stylistic ? {
1796
+ "yaml/block-mapping-question-indicator-newline": "error",
1797
+ "yaml/block-sequence-hyphen-indicator-newline": "error",
1798
+ "yaml/flow-mapping-curly-newline": "error",
1799
+ "yaml/flow-mapping-curly-spacing": "error",
1800
+ "yaml/flow-sequence-bracket-newline": "error",
1801
+ "yaml/flow-sequence-bracket-spacing": "error",
1802
+ "yaml/indent": ["error", indent === "tab" ? 2 : indent],
1803
+ "yaml/key-spacing": "error",
1804
+ "yaml/no-tab-indent": "error",
1805
+ "yaml/quotes": ["error", { avoidEscape: false, prefer: quotes }],
1806
+ "yaml/spaced-comment": "error"
1807
+ } : {},
1808
+ ...overrides
1809
+ }
1810
+ }
1811
+ ];
1812
+ }
1813
+
1814
+ async function toml(options = {}) {
1815
+ const {
1816
+ files = [GLOB_TOML],
1817
+ overrides = {},
1818
+ stylistic = true
1819
+ } = options;
1820
+ const {
1821
+ indent = 2
1822
+ } = typeof stylistic === "boolean" ? {} : stylistic;
1823
+ const [
1824
+ pluginToml,
1825
+ parserToml
1826
+ ] = await Promise.all([
1827
+ interopDefault(import('eslint-plugin-toml')),
1828
+ interopDefault(import('toml-eslint-parser'))
1829
+ ]);
1830
+ return [
1831
+ {
1832
+ name: "curev:toml:setup",
1833
+ plugins: {
1834
+ toml: pluginToml
1835
+ }
1836
+ },
1837
+ {
1838
+ files,
1839
+ languageOptions: {
1840
+ parser: parserToml
1841
+ },
1842
+ name: "curev:toml:rules",
1843
+ rules: {
1844
+ "style/spaced-comment": "off",
1845
+ "toml/comma-style": "error",
1846
+ "toml/keys-order": "error",
1847
+ "toml/no-space-dots": "error",
1848
+ "toml/no-unreadable-number-separator": "error",
1849
+ "toml/precision-of-fractional-seconds": "error",
1850
+ "toml/precision-of-integer": "error",
1851
+ "toml/tables-order": "error",
1852
+ "toml/vue-custom-block/no-parsing-error": "error",
1853
+ ...stylistic ? {
1854
+ "toml/array-bracket-newline": "error",
1855
+ "toml/array-bracket-spacing": "error",
1856
+ "toml/array-element-newline": "error",
1857
+ "toml/indent": ["error", indent === "tab" ? 2 : indent],
1858
+ "toml/inline-table-curly-spacing": "error",
1859
+ "toml/key-spacing": "error",
1860
+ "toml/padding-line-between-pairs": "error",
1861
+ "toml/padding-line-between-tables": "error",
1862
+ "toml/quoted-keys": "error",
1863
+ "toml/spaced-comment": "error",
1864
+ "toml/table-bracket-spacing": "error"
1865
+ } : {},
1866
+ ...overrides
1867
+ }
1868
+ }
1869
+ ];
1870
+ }
1871
+
1872
+ const flatConfigProps = [
1873
+ "name",
1874
+ "files",
1875
+ "ignores",
1876
+ "languageOptions",
1877
+ "linterOptions",
1878
+ "processor",
1879
+ "plugins",
1880
+ "rules",
1881
+ "settings"
1882
+ ];
1883
+ const VuePackages = [
1884
+ "vue",
1885
+ "nuxt",
1886
+ "vitepress",
1887
+ "@slidev/cli"
1888
+ ];
1889
+ async function curev(options = {}, ...userConfigs) {
1890
+ const {
1891
+ componentExts = [],
1892
+ gitignore: enableGitignore = true,
1893
+ isInEditor = !!((process__default.env.VSCODE_PID || process__default.env.JETBRAINS_IDE || process__default.env.VIM) && !process__default.env.CI),
1894
+ react: enableReact = false,
1895
+ svelte: enableSvelte = false,
1896
+ typescript: enableTypeScript = localPkg.isPackageExists("typescript"),
1897
+ unocss: enableUnoCSS = false,
1898
+ vue: enableVue = VuePackages.some((i) => localPkg.isPackageExists(i))
1899
+ } = options;
1900
+ const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
1901
+ if (stylisticOptions && !("jsx" in stylisticOptions)) {
1902
+ stylisticOptions.jsx = options.jsx ?? true;
1903
+ }
1904
+ const configs = [];
1905
+ if (enableGitignore) {
1906
+ if (typeof enableGitignore !== "boolean") {
1907
+ configs.push(interopDefault(import('eslint-config-flat-gitignore')).then((r) => [r(enableGitignore)]));
1908
+ } else {
1909
+ if (fs__default.existsSync(".gitignore")) {
1910
+ configs.push(interopDefault(import('eslint-config-flat-gitignore')).then((r) => [r()]));
1911
+ }
1912
+ }
1913
+ }
1914
+ configs.push(
1915
+ ignores(),
1916
+ javascript({
1917
+ isInEditor,
1918
+ overrides: getOverrides(options, "javascript")
1919
+ }),
1920
+ comments(),
1921
+ node(),
1922
+ jsdoc({
1923
+ stylistic: stylisticOptions
1924
+ }),
1925
+ imports({
1926
+ stylistic: stylisticOptions
1927
+ }),
1928
+ unicorn(),
1929
+ // Optional plugins (installed but not enabled by default)
1930
+ perfectionist()
1931
+ );
1932
+ if (enableVue) {
1933
+ componentExts.push("vue");
1934
+ }
1935
+ if (enableTypeScript) {
1936
+ configs.push(typescript({
1937
+ ...resolveSubOptions(options, "typescript"),
1938
+ componentExts,
1939
+ overrides: getOverrides(options, "typescript")
1940
+ }));
1941
+ }
1942
+ if (stylisticOptions) {
1943
+ configs.push(stylistic({
1944
+ ...stylisticOptions,
1945
+ overrides: getOverrides(options, "stylistic")
1946
+ }));
1947
+ }
1948
+ if (options.test ?? true) {
1949
+ configs.push(test({
1950
+ isInEditor,
1951
+ overrides: getOverrides(options, "test")
1952
+ }));
1953
+ }
1954
+ if (enableVue) {
1955
+ configs.push(vue({
1956
+ ...resolveSubOptions(options, "vue"),
1957
+ overrides: getOverrides(options, "vue"),
1958
+ stylistic: stylisticOptions,
1959
+ typescript: !!enableTypeScript
1960
+ }));
1961
+ }
1962
+ if (enableReact) {
1963
+ configs.push(react({
1964
+ overrides: getOverrides(options, "react"),
1965
+ typescript: !!enableTypeScript
1966
+ }));
1967
+ }
1968
+ if (enableSvelte) {
1969
+ configs.push(svelte({
1970
+ overrides: getOverrides(options, "svelte"),
1971
+ stylistic: stylisticOptions,
1972
+ typescript: !!enableTypeScript
1973
+ }));
1974
+ }
1975
+ if (enableUnoCSS) {
1976
+ configs.push(unocss({
1977
+ ...resolveSubOptions(options, "unocss"),
1978
+ overrides: getOverrides(options, "unocss")
1979
+ }));
1980
+ }
1981
+ if (options.jsonc ?? true) {
1982
+ configs.push(
1983
+ jsonc({
1984
+ overrides: getOverrides(options, "jsonc"),
1985
+ stylistic: stylisticOptions
1986
+ }),
1987
+ sortPackageJson(),
1988
+ sortTsconfig()
1989
+ );
1990
+ }
1991
+ if (options.yaml ?? true) {
1992
+ configs.push(yaml({
1993
+ overrides: getOverrides(options, "yaml"),
1994
+ stylistic: stylisticOptions
1995
+ }));
1996
+ }
1997
+ if (options.toml ?? true) {
1998
+ configs.push(toml({
1999
+ overrides: getOverrides(options, "toml"),
2000
+ stylistic: stylisticOptions
2001
+ }));
2002
+ }
2003
+ if (options.markdown ?? true) {
2004
+ configs.push(
2005
+ markdown(
2006
+ {
2007
+ componentExts,
2008
+ overrides: getOverrides(options, "markdown")
2009
+ }
2010
+ )
2011
+ );
2012
+ }
2013
+ if (options.formatters) {
2014
+ configs.push(formatters(
2015
+ options.formatters,
2016
+ typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2017
+ ));
2018
+ }
2019
+ const fusedConfig = flatConfigProps.reduce((acc, key) => {
2020
+ if (key in options) {
2021
+ acc[key] = options[key];
2022
+ }
2023
+ return acc;
2024
+ }, {});
2025
+ if (Object.keys(fusedConfig).length) {
2026
+ configs.push([fusedConfig]);
2027
+ }
2028
+ const merged = combine(
2029
+ ...configs,
2030
+ ...userConfigs
2031
+ );
2032
+ return merged;
2033
+ }
2034
+ function resolveSubOptions(options, key) {
2035
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
2036
+ }
2037
+ function getOverrides(options, key) {
2038
+ const sub = resolveSubOptions(options, key);
2039
+ return {
2040
+ ...options.overrides?.[key],
2041
+ ..."overrides" in sub ? sub.overrides : {}
2042
+ };
2043
+ }
2044
+
2045
+ exports.GLOB_ALL_SRC = GLOB_ALL_SRC;
2046
+ exports.GLOB_CSS = GLOB_CSS;
2047
+ exports.GLOB_EXCLUDE = GLOB_EXCLUDE;
2048
+ exports.GLOB_HTML = GLOB_HTML;
2049
+ exports.GLOB_JS = GLOB_JS;
2050
+ exports.GLOB_JSON = GLOB_JSON;
2051
+ exports.GLOB_JSON5 = GLOB_JSON5;
2052
+ exports.GLOB_JSONC = GLOB_JSONC;
2053
+ exports.GLOB_JSX = GLOB_JSX;
2054
+ exports.GLOB_LESS = GLOB_LESS;
2055
+ exports.GLOB_MARKDOWN = GLOB_MARKDOWN;
2056
+ exports.GLOB_MARKDOWN_CODE = GLOB_MARKDOWN_CODE;
2057
+ exports.GLOB_MARKDOWN_IN_MARKDOWN = GLOB_MARKDOWN_IN_MARKDOWN;
2058
+ exports.GLOB_POSTCSS = GLOB_POSTCSS;
2059
+ exports.GLOB_SCSS = GLOB_SCSS;
2060
+ exports.GLOB_SRC = GLOB_SRC;
2061
+ exports.GLOB_SRC_EXT = GLOB_SRC_EXT;
2062
+ exports.GLOB_STYLE = GLOB_STYLE;
2063
+ exports.GLOB_SVELTE = GLOB_SVELTE;
2064
+ exports.GLOB_TESTS = GLOB_TESTS;
2065
+ exports.GLOB_TOML = GLOB_TOML;
2066
+ exports.GLOB_TS = GLOB_TS;
2067
+ exports.GLOB_TSX = GLOB_TSX;
2068
+ exports.GLOB_VUE = GLOB_VUE;
2069
+ exports.GLOB_YAML = GLOB_YAML;
2070
+ exports.StylisticConfigDefaults = StylisticConfigDefaults;
2071
+ exports.combine = combine;
2072
+ exports.comments = comments;
2073
+ exports.curev = curev;
2074
+ exports.default = curev;
2075
+ exports.ensurePackages = ensurePackages;
2076
+ exports.formatters = formatters;
2077
+ exports.getOverrides = getOverrides;
2078
+ exports.ignores = ignores;
2079
+ exports.imports = imports;
2080
+ exports.interopDefault = interopDefault;
2081
+ exports.javascript = javascript;
2082
+ exports.jsdoc = jsdoc;
2083
+ exports.jsonc = jsonc;
2084
+ exports.markdown = markdown;
2085
+ exports.node = node;
2086
+ exports.parserPlain = parserPlain;
2087
+ exports.perfectionist = perfectionist;
2088
+ exports.react = react;
2089
+ exports.renameRules = renameRules;
2090
+ exports.resolveSubOptions = resolveSubOptions;
2091
+ exports.sortPackageJson = sortPackageJson;
2092
+ exports.sortTsconfig = sortTsconfig;
2093
+ exports.stylistic = stylistic;
2094
+ exports.svelte = svelte;
2095
+ exports.test = test;
2096
+ exports.toArray = toArray;
2097
+ exports.toml = toml;
2098
+ exports.typescript = typescript;
2099
+ exports.unicorn = unicorn;
2100
+ exports.unocss = unocss;
2101
+ exports.vue = vue;
2102
+ exports.yaml = yaml;