@2030/eslint-config 0.0.7 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,2703 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ GLOB_ALL_SRC: () => GLOB_ALL_SRC,
34
+ GLOB_ASTRO: () => GLOB_ASTRO,
35
+ GLOB_ASTRO_TS: () => GLOB_ASTRO_TS,
36
+ GLOB_CSS: () => GLOB_CSS,
37
+ GLOB_EXCLUDE: () => GLOB_EXCLUDE,
38
+ GLOB_GRAPHQL: () => GLOB_GRAPHQL,
39
+ GLOB_HTML: () => GLOB_HTML,
40
+ GLOB_JS: () => GLOB_JS,
41
+ GLOB_JSON: () => GLOB_JSON,
42
+ GLOB_JSON5: () => GLOB_JSON5,
43
+ GLOB_JSONC: () => GLOB_JSONC,
44
+ GLOB_JSX: () => GLOB_JSX,
45
+ GLOB_LESS: () => GLOB_LESS,
46
+ GLOB_MARKDOWN: () => GLOB_MARKDOWN,
47
+ GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
48
+ GLOB_MARKDOWN_IN_MARKDOWN: () => GLOB_MARKDOWN_IN_MARKDOWN,
49
+ GLOB_POSTCSS: () => GLOB_POSTCSS,
50
+ GLOB_SCSS: () => GLOB_SCSS,
51
+ GLOB_SRC: () => GLOB_SRC,
52
+ GLOB_SRC_EXT: () => GLOB_SRC_EXT,
53
+ GLOB_STYLE: () => GLOB_STYLE,
54
+ GLOB_SVELTE: () => GLOB_SVELTE,
55
+ GLOB_SVG: () => GLOB_SVG,
56
+ GLOB_TESTS: () => GLOB_TESTS,
57
+ GLOB_TOML: () => GLOB_TOML,
58
+ GLOB_TS: () => GLOB_TS,
59
+ GLOB_TSX: () => GLOB_TSX,
60
+ GLOB_VUE: () => GLOB_VUE,
61
+ GLOB_XML: () => GLOB_XML,
62
+ GLOB_YAML: () => GLOB_YAML,
63
+ StylisticConfigDefaults: () => StylisticConfigDefaults,
64
+ astro: () => astro,
65
+ combine: () => combine,
66
+ command: () => command,
67
+ comments: () => comments,
68
+ default: () => src_default,
69
+ defaultPluginRenaming: () => defaultPluginRenaming,
70
+ ensurePackages: () => ensurePackages,
71
+ formatters: () => formatters,
72
+ getOverrides: () => getOverrides,
73
+ ignores: () => ignores,
74
+ imports: () => imports,
75
+ interopDefault: () => interopDefault,
76
+ isInEditorEnv: () => isInEditorEnv,
77
+ isInGitHooksOrLintStaged: () => isInGitHooksOrLintStaged,
78
+ isPackageInScope: () => isPackageInScope,
79
+ javascript: () => javascript,
80
+ jsdoc: () => jsdoc,
81
+ jsonc: () => jsonc,
82
+ jsx: () => jsx,
83
+ jun: () => jun,
84
+ markdown: () => markdown,
85
+ node: () => node,
86
+ parserPlain: () => parserPlain,
87
+ perfectionist: () => perfectionist,
88
+ react: () => react,
89
+ regexp: () => regexp,
90
+ renamePluginInConfigs: () => renamePluginInConfigs,
91
+ renameRules: () => renameRules,
92
+ resolveSubOptions: () => resolveSubOptions,
93
+ solid: () => solid,
94
+ sortPackageJson: () => sortPackageJson,
95
+ sortTsconfig: () => sortTsconfig,
96
+ stylistic: () => stylistic,
97
+ svelte: () => svelte,
98
+ test: () => test,
99
+ toArray: () => toArray,
100
+ toml: () => toml,
101
+ typescript: () => typescript,
102
+ unicorn: () => unicorn,
103
+ unocss: () => unocss,
104
+ vue: () => vue,
105
+ yaml: () => yaml
106
+ });
107
+ module.exports = __toCommonJS(src_exports);
108
+
109
+ // node_modules/.pnpm/tsup@8.2.4_5ofm35yyure5wtaajtea4uq2pa/node_modules/tsup/assets/cjs_shims.js
110
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
111
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
112
+
113
+ // src/factory.ts
114
+ var import_local_pkg4 = require("local-pkg");
115
+ var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
116
+
117
+ // src/globs.ts
118
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
119
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
120
+ var GLOB_JS = "**/*.?([cm])js";
121
+ var GLOB_JSX = "**/*.?([cm])jsx";
122
+ var GLOB_TS = "**/*.?([cm])ts";
123
+ var GLOB_TSX = "**/*.?([cm])tsx";
124
+ var GLOB_STYLE = "**/*.{c,le,sc}ss";
125
+ var GLOB_CSS = "**/*.css";
126
+ var GLOB_POSTCSS = "**/*.{p,post}css";
127
+ var GLOB_LESS = "**/*.less";
128
+ var GLOB_SCSS = "**/*.scss";
129
+ var GLOB_JSON = "**/*.json";
130
+ var GLOB_JSON5 = "**/*.json5";
131
+ var GLOB_JSONC = "**/*.jsonc";
132
+ var GLOB_MARKDOWN = "**/*.md";
133
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
134
+ var GLOB_SVELTE = "**/*.svelte";
135
+ var GLOB_VUE = "**/*.vue";
136
+ var GLOB_YAML = "**/*.y?(a)ml";
137
+ var GLOB_TOML = "**/*.toml";
138
+ var GLOB_XML = "**/*.xml";
139
+ var GLOB_SVG = "**/*.svg";
140
+ var GLOB_HTML = "**/*.htm?(l)";
141
+ var GLOB_ASTRO = "**/*.astro";
142
+ var GLOB_ASTRO_TS = "**/*.astro/*.ts";
143
+ var GLOB_GRAPHQL = "**/*.{g,graph}ql";
144
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
145
+ var GLOB_TESTS = [
146
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
147
+ `**/*.spec.${GLOB_SRC_EXT}`,
148
+ `**/*.test.${GLOB_SRC_EXT}`,
149
+ `**/*.bench.${GLOB_SRC_EXT}`,
150
+ `**/*.benchmark.${GLOB_SRC_EXT}`
151
+ ];
152
+ var GLOB_ALL_SRC = [
153
+ GLOB_SRC,
154
+ GLOB_STYLE,
155
+ GLOB_JSON,
156
+ GLOB_JSON5,
157
+ GLOB_MARKDOWN,
158
+ GLOB_SVELTE,
159
+ GLOB_VUE,
160
+ GLOB_YAML,
161
+ GLOB_XML,
162
+ GLOB_HTML
163
+ ];
164
+ var GLOB_EXCLUDE = [
165
+ "**/node_modules",
166
+ "**/dist",
167
+ "**/package-lock.json",
168
+ "**/yarn.lock",
169
+ "**/pnpm-lock.yaml",
170
+ "**/bun.lockb",
171
+ "**/output",
172
+ "**/coverage",
173
+ "**/temp",
174
+ "**/.temp",
175
+ "**/tmp",
176
+ "**/.tmp",
177
+ "**/.history",
178
+ "**/.vitepress/cache",
179
+ "**/.nuxt",
180
+ "**/.next",
181
+ "**/.svelte-kit",
182
+ "**/.vercel",
183
+ "**/.changeset",
184
+ "**/.idea",
185
+ "**/.cache",
186
+ "**/.output",
187
+ "**/.vite-inspect",
188
+ "**/.yarn",
189
+ "**/vite.config.*.timestamp-*",
190
+ "**/CHANGELOG*.md",
191
+ "**/*.min.*",
192
+ "**/LICENSE*",
193
+ "**/__snapshots__",
194
+ "**/auto-import?(s).d.ts",
195
+ "**/components.d.ts"
196
+ ];
197
+
198
+ // src/utils.ts
199
+ var import_node_process = __toESM(require("process"), 1);
200
+ var import_node_url = require("url");
201
+ var import_local_pkg = require("local-pkg");
202
+ var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
203
+ var isCwdInScope = (0, import_local_pkg.isPackageExists)("@2030/eslint-config");
204
+ var parserPlain = {
205
+ meta: {
206
+ name: "parser-plain"
207
+ },
208
+ parseForESLint: (code) => ({
209
+ ast: {
210
+ body: [],
211
+ comments: [],
212
+ loc: { end: code.length, start: 0 },
213
+ range: [0, code.length],
214
+ tokens: [],
215
+ type: "Program"
216
+ },
217
+ scopeManager: null,
218
+ services: { isPlain: true },
219
+ visitorKeys: {
220
+ Program: []
221
+ }
222
+ })
223
+ };
224
+ async function combine(...configs2) {
225
+ const resolved = await Promise.all(configs2);
226
+ return resolved.flat();
227
+ }
228
+ function renameRules(rules, map) {
229
+ return Object.fromEntries(
230
+ Object.entries(rules).map(([key, value]) => {
231
+ for (const [from, to] of Object.entries(map)) {
232
+ if (key.startsWith(`${from}/`))
233
+ return [to + key.slice(from.length), value];
234
+ }
235
+ return [key, value];
236
+ })
237
+ );
238
+ }
239
+ function renamePluginInConfigs(configs2, map) {
240
+ return configs2.map((i) => {
241
+ const clone = { ...i };
242
+ if (clone.rules)
243
+ clone.rules = renameRules(clone.rules, map);
244
+ if (clone.plugins) {
245
+ clone.plugins = Object.fromEntries(
246
+ Object.entries(clone.plugins).map(([key, value]) => {
247
+ if (key in map)
248
+ return [map[key], value];
249
+ return [key, value];
250
+ })
251
+ );
252
+ }
253
+ return clone;
254
+ });
255
+ }
256
+ function toArray(value) {
257
+ return Array.isArray(value) ? value : [value];
258
+ }
259
+ async function interopDefault(m) {
260
+ const resolved = await m;
261
+ return resolved.default || resolved;
262
+ }
263
+ function isPackageInScope(name) {
264
+ return (0, import_local_pkg.isPackageExists)(name, { paths: [scopeUrl] });
265
+ }
266
+ async function ensurePackages(packages) {
267
+ if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false || isCwdInScope === false)
268
+ return;
269
+ const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
270
+ if (nonExistingPackages.length === 0)
271
+ return;
272
+ const p = await import("@clack/prompts");
273
+ const result = await p.confirm({
274
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
275
+ });
276
+ if (result)
277
+ await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
278
+ }
279
+ function isInEditorEnv() {
280
+ if (import_node_process.default.env.CI)
281
+ return false;
282
+ if (isInGitHooksOrLintStaged())
283
+ return false;
284
+ return !!import_node_process.default.env.VSCODE_PID || !!import_node_process.default.env.VSCODE_CWD || !!import_node_process.default.env.JETBRAINS_IDE || !!import_node_process.default.env.VIM || !!import_node_process.default.env.NVIM;
285
+ }
286
+ function isInGitHooksOrLintStaged() {
287
+ return !!import_node_process.default.env.GIT_PARAMS || !!import_node_process.default.env.VSCODE_GIT_COMMAND || !!import_node_process.default.env.npm_lifecycle_script?.startsWith("lint-staged");
288
+ }
289
+
290
+ // src/configs/astro.ts
291
+ async function astro(options = {}) {
292
+ const {
293
+ files = [GLOB_ASTRO],
294
+ overrides = {},
295
+ stylistic: stylistic2 = true
296
+ } = options;
297
+ const [
298
+ pluginAstro,
299
+ parserAstro,
300
+ parserTs
301
+ ] = await Promise.all([
302
+ interopDefault(import("eslint-plugin-astro")),
303
+ interopDefault(import("astro-eslint-parser")),
304
+ interopDefault(import("@typescript-eslint/parser"))
305
+ ]);
306
+ return [
307
+ {
308
+ name: "jun/astro/setup",
309
+ plugins: {
310
+ astro: pluginAstro
311
+ }
312
+ },
313
+ {
314
+ files,
315
+ languageOptions: {
316
+ globals: pluginAstro.environments.astro.globals,
317
+ parser: parserAstro,
318
+ parserOptions: {
319
+ extraFileExtensions: [".astro"],
320
+ parser: parserTs
321
+ },
322
+ sourceType: "module"
323
+ },
324
+ name: "jun/astro/rules",
325
+ processor: "astro/client-side-ts",
326
+ rules: {
327
+ // use recommended rules
328
+ "astro/missing-client-only-directive-value": "error",
329
+ "astro/no-conflict-set-directives": "error",
330
+ "astro/no-deprecated-astro-canonicalurl": "error",
331
+ "astro/no-deprecated-astro-fetchcontent": "error",
332
+ "astro/no-deprecated-astro-resolve": "error",
333
+ "astro/no-deprecated-getentrybyslug": "error",
334
+ "astro/no-set-html-directive": "off",
335
+ "astro/no-unused-define-vars-in-style": "error",
336
+ "astro/semi": "off",
337
+ "astro/valid-compile": "error",
338
+ ...stylistic2 ? {
339
+ "style/indent": "off",
340
+ "style/jsx-closing-tag-location": "off",
341
+ "style/jsx-indent": "off",
342
+ "style/jsx-one-expression-per-line": "off",
343
+ "style/no-multiple-empty-lines": "off"
344
+ } : {},
345
+ ...overrides
346
+ }
347
+ }
348
+ ];
349
+ }
350
+
351
+ // src/configs/command.ts
352
+ var import_config = __toESM(require("eslint-plugin-command/config"), 1);
353
+ async function command() {
354
+ return [
355
+ {
356
+ ...(0, import_config.default)(),
357
+ name: "jun/command/rules"
358
+ }
359
+ ];
360
+ }
361
+
362
+ // src/plugins.ts
363
+ var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
364
+ var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
365
+ var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
366
+ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
367
+ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
368
+ var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
369
+ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
370
+
371
+ // src/configs/comments.ts
372
+ async function comments() {
373
+ return [
374
+ {
375
+ name: "jun/eslint-comments/rules",
376
+ plugins: {
377
+ "eslint-comments": import_eslint_plugin_eslint_comments.default
378
+ },
379
+ rules: {
380
+ "eslint-comments/no-aggregating-enable": "error",
381
+ "eslint-comments/no-duplicate-disable": "error",
382
+ "eslint-comments/no-unlimited-disable": "error",
383
+ "eslint-comments/no-unused-enable": "error"
384
+ }
385
+ }
386
+ ];
387
+ }
388
+
389
+ // src/configs/formatters.ts
390
+ var import_local_pkg2 = require("local-pkg");
391
+
392
+ // src/configs/stylistic.ts
393
+ var StylisticConfigDefaults = {
394
+ indent: 2,
395
+ jsx: true,
396
+ quotes: "single",
397
+ semi: false
398
+ };
399
+ async function stylistic(options = {}) {
400
+ const {
401
+ indent,
402
+ jsx: jsx2,
403
+ lessOpinionated = false,
404
+ overrides = {},
405
+ quotes,
406
+ semi
407
+ } = {
408
+ ...StylisticConfigDefaults,
409
+ ...options
410
+ };
411
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
412
+ const config = pluginStylistic.configs.customize({
413
+ flat: true,
414
+ indent,
415
+ jsx: jsx2,
416
+ pluginName: "style",
417
+ quotes,
418
+ semi
419
+ });
420
+ return [
421
+ {
422
+ name: "jun/stylistic/rules",
423
+ plugins: {
424
+ jun: import_eslint_plugin_antfu.default,
425
+ style: pluginStylistic
426
+ },
427
+ rules: {
428
+ ...config.rules,
429
+ "jun/consistent-list-newline": "error",
430
+ ...lessOpinionated ? {
431
+ curly: ["error", "all"]
432
+ } : {
433
+ "jun/curly": "error",
434
+ "jun/if-newline": "error",
435
+ "jun/top-level-function": "error"
436
+ },
437
+ ...overrides
438
+ }
439
+ }
440
+ ];
441
+ }
442
+
443
+ // src/configs/formatters.ts
444
+ async function formatters(options = {}, stylistic2 = {}) {
445
+ if (options === true) {
446
+ const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
447
+ options = {
448
+ astro: isPackageInScope("prettier-plugin-astro"),
449
+ css: true,
450
+ graphql: true,
451
+ html: true,
452
+ markdown: true,
453
+ slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli"),
454
+ svg: isPrettierPluginXmlInScope,
455
+ xml: isPrettierPluginXmlInScope
456
+ };
457
+ }
458
+ await ensurePackages([
459
+ "eslint-plugin-format",
460
+ options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0,
461
+ options.astro ? "prettier-plugin-astro" : void 0,
462
+ options.xml || options.svg ? "@prettier/plugin-xml" : void 0
463
+ ]);
464
+ if (options.slidev && options.markdown !== true && options.markdown !== "prettier")
465
+ throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
466
+ const {
467
+ indent,
468
+ quotes,
469
+ semi
470
+ } = {
471
+ ...StylisticConfigDefaults,
472
+ ...stylistic2
473
+ };
474
+ const prettierOptions = Object.assign(
475
+ {
476
+ endOfLine: "auto",
477
+ printWidth: 120,
478
+ semi,
479
+ singleQuote: quotes === "single",
480
+ tabWidth: typeof indent === "number" ? indent : 2,
481
+ trailingComma: "all",
482
+ useTabs: indent === "tab"
483
+ },
484
+ options.prettierOptions || {}
485
+ );
486
+ const prettierXmlOptions = {
487
+ xmlQuoteAttributes: "double",
488
+ xmlSelfClosingSpace: true,
489
+ xmlSortAttributesByKey: false,
490
+ xmlWhitespaceSensitivity: "ignore"
491
+ };
492
+ const dprintOptions = Object.assign(
493
+ {
494
+ indentWidth: typeof indent === "number" ? indent : 2,
495
+ quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
496
+ useTabs: indent === "tab"
497
+ },
498
+ options.dprintOptions || {}
499
+ );
500
+ const pluginFormat = await interopDefault(import("eslint-plugin-format"));
501
+ const configs2 = [
502
+ {
503
+ name: "jun/formatter/setup",
504
+ plugins: {
505
+ format: pluginFormat
506
+ }
507
+ }
508
+ ];
509
+ if (options.css) {
510
+ configs2.push(
511
+ {
512
+ files: [GLOB_CSS, GLOB_POSTCSS],
513
+ languageOptions: {
514
+ parser: parserPlain
515
+ },
516
+ name: "jun/formatter/css",
517
+ rules: {
518
+ "format/prettier": [
519
+ "error",
520
+ {
521
+ ...prettierOptions,
522
+ parser: "css"
523
+ }
524
+ ]
525
+ }
526
+ },
527
+ {
528
+ files: [GLOB_SCSS],
529
+ languageOptions: {
530
+ parser: parserPlain
531
+ },
532
+ name: "jun/formatter/scss",
533
+ rules: {
534
+ "format/prettier": [
535
+ "error",
536
+ {
537
+ ...prettierOptions,
538
+ parser: "scss"
539
+ }
540
+ ]
541
+ }
542
+ },
543
+ {
544
+ files: [GLOB_LESS],
545
+ languageOptions: {
546
+ parser: parserPlain
547
+ },
548
+ name: "jun/formatter/less",
549
+ rules: {
550
+ "format/prettier": [
551
+ "error",
552
+ {
553
+ ...prettierOptions,
554
+ parser: "less"
555
+ }
556
+ ]
557
+ }
558
+ }
559
+ );
560
+ }
561
+ if (options.html) {
562
+ configs2.push({
563
+ files: [GLOB_HTML],
564
+ languageOptions: {
565
+ parser: parserPlain
566
+ },
567
+ name: "jun/formatter/html",
568
+ rules: {
569
+ "format/prettier": [
570
+ "error",
571
+ {
572
+ ...prettierOptions,
573
+ parser: "html"
574
+ }
575
+ ]
576
+ }
577
+ });
578
+ }
579
+ if (options.xml) {
580
+ configs2.push({
581
+ files: [GLOB_XML],
582
+ languageOptions: {
583
+ parser: parserPlain
584
+ },
585
+ name: "jun/formatter/xml",
586
+ rules: {
587
+ "format/prettier": [
588
+ "error",
589
+ {
590
+ ...prettierXmlOptions,
591
+ ...prettierOptions,
592
+ parser: "xml",
593
+ plugins: [
594
+ "@prettier/plugin-xml"
595
+ ]
596
+ }
597
+ ]
598
+ }
599
+ });
600
+ }
601
+ if (options.svg) {
602
+ configs2.push({
603
+ files: [GLOB_SVG],
604
+ languageOptions: {
605
+ parser: parserPlain
606
+ },
607
+ name: "jun/formatter/svg",
608
+ rules: {
609
+ "format/prettier": [
610
+ "error",
611
+ {
612
+ ...prettierXmlOptions,
613
+ ...prettierOptions,
614
+ parser: "xml",
615
+ plugins: [
616
+ "@prettier/plugin-xml"
617
+ ]
618
+ }
619
+ ]
620
+ }
621
+ });
622
+ }
623
+ if (options.markdown) {
624
+ const formater = options.markdown === true ? "prettier" : options.markdown;
625
+ const GLOB_SLIDEV = !options.slidev ? [] : options.slidev === true ? ["**/slides.md"] : options.slidev.files;
626
+ configs2.push({
627
+ files: [GLOB_MARKDOWN],
628
+ ignores: GLOB_SLIDEV,
629
+ languageOptions: {
630
+ parser: parserPlain
631
+ },
632
+ name: "jun/formatter/markdown",
633
+ rules: {
634
+ [`format/${formater}`]: [
635
+ "error",
636
+ formater === "prettier" ? {
637
+ ...prettierOptions,
638
+ embeddedLanguageFormatting: "off",
639
+ parser: "markdown"
640
+ } : {
641
+ ...dprintOptions,
642
+ language: "markdown"
643
+ }
644
+ ]
645
+ }
646
+ });
647
+ if (options.slidev) {
648
+ configs2.push({
649
+ files: GLOB_SLIDEV,
650
+ languageOptions: {
651
+ parser: parserPlain
652
+ },
653
+ name: "jun/formatter/slidev",
654
+ rules: {
655
+ "format/prettier": [
656
+ "error",
657
+ {
658
+ ...prettierOptions,
659
+ embeddedLanguageFormatting: "off",
660
+ parser: "slidev",
661
+ plugins: [
662
+ "prettier-plugin-slidev"
663
+ ]
664
+ }
665
+ ]
666
+ }
667
+ });
668
+ }
669
+ }
670
+ if (options.astro) {
671
+ configs2.push({
672
+ files: [GLOB_ASTRO],
673
+ languageOptions: {
674
+ parser: parserPlain
675
+ },
676
+ name: "jun/formatter/astro",
677
+ rules: {
678
+ "format/prettier": [
679
+ "error",
680
+ {
681
+ ...prettierOptions,
682
+ parser: "astro",
683
+ plugins: [
684
+ "prettier-plugin-astro"
685
+ ]
686
+ }
687
+ ]
688
+ }
689
+ });
690
+ configs2.push({
691
+ files: [GLOB_ASTRO, GLOB_ASTRO_TS],
692
+ name: "jun/formatter/astro/disables",
693
+ rules: {
694
+ "style/arrow-parens": "off",
695
+ "style/block-spacing": "off",
696
+ "style/comma-dangle": "off",
697
+ "style/indent": "off",
698
+ "style/no-multi-spaces": "off",
699
+ "style/quotes": "off",
700
+ "style/semi": "off"
701
+ }
702
+ });
703
+ }
704
+ if (options.graphql) {
705
+ configs2.push({
706
+ files: [GLOB_GRAPHQL],
707
+ languageOptions: {
708
+ parser: parserPlain
709
+ },
710
+ name: "jun/formatter/graphql",
711
+ rules: {
712
+ "format/prettier": [
713
+ "error",
714
+ {
715
+ ...prettierOptions,
716
+ parser: "graphql"
717
+ }
718
+ ]
719
+ }
720
+ });
721
+ }
722
+ return configs2;
723
+ }
724
+
725
+ // src/configs/ignores.ts
726
+ async function ignores() {
727
+ return [
728
+ {
729
+ ignores: GLOB_EXCLUDE
730
+ }
731
+ ];
732
+ }
733
+
734
+ // src/configs/imports.ts
735
+ async function imports(options = {}) {
736
+ const {
737
+ stylistic: stylistic2 = true
738
+ } = options;
739
+ return [
740
+ {
741
+ name: "jun/imports/rules",
742
+ plugins: {
743
+ import: pluginImport,
744
+ jun: import_eslint_plugin_antfu.default
745
+ },
746
+ rules: {
747
+ "import/first": "error",
748
+ "import/no-duplicates": "error",
749
+ "import/no-mutable-exports": "error",
750
+ "import/no-named-default": "error",
751
+ "import/no-self-import": "error",
752
+ "import/no-webpack-loader-syntax": "error",
753
+ "import/order": "error",
754
+ "jun/import-dedupe": "error",
755
+ "jun/no-import-dist": "error",
756
+ "jun/no-import-node-modules-by-path": "error",
757
+ ...stylistic2 ? {
758
+ "import/newline-after-import": ["error", { count: 1 }]
759
+ } : {}
760
+ }
761
+ },
762
+ {
763
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
764
+ name: "jun/imports/disables/bin",
765
+ rules: {
766
+ "jun/no-import-dist": "off",
767
+ "jun/no-import-node-modules-by-path": "off"
768
+ }
769
+ }
770
+ ];
771
+ }
772
+
773
+ // src/configs/javascript.ts
774
+ var import_globals = __toESM(require("globals"), 1);
775
+ async function javascript(options = {}) {
776
+ const {
777
+ isInEditor = false,
778
+ overrides = {}
779
+ } = options;
780
+ return [
781
+ {
782
+ languageOptions: {
783
+ ecmaVersion: 2022,
784
+ globals: {
785
+ ...import_globals.default.browser,
786
+ ...import_globals.default.es2021,
787
+ ...import_globals.default.node,
788
+ document: "readonly",
789
+ navigator: "readonly",
790
+ window: "readonly"
791
+ },
792
+ parserOptions: {
793
+ ecmaFeatures: {
794
+ jsx: true
795
+ },
796
+ ecmaVersion: 2022,
797
+ sourceType: "module"
798
+ },
799
+ sourceType: "module"
800
+ },
801
+ linterOptions: {
802
+ reportUnusedDisableDirectives: true
803
+ },
804
+ name: "jun/javascript/setup"
805
+ },
806
+ {
807
+ name: "jun/javascript/rules",
808
+ plugins: {
809
+ "jun": import_eslint_plugin_antfu.default,
810
+ "unused-imports": import_eslint_plugin_unused_imports.default
811
+ },
812
+ rules: {
813
+ "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
814
+ "array-callback-return": "error",
815
+ "block-scoped-var": "error",
816
+ "constructor-super": "error",
817
+ "default-case-last": "error",
818
+ "dot-notation": ["error", { allowKeywords: true }],
819
+ "eqeqeq": ["error", "smart"],
820
+ "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
821
+ "no-alert": "error",
822
+ "no-array-constructor": "error",
823
+ "no-async-promise-executor": "error",
824
+ "no-caller": "error",
825
+ "no-case-declarations": "error",
826
+ "no-class-assign": "error",
827
+ "no-compare-neg-zero": "error",
828
+ "no-cond-assign": ["error", "always"],
829
+ "no-console": ["error", { allow: ["warn", "error"] }],
830
+ "no-const-assign": "error",
831
+ "no-control-regex": "error",
832
+ "no-debugger": "error",
833
+ "no-delete-var": "error",
834
+ "no-dupe-args": "error",
835
+ "no-dupe-class-members": "error",
836
+ "no-dupe-keys": "error",
837
+ "no-duplicate-case": "error",
838
+ "no-empty": ["error", { allowEmptyCatch: true }],
839
+ "no-empty-character-class": "error",
840
+ "no-empty-pattern": "error",
841
+ "no-eval": "error",
842
+ "no-ex-assign": "error",
843
+ "no-extend-native": "error",
844
+ "no-extra-bind": "error",
845
+ "no-extra-boolean-cast": "error",
846
+ "no-fallthrough": "error",
847
+ "no-func-assign": "error",
848
+ "no-global-assign": "error",
849
+ "no-implied-eval": "error",
850
+ "no-import-assign": "error",
851
+ "no-invalid-regexp": "error",
852
+ "no-irregular-whitespace": "error",
853
+ "no-iterator": "error",
854
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
855
+ "no-lone-blocks": "error",
856
+ "no-loss-of-precision": "error",
857
+ "no-misleading-character-class": "error",
858
+ "no-multi-str": "error",
859
+ "no-new": "error",
860
+ "no-new-func": "error",
861
+ "no-new-native-nonconstructor": "error",
862
+ "no-new-wrappers": "error",
863
+ "no-obj-calls": "error",
864
+ "no-octal": "error",
865
+ "no-octal-escape": "error",
866
+ "no-proto": "error",
867
+ "no-prototype-builtins": "error",
868
+ "no-redeclare": ["error", { builtinGlobals: false }],
869
+ "no-regex-spaces": "error",
870
+ "no-restricted-globals": [
871
+ "error",
872
+ { message: "Use `globalThis` instead.", name: "global" },
873
+ { message: "Use `globalThis` instead.", name: "self" }
874
+ ],
875
+ "no-restricted-properties": [
876
+ "error",
877
+ { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
878
+ { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
879
+ { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
880
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
881
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
882
+ ],
883
+ "no-restricted-syntax": [
884
+ "error",
885
+ "DebuggerStatement",
886
+ "LabeledStatement",
887
+ "WithStatement",
888
+ "TSEnumDeclaration[const=true]",
889
+ "TSExportAssignment"
890
+ ],
891
+ "no-self-assign": ["error", { props: true }],
892
+ "no-self-compare": "error",
893
+ "no-sequences": "error",
894
+ "no-shadow-restricted-names": "error",
895
+ "no-sparse-arrays": "error",
896
+ "no-template-curly-in-string": "error",
897
+ "no-this-before-super": "error",
898
+ "no-throw-literal": "error",
899
+ "no-undef": "error",
900
+ "no-undef-init": "error",
901
+ "no-unexpected-multiline": "error",
902
+ "no-unmodified-loop-condition": "error",
903
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
904
+ "no-unreachable": "error",
905
+ "no-unreachable-loop": "error",
906
+ "no-unsafe-finally": "error",
907
+ "no-unsafe-negation": "error",
908
+ "no-unused-expressions": ["error", {
909
+ allowShortCircuit: true,
910
+ allowTaggedTemplates: true,
911
+ allowTernary: true
912
+ }],
913
+ "no-unused-vars": ["error", {
914
+ args: "none",
915
+ caughtErrors: "none",
916
+ ignoreRestSiblings: true,
917
+ vars: "all"
918
+ }],
919
+ "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
920
+ "no-useless-backreference": "error",
921
+ "no-useless-call": "error",
922
+ "no-useless-catch": "error",
923
+ "no-useless-computed-key": "error",
924
+ "no-useless-constructor": "error",
925
+ "no-useless-rename": "error",
926
+ "no-useless-return": "error",
927
+ "no-var": "error",
928
+ "no-with": "error",
929
+ "object-shorthand": [
930
+ "error",
931
+ "always",
932
+ {
933
+ avoidQuotes: true,
934
+ ignoreConstructors: false
935
+ }
936
+ ],
937
+ "one-var": ["error", { initialized: "never" }],
938
+ "prefer-arrow-callback": [
939
+ "error",
940
+ {
941
+ allowNamedFunctions: false,
942
+ allowUnboundThis: true
943
+ }
944
+ ],
945
+ "prefer-const": [
946
+ "error",
947
+ {
948
+ destructuring: "all",
949
+ ignoreReadBeforeAssign: true
950
+ }
951
+ ],
952
+ "prefer-exponentiation-operator": "error",
953
+ "prefer-promise-reject-errors": "error",
954
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
955
+ "prefer-rest-params": "error",
956
+ "prefer-spread": "error",
957
+ "prefer-template": "error",
958
+ "sort-imports": [
959
+ "error",
960
+ {
961
+ allowSeparatedGroups: false,
962
+ ignoreCase: false,
963
+ ignoreDeclarationSort: true,
964
+ ignoreMemberSort: false,
965
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
966
+ }
967
+ ],
968
+ "symbol-description": "error",
969
+ "unicode-bom": ["error", "never"],
970
+ "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
971
+ "unused-imports/no-unused-vars": [
972
+ "error",
973
+ {
974
+ args: "after-used",
975
+ argsIgnorePattern: "^_",
976
+ ignoreRestSiblings: true,
977
+ vars: "all",
978
+ varsIgnorePattern: "^_"
979
+ }
980
+ ],
981
+ "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
982
+ "valid-typeof": ["error", { requireStringLiterals: true }],
983
+ "vars-on-top": "error",
984
+ "yoda": ["error", "never"],
985
+ ...overrides
986
+ }
987
+ },
988
+ {
989
+ files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
990
+ name: "jun/javascript/disables/cli",
991
+ rules: {
992
+ "no-console": "off"
993
+ }
994
+ }
995
+ ];
996
+ }
997
+
998
+ // src/configs/jsdoc.ts
999
+ async function jsdoc(options = {}) {
1000
+ const {
1001
+ stylistic: stylistic2 = true
1002
+ } = options;
1003
+ return [
1004
+ {
1005
+ name: "jun/jsdoc/rules",
1006
+ plugins: {
1007
+ jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
1008
+ },
1009
+ rules: {
1010
+ "jsdoc/check-access": "warn",
1011
+ "jsdoc/check-param-names": "warn",
1012
+ "jsdoc/check-property-names": "warn",
1013
+ "jsdoc/check-types": "warn",
1014
+ "jsdoc/empty-tags": "warn",
1015
+ "jsdoc/implements-on-classes": "warn",
1016
+ "jsdoc/no-defaults": "warn",
1017
+ "jsdoc/no-multi-asterisks": "warn",
1018
+ "jsdoc/require-param-name": "warn",
1019
+ "jsdoc/require-property": "warn",
1020
+ "jsdoc/require-property-description": "warn",
1021
+ "jsdoc/require-property-name": "warn",
1022
+ "jsdoc/require-returns-check": "warn",
1023
+ "jsdoc/require-returns-description": "warn",
1024
+ "jsdoc/require-yields-check": "warn",
1025
+ ...stylistic2 ? {
1026
+ "jsdoc/check-alignment": "warn",
1027
+ "jsdoc/multiline-blocks": "warn"
1028
+ } : {}
1029
+ }
1030
+ }
1031
+ ];
1032
+ }
1033
+
1034
+ // src/configs/jsx.ts
1035
+ async function jsx() {
1036
+ return [
1037
+ {
1038
+ files: [GLOB_JSX, GLOB_TSX],
1039
+ languageOptions: {
1040
+ parserOptions: {
1041
+ ecmaFeatures: {
1042
+ jsx: true
1043
+ }
1044
+ }
1045
+ },
1046
+ name: "jun/jsx/setup"
1047
+ }
1048
+ ];
1049
+ }
1050
+
1051
+ // src/configs/jsonc.ts
1052
+ async function jsonc(options = {}) {
1053
+ const {
1054
+ files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1055
+ overrides = {},
1056
+ stylistic: stylistic2 = true
1057
+ } = options;
1058
+ const {
1059
+ indent = 2
1060
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1061
+ const [
1062
+ pluginJsonc,
1063
+ parserJsonc
1064
+ ] = await Promise.all([
1065
+ interopDefault(import("eslint-plugin-jsonc")),
1066
+ interopDefault(import("jsonc-eslint-parser"))
1067
+ ]);
1068
+ return [
1069
+ {
1070
+ name: "jun/jsonc/setup",
1071
+ plugins: {
1072
+ jsonc: pluginJsonc
1073
+ }
1074
+ },
1075
+ {
1076
+ files,
1077
+ languageOptions: {
1078
+ parser: parserJsonc
1079
+ },
1080
+ name: "jun/jsonc/rules",
1081
+ rules: {
1082
+ "jsonc/no-bigint-literals": "error",
1083
+ "jsonc/no-binary-expression": "error",
1084
+ "jsonc/no-binary-numeric-literals": "error",
1085
+ "jsonc/no-dupe-keys": "error",
1086
+ "jsonc/no-escape-sequence-in-identifier": "error",
1087
+ "jsonc/no-floating-decimal": "error",
1088
+ "jsonc/no-hexadecimal-numeric-literals": "error",
1089
+ "jsonc/no-infinity": "error",
1090
+ "jsonc/no-multi-str": "error",
1091
+ "jsonc/no-nan": "error",
1092
+ "jsonc/no-number-props": "error",
1093
+ "jsonc/no-numeric-separators": "error",
1094
+ "jsonc/no-octal": "error",
1095
+ "jsonc/no-octal-escape": "error",
1096
+ "jsonc/no-octal-numeric-literals": "error",
1097
+ "jsonc/no-parenthesized": "error",
1098
+ "jsonc/no-plus-sign": "error",
1099
+ "jsonc/no-regexp-literals": "error",
1100
+ "jsonc/no-sparse-arrays": "error",
1101
+ "jsonc/no-template-literals": "error",
1102
+ "jsonc/no-undefined-value": "error",
1103
+ "jsonc/no-unicode-codepoint-escapes": "error",
1104
+ "jsonc/no-useless-escape": "error",
1105
+ "jsonc/space-unary-ops": "error",
1106
+ "jsonc/valid-json-number": "error",
1107
+ "jsonc/vue-custom-block/no-parsing-error": "error",
1108
+ ...stylistic2 ? {
1109
+ "jsonc/array-bracket-spacing": ["error", "never"],
1110
+ "jsonc/comma-dangle": ["error", "never"],
1111
+ "jsonc/comma-style": ["error", "last"],
1112
+ "jsonc/indent": ["error", indent],
1113
+ "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1114
+ "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
1115
+ "jsonc/object-curly-spacing": ["error", "always"],
1116
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
1117
+ "jsonc/quote-props": "error",
1118
+ "jsonc/quotes": "error"
1119
+ } : {},
1120
+ ...overrides
1121
+ }
1122
+ }
1123
+ ];
1124
+ }
1125
+
1126
+ // src/configs/markdown.ts
1127
+ var import_eslint_merge_processors = require("eslint-merge-processors");
1128
+ async function markdown(options = {}) {
1129
+ const {
1130
+ componentExts = [],
1131
+ files = [GLOB_MARKDOWN],
1132
+ overrides = {}
1133
+ } = options;
1134
+ const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
1135
+ return [
1136
+ {
1137
+ name: "jun/markdown/setup",
1138
+ plugins: {
1139
+ markdown: markdown2
1140
+ }
1141
+ },
1142
+ {
1143
+ files,
1144
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1145
+ name: "jun/markdown/processor",
1146
+ // `eslint-plugin-markdown` only creates virtual files for code blocks,
1147
+ // but not the markdown file itself. We use `eslint-merge-processors` to
1148
+ // add a pass-through processor for the markdown file itself.
1149
+ processor: (0, import_eslint_merge_processors.mergeProcessors)([
1150
+ markdown2.processors.markdown,
1151
+ import_eslint_merge_processors.processorPassThrough
1152
+ ])
1153
+ },
1154
+ {
1155
+ files,
1156
+ languageOptions: {
1157
+ parser: parserPlain
1158
+ },
1159
+ name: "jun/markdown/parser"
1160
+ },
1161
+ {
1162
+ files: [
1163
+ GLOB_MARKDOWN_CODE,
1164
+ ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
1165
+ ],
1166
+ languageOptions: {
1167
+ parserOptions: {
1168
+ ecmaFeatures: {
1169
+ impliedStrict: true
1170
+ }
1171
+ }
1172
+ },
1173
+ name: "jun/markdown/disables",
1174
+ rules: {
1175
+ "import/newline-after-import": "off",
1176
+ "no-alert": "off",
1177
+ "no-console": "off",
1178
+ "no-labels": "off",
1179
+ "no-lone-blocks": "off",
1180
+ "no-restricted-syntax": "off",
1181
+ "no-undef": "off",
1182
+ "no-unused-expressions": "off",
1183
+ "no-unused-labels": "off",
1184
+ "no-unused-vars": "off",
1185
+ "node/prefer-global/process": "off",
1186
+ "style/comma-dangle": "off",
1187
+ "style/eol-last": "off",
1188
+ "ts/consistent-type-imports": "off",
1189
+ "ts/no-namespace": "off",
1190
+ "ts/no-redeclare": "off",
1191
+ "ts/no-require-imports": "off",
1192
+ "ts/no-unused-expressions": "off",
1193
+ "ts/no-unused-vars": "off",
1194
+ "ts/no-use-before-define": "off",
1195
+ "ts/no-var-requires": "off",
1196
+ "unicode-bom": "off",
1197
+ "unused-imports/no-unused-imports": "off",
1198
+ "unused-imports/no-unused-vars": "off",
1199
+ ...overrides
1200
+ }
1201
+ }
1202
+ ];
1203
+ }
1204
+
1205
+ // src/configs/node.ts
1206
+ async function node() {
1207
+ return [
1208
+ {
1209
+ name: "jun/node/rules",
1210
+ plugins: {
1211
+ node: import_eslint_plugin_n.default
1212
+ },
1213
+ rules: {
1214
+ "node/handle-callback-err": ["error", "^(err|error)$"],
1215
+ "node/no-deprecated-api": "error",
1216
+ "node/no-exports-assign": "error",
1217
+ "node/no-new-require": "error",
1218
+ "node/no-path-concat": "error",
1219
+ "node/prefer-global/buffer": ["error", "never"],
1220
+ "node/prefer-global/process": ["error", "never"],
1221
+ "node/process-exit-as-throw": "error"
1222
+ }
1223
+ }
1224
+ ];
1225
+ }
1226
+
1227
+ // src/configs/perfectionist.ts
1228
+ async function perfectionist() {
1229
+ return [
1230
+ {
1231
+ name: "jun/perfectionist/setup",
1232
+ plugins: {
1233
+ perfectionist: import_eslint_plugin_perfectionist.default
1234
+ }
1235
+ }
1236
+ ];
1237
+ }
1238
+
1239
+ // src/configs/react.ts
1240
+ var import_local_pkg3 = require("local-pkg");
1241
+ var ReactRefreshAllowConstantExportPackages = [
1242
+ "vite"
1243
+ ];
1244
+ var RemixPackages = [
1245
+ "@remix-run/node",
1246
+ "@remix-run/react",
1247
+ "@remix-run/serve",
1248
+ "@remix-run/dev"
1249
+ ];
1250
+ var NextJsPackages = [
1251
+ "next"
1252
+ ];
1253
+ async function react(options = {}) {
1254
+ const {
1255
+ files = [GLOB_SRC],
1256
+ overrides = {}
1257
+ } = options;
1258
+ await ensurePackages([
1259
+ "@eslint-react/eslint-plugin",
1260
+ "eslint-plugin-react-hooks",
1261
+ "eslint-plugin-react-refresh"
1262
+ ]);
1263
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1264
+ const isTypeAware = !!tsconfigPath;
1265
+ const [
1266
+ pluginReact,
1267
+ pluginReactHooks,
1268
+ pluginReactRefresh,
1269
+ parserTs
1270
+ ] = await Promise.all([
1271
+ interopDefault(import("@eslint-react/eslint-plugin")),
1272
+ interopDefault(import("eslint-plugin-react-hooks")),
1273
+ interopDefault(import("eslint-plugin-react-refresh")),
1274
+ interopDefault(import("@typescript-eslint/parser"))
1275
+ ]);
1276
+ const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => (0, import_local_pkg3.isPackageExists)(i));
1277
+ const isUsingRemix = RemixPackages.some((i) => (0, import_local_pkg3.isPackageExists)(i));
1278
+ const isUsingNext = NextJsPackages.some((i) => (0, import_local_pkg3.isPackageExists)(i));
1279
+ const plugins = pluginReact.configs.all.plugins;
1280
+ return [
1281
+ {
1282
+ name: "jun/react/setup",
1283
+ plugins: {
1284
+ "react": plugins["@eslint-react"],
1285
+ "react-dom": plugins["@eslint-react/dom"],
1286
+ "react-hooks": pluginReactHooks,
1287
+ "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1288
+ "react-naming-convention": plugins["@eslint-react/naming-convention"],
1289
+ "react-refresh": pluginReactRefresh
1290
+ }
1291
+ },
1292
+ {
1293
+ files,
1294
+ languageOptions: {
1295
+ parser: parserTs,
1296
+ parserOptions: {
1297
+ ecmaFeatures: {
1298
+ jsx: true
1299
+ },
1300
+ ...isTypeAware ? { project: tsconfigPath } : {}
1301
+ },
1302
+ sourceType: "module"
1303
+ },
1304
+ name: "jun/react/rules",
1305
+ rules: {
1306
+ // recommended rules from @eslint-react/dom
1307
+ "react-dom/no-children-in-void-dom-elements": "warn",
1308
+ "react-dom/no-dangerously-set-innerhtml": "warn",
1309
+ "react-dom/no-dangerously-set-innerhtml-with-children": "error",
1310
+ "react-dom/no-find-dom-node": "error",
1311
+ "react-dom/no-missing-button-type": "warn",
1312
+ "react-dom/no-missing-iframe-sandbox": "warn",
1313
+ "react-dom/no-namespace": "error",
1314
+ "react-dom/no-render-return-value": "error",
1315
+ "react-dom/no-script-url": "warn",
1316
+ "react-dom/no-unsafe-iframe-sandbox": "warn",
1317
+ "react-dom/no-unsafe-target-blank": "warn",
1318
+ // recommended rules react-hooks
1319
+ "react-hooks/exhaustive-deps": "warn",
1320
+ "react-hooks/rules-of-hooks": "error",
1321
+ // react refresh
1322
+ "react-refresh/only-export-components": [
1323
+ "warn",
1324
+ {
1325
+ allowConstantExport: isAllowConstantExport,
1326
+ allowExportNames: [
1327
+ ...isUsingNext ? [
1328
+ "config",
1329
+ "generateStaticParams",
1330
+ "metadata",
1331
+ "generateMetadata",
1332
+ "viewport",
1333
+ "generateViewport"
1334
+ ] : [],
1335
+ ...isUsingRemix ? [
1336
+ "meta",
1337
+ "links",
1338
+ "headers",
1339
+ "loader",
1340
+ "action"
1341
+ ] : []
1342
+ ]
1343
+ }
1344
+ ],
1345
+ // recommended rules from @eslint-react
1346
+ "react/ensure-forward-ref-using-ref": "warn",
1347
+ "react/no-access-state-in-setstate": "error",
1348
+ "react/no-array-index-key": "warn",
1349
+ "react/no-children-count": "warn",
1350
+ "react/no-children-for-each": "warn",
1351
+ "react/no-children-map": "warn",
1352
+ "react/no-children-only": "warn",
1353
+ "react/no-children-prop": "warn",
1354
+ "react/no-children-to-array": "warn",
1355
+ "react/no-clone-element": "warn",
1356
+ "react/no-comment-textnodes": "warn",
1357
+ "react/no-component-will-mount": "error",
1358
+ "react/no-component-will-receive-props": "error",
1359
+ "react/no-component-will-update": "error",
1360
+ "react/no-create-ref": "error",
1361
+ "react/no-direct-mutation-state": "error",
1362
+ "react/no-duplicate-key": "error",
1363
+ "react/no-implicit-key": "error",
1364
+ "react/no-missing-key": "error",
1365
+ "react/no-nested-components": "warn",
1366
+ "react/no-redundant-should-component-update": "error",
1367
+ "react/no-set-state-in-component-did-mount": "warn",
1368
+ "react/no-set-state-in-component-did-update": "warn",
1369
+ "react/no-set-state-in-component-will-update": "warn",
1370
+ "react/no-string-refs": "error",
1371
+ "react/no-unsafe-component-will-mount": "warn",
1372
+ "react/no-unsafe-component-will-receive-props": "warn",
1373
+ "react/no-unsafe-component-will-update": "warn",
1374
+ "react/no-unstable-context-value": "error",
1375
+ "react/no-unstable-default-props": "error",
1376
+ "react/no-unused-class-component-members": "warn",
1377
+ "react/no-unused-state": "warn",
1378
+ "react/no-useless-fragment": "warn",
1379
+ "react/prefer-destructuring-assignment": "warn",
1380
+ "react/prefer-shorthand-boolean": "warn",
1381
+ "react/prefer-shorthand-fragment": "warn",
1382
+ ...isTypeAware ? {
1383
+ "react/no-leaked-conditional-rendering": "warn"
1384
+ } : {},
1385
+ // overrides
1386
+ ...overrides
1387
+ }
1388
+ }
1389
+ ];
1390
+ }
1391
+
1392
+ // src/configs/solid.ts
1393
+ async function solid(options = {}) {
1394
+ const {
1395
+ files = [GLOB_JSX, GLOB_TSX],
1396
+ overrides = {},
1397
+ typescript: typescript2 = true
1398
+ } = options;
1399
+ await ensurePackages([
1400
+ "eslint-plugin-solid"
1401
+ ]);
1402
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1403
+ const isTypeAware = !!tsconfigPath;
1404
+ const [
1405
+ pluginSolid,
1406
+ parserTs
1407
+ ] = await Promise.all([
1408
+ interopDefault(import("eslint-plugin-solid")),
1409
+ interopDefault(import("@typescript-eslint/parser"))
1410
+ ]);
1411
+ return [
1412
+ {
1413
+ name: "jun/solid/setup",
1414
+ plugins: {
1415
+ solid: pluginSolid
1416
+ }
1417
+ },
1418
+ {
1419
+ files,
1420
+ languageOptions: {
1421
+ parser: parserTs,
1422
+ parserOptions: {
1423
+ ecmaFeatures: {
1424
+ jsx: true
1425
+ },
1426
+ ...isTypeAware ? { project: tsconfigPath } : {}
1427
+ },
1428
+ sourceType: "module"
1429
+ },
1430
+ name: "jun/solid/rules",
1431
+ rules: {
1432
+ // reactivity
1433
+ "solid/components-return-once": "warn",
1434
+ "solid/event-handlers": ["error", {
1435
+ // if true, don't warn on ambiguously named event handlers like `onclick` or `onchange`
1436
+ ignoreCase: false,
1437
+ // if true, warn when spreading event handlers onto JSX. Enable for Solid < v1.6.
1438
+ warnOnSpread: false
1439
+ }],
1440
+ // these rules are mostly style suggestions
1441
+ "solid/imports": "error",
1442
+ // identifier usage is important
1443
+ "solid/jsx-no-duplicate-props": "error",
1444
+ "solid/jsx-no-script-url": "error",
1445
+ "solid/jsx-no-undef": "error",
1446
+ "solid/jsx-uses-vars": "error",
1447
+ "solid/no-destructure": "error",
1448
+ // security problems
1449
+ "solid/no-innerhtml": ["error", { allowStatic: true }],
1450
+ "solid/no-react-deps": "error",
1451
+ "solid/no-react-specific-props": "error",
1452
+ "solid/no-unknown-namespaces": "error",
1453
+ "solid/prefer-for": "error",
1454
+ "solid/reactivity": "warn",
1455
+ "solid/self-closing-comp": "error",
1456
+ "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
1457
+ ...typescript2 ? {
1458
+ "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
1459
+ "solid/no-unknown-namespaces": "off"
1460
+ } : {},
1461
+ // overrides
1462
+ ...overrides
1463
+ }
1464
+ }
1465
+ ];
1466
+ }
1467
+
1468
+ // src/configs/sort.ts
1469
+ async function sortPackageJson() {
1470
+ return [
1471
+ {
1472
+ files: ["**/package.json"],
1473
+ name: "jun/sort/package-json",
1474
+ rules: {
1475
+ "jsonc/sort-array-values": [
1476
+ "error",
1477
+ {
1478
+ order: { type: "asc" },
1479
+ pathPattern: "^files$"
1480
+ }
1481
+ ],
1482
+ "jsonc/sort-keys": [
1483
+ "error",
1484
+ {
1485
+ order: [
1486
+ "publisher",
1487
+ "name",
1488
+ "displayName",
1489
+ "type",
1490
+ "version",
1491
+ "private",
1492
+ "packageManager",
1493
+ "description",
1494
+ "author",
1495
+ "contributors",
1496
+ "license",
1497
+ "funding",
1498
+ "homepage",
1499
+ "repository",
1500
+ "bugs",
1501
+ "keywords",
1502
+ "categories",
1503
+ "sideEffects",
1504
+ "exports",
1505
+ "main",
1506
+ "module",
1507
+ "unpkg",
1508
+ "jsdelivr",
1509
+ "types",
1510
+ "typesVersions",
1511
+ "bin",
1512
+ "icon",
1513
+ "files",
1514
+ "engines",
1515
+ "activationEvents",
1516
+ "contributes",
1517
+ "scripts",
1518
+ "peerDependencies",
1519
+ "peerDependenciesMeta",
1520
+ "dependencies",
1521
+ "optionalDependencies",
1522
+ "devDependencies",
1523
+ "pnpm",
1524
+ "overrides",
1525
+ "resolutions",
1526
+ "husky",
1527
+ "simple-git-hooks",
1528
+ "lint-staged",
1529
+ "eslintConfig"
1530
+ ],
1531
+ pathPattern: "^$"
1532
+ },
1533
+ {
1534
+ order: { type: "asc" },
1535
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
1536
+ },
1537
+ {
1538
+ order: { type: "asc" },
1539
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1540
+ },
1541
+ {
1542
+ order: [
1543
+ "types",
1544
+ "import",
1545
+ "require",
1546
+ "default"
1547
+ ],
1548
+ pathPattern: "^exports.*$"
1549
+ },
1550
+ {
1551
+ order: [
1552
+ // client hooks only
1553
+ "pre-commit",
1554
+ "prepare-commit-msg",
1555
+ "commit-msg",
1556
+ "post-commit",
1557
+ "pre-rebase",
1558
+ "post-rewrite",
1559
+ "post-checkout",
1560
+ "post-merge",
1561
+ "pre-push",
1562
+ "pre-auto-gc"
1563
+ ],
1564
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1565
+ }
1566
+ ]
1567
+ }
1568
+ }
1569
+ ];
1570
+ }
1571
+ function sortTsconfig() {
1572
+ return [
1573
+ {
1574
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1575
+ name: "jun/sort/tsconfig-json",
1576
+ rules: {
1577
+ "jsonc/sort-keys": [
1578
+ "error",
1579
+ {
1580
+ order: [
1581
+ "extends",
1582
+ "compilerOptions",
1583
+ "references",
1584
+ "files",
1585
+ "include",
1586
+ "exclude"
1587
+ ],
1588
+ pathPattern: "^$"
1589
+ },
1590
+ {
1591
+ order: [
1592
+ /* Projects */
1593
+ "incremental",
1594
+ "composite",
1595
+ "tsBuildInfoFile",
1596
+ "disableSourceOfProjectReferenceRedirect",
1597
+ "disableSolutionSearching",
1598
+ "disableReferencedProjectLoad",
1599
+ /* Language and Environment */
1600
+ "target",
1601
+ "jsx",
1602
+ "jsxFactory",
1603
+ "jsxFragmentFactory",
1604
+ "jsxImportSource",
1605
+ "lib",
1606
+ "moduleDetection",
1607
+ "noLib",
1608
+ "reactNamespace",
1609
+ "useDefineForClassFields",
1610
+ "emitDecoratorMetadata",
1611
+ "experimentalDecorators",
1612
+ /* Modules */
1613
+ "baseUrl",
1614
+ "rootDir",
1615
+ "rootDirs",
1616
+ "customConditions",
1617
+ "module",
1618
+ "moduleResolution",
1619
+ "moduleSuffixes",
1620
+ "noResolve",
1621
+ "paths",
1622
+ "resolveJsonModule",
1623
+ "resolvePackageJsonExports",
1624
+ "resolvePackageJsonImports",
1625
+ "typeRoots",
1626
+ "types",
1627
+ "allowArbitraryExtensions",
1628
+ "allowImportingTsExtensions",
1629
+ "allowUmdGlobalAccess",
1630
+ /* JavaScript Support */
1631
+ "allowJs",
1632
+ "checkJs",
1633
+ "maxNodeModuleJsDepth",
1634
+ /* Type Checking */
1635
+ "strict",
1636
+ "strictBindCallApply",
1637
+ "strictFunctionTypes",
1638
+ "strictNullChecks",
1639
+ "strictPropertyInitialization",
1640
+ "allowUnreachableCode",
1641
+ "allowUnusedLabels",
1642
+ "alwaysStrict",
1643
+ "exactOptionalPropertyTypes",
1644
+ "noFallthroughCasesInSwitch",
1645
+ "noImplicitAny",
1646
+ "noImplicitOverride",
1647
+ "noImplicitReturns",
1648
+ "noImplicitThis",
1649
+ "noPropertyAccessFromIndexSignature",
1650
+ "noUncheckedIndexedAccess",
1651
+ "noUnusedLocals",
1652
+ "noUnusedParameters",
1653
+ "useUnknownInCatchVariables",
1654
+ /* Emit */
1655
+ "declaration",
1656
+ "declarationDir",
1657
+ "declarationMap",
1658
+ "downlevelIteration",
1659
+ "emitBOM",
1660
+ "emitDeclarationOnly",
1661
+ "importHelpers",
1662
+ "importsNotUsedAsValues",
1663
+ "inlineSourceMap",
1664
+ "inlineSources",
1665
+ "mapRoot",
1666
+ "newLine",
1667
+ "noEmit",
1668
+ "noEmitHelpers",
1669
+ "noEmitOnError",
1670
+ "outDir",
1671
+ "outFile",
1672
+ "preserveConstEnums",
1673
+ "preserveValueImports",
1674
+ "removeComments",
1675
+ "sourceMap",
1676
+ "sourceRoot",
1677
+ "stripInternal",
1678
+ /* Interop Constraints */
1679
+ "allowSyntheticDefaultImports",
1680
+ "esModuleInterop",
1681
+ "forceConsistentCasingInFileNames",
1682
+ "isolatedDeclarations",
1683
+ "isolatedModules",
1684
+ "preserveSymlinks",
1685
+ "verbatimModuleSyntax",
1686
+ /* Completeness */
1687
+ "skipDefaultLibCheck",
1688
+ "skipLibCheck"
1689
+ ],
1690
+ pathPattern: "^compilerOptions$"
1691
+ }
1692
+ ]
1693
+ }
1694
+ }
1695
+ ];
1696
+ }
1697
+
1698
+ // src/configs/svelte.ts
1699
+ async function svelte(options = {}) {
1700
+ const {
1701
+ files = [GLOB_SVELTE],
1702
+ overrides = {},
1703
+ stylistic: stylistic2 = true
1704
+ } = options;
1705
+ const {
1706
+ indent = 2,
1707
+ quotes = "single"
1708
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1709
+ await ensurePackages([
1710
+ "eslint-plugin-svelte"
1711
+ ]);
1712
+ const [
1713
+ pluginSvelte,
1714
+ parserSvelte
1715
+ ] = await Promise.all([
1716
+ interopDefault(import("eslint-plugin-svelte")),
1717
+ interopDefault(import("svelte-eslint-parser"))
1718
+ ]);
1719
+ return [
1720
+ {
1721
+ name: "jun/svelte/setup",
1722
+ plugins: {
1723
+ svelte: pluginSvelte
1724
+ }
1725
+ },
1726
+ {
1727
+ files,
1728
+ languageOptions: {
1729
+ parser: parserSvelte,
1730
+ parserOptions: {
1731
+ extraFileExtensions: [".svelte"],
1732
+ parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null
1733
+ }
1734
+ },
1735
+ name: "jun/svelte/rules",
1736
+ processor: pluginSvelte.processors[".svelte"],
1737
+ rules: {
1738
+ "import/no-mutable-exports": "off",
1739
+ "no-undef": "off",
1740
+ // incompatible with most recent (attribute-form) generic types RFC
1741
+ "no-unused-vars": ["error", {
1742
+ args: "none",
1743
+ caughtErrors: "none",
1744
+ ignoreRestSiblings: true,
1745
+ vars: "all",
1746
+ varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1747
+ }],
1748
+ "svelte/comment-directive": "error",
1749
+ "svelte/no-at-debug-tags": "warn",
1750
+ "svelte/no-at-html-tags": "error",
1751
+ "svelte/no-dupe-else-if-blocks": "error",
1752
+ "svelte/no-dupe-style-properties": "error",
1753
+ "svelte/no-dupe-use-directives": "error",
1754
+ "svelte/no-dynamic-slot-name": "error",
1755
+ "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1756
+ "svelte/no-inner-declarations": "error",
1757
+ "svelte/no-not-function-handler": "error",
1758
+ "svelte/no-object-in-text-mustaches": "error",
1759
+ "svelte/no-reactive-functions": "error",
1760
+ "svelte/no-reactive-literals": "error",
1761
+ "svelte/no-shorthand-style-property-overrides": "error",
1762
+ "svelte/no-unknown-style-directive-property": "error",
1763
+ "svelte/no-unused-svelte-ignore": "error",
1764
+ "svelte/no-useless-mustaches": "error",
1765
+ "svelte/require-store-callbacks-use-set-param": "error",
1766
+ "svelte/system": "error",
1767
+ "svelte/valid-each-key": "error",
1768
+ "unused-imports/no-unused-vars": [
1769
+ "error",
1770
+ {
1771
+ args: "after-used",
1772
+ argsIgnorePattern: "^_",
1773
+ vars: "all",
1774
+ varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1775
+ }
1776
+ ],
1777
+ ...stylistic2 ? {
1778
+ "style/indent": "off",
1779
+ // superseded by svelte/indent
1780
+ "style/no-trailing-spaces": "off",
1781
+ // superseded by svelte/no-trailing-spaces
1782
+ "svelte/derived-has-same-inputs-outputs": "error",
1783
+ "svelte/html-closing-bracket-spacing": "error",
1784
+ "svelte/html-quotes": ["error", { prefer: quotes }],
1785
+ "svelte/indent": ["error", { alignAttributesVertically: true, indent }],
1786
+ "svelte/mustache-spacing": "error",
1787
+ "svelte/no-spaces-around-equal-signs-in-attribute": "error",
1788
+ "svelte/no-trailing-spaces": "error",
1789
+ "svelte/spaced-html-comment": "error"
1790
+ } : {},
1791
+ ...overrides
1792
+ }
1793
+ }
1794
+ ];
1795
+ }
1796
+
1797
+ // src/configs/test.ts
1798
+ var _pluginTest;
1799
+ async function test(options = {}) {
1800
+ const {
1801
+ files = GLOB_TESTS,
1802
+ isInEditor = false,
1803
+ overrides = {}
1804
+ } = options;
1805
+ const [
1806
+ pluginVitest,
1807
+ pluginNoOnlyTests
1808
+ ] = await Promise.all([
1809
+ interopDefault(import("@vitest/eslint-plugin")),
1810
+ // @ts-expect-error missing types
1811
+ interopDefault(import("eslint-plugin-no-only-tests"))
1812
+ ]);
1813
+ _pluginTest = _pluginTest || {
1814
+ ...pluginVitest,
1815
+ rules: {
1816
+ ...pluginVitest.rules,
1817
+ // extend `test/no-only-tests` rule
1818
+ ...pluginNoOnlyTests.rules
1819
+ }
1820
+ };
1821
+ return [
1822
+ {
1823
+ name: "jun/test/setup",
1824
+ plugins: {
1825
+ test: _pluginTest
1826
+ }
1827
+ },
1828
+ {
1829
+ files,
1830
+ name: "jun/test/rules",
1831
+ rules: {
1832
+ "node/prefer-global/process": "off",
1833
+ "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1834
+ "test/no-identical-title": "error",
1835
+ "test/no-import-node-test": "error",
1836
+ "test/no-only-tests": isInEditor ? "off" : "error",
1837
+ "test/prefer-hooks-in-order": "error",
1838
+ "test/prefer-lowercase-title": "error",
1839
+ "ts/explicit-function-return-type": "off",
1840
+ ...overrides
1841
+ }
1842
+ }
1843
+ ];
1844
+ }
1845
+
1846
+ // src/configs/toml.ts
1847
+ async function toml(options = {}) {
1848
+ const {
1849
+ files = [GLOB_TOML],
1850
+ overrides = {},
1851
+ stylistic: stylistic2 = true
1852
+ } = options;
1853
+ const {
1854
+ indent = 2
1855
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1856
+ const [
1857
+ pluginToml,
1858
+ parserToml
1859
+ ] = await Promise.all([
1860
+ interopDefault(import("eslint-plugin-toml")),
1861
+ interopDefault(import("toml-eslint-parser"))
1862
+ ]);
1863
+ return [
1864
+ {
1865
+ name: "jun/toml/setup",
1866
+ plugins: {
1867
+ toml: pluginToml
1868
+ }
1869
+ },
1870
+ {
1871
+ files,
1872
+ languageOptions: {
1873
+ parser: parserToml
1874
+ },
1875
+ name: "jun/toml/rules",
1876
+ rules: {
1877
+ "style/spaced-comment": "off",
1878
+ "toml/comma-style": "error",
1879
+ "toml/keys-order": "error",
1880
+ "toml/no-space-dots": "error",
1881
+ "toml/no-unreadable-number-separator": "error",
1882
+ "toml/precision-of-fractional-seconds": "error",
1883
+ "toml/precision-of-integer": "error",
1884
+ "toml/tables-order": "error",
1885
+ "toml/vue-custom-block/no-parsing-error": "error",
1886
+ ...stylistic2 ? {
1887
+ "toml/array-bracket-newline": "error",
1888
+ "toml/array-bracket-spacing": "error",
1889
+ "toml/array-element-newline": "error",
1890
+ "toml/indent": ["error", indent === "tab" ? 2 : indent],
1891
+ "toml/inline-table-curly-spacing": "error",
1892
+ "toml/key-spacing": "error",
1893
+ "toml/padding-line-between-pairs": "error",
1894
+ "toml/padding-line-between-tables": "error",
1895
+ "toml/quoted-keys": "error",
1896
+ "toml/spaced-comment": "error",
1897
+ "toml/table-bracket-spacing": "error"
1898
+ } : {},
1899
+ ...overrides
1900
+ }
1901
+ }
1902
+ ];
1903
+ }
1904
+
1905
+ // src/configs/typescript.ts
1906
+ var import_node_process2 = __toESM(require("process"), 1);
1907
+ async function typescript(options = {}) {
1908
+ const {
1909
+ componentExts = [],
1910
+ overrides = {},
1911
+ overridesTypeAware = {},
1912
+ parserOptions = {},
1913
+ type = "app"
1914
+ } = options;
1915
+ const files = options.files ?? [
1916
+ GLOB_TS,
1917
+ GLOB_TSX,
1918
+ ...componentExts.map((ext) => `**/*.${ext}`)
1919
+ ];
1920
+ const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1921
+ const ignoresTypeAware = options.ignoresTypeAware ?? [
1922
+ `${GLOB_MARKDOWN}/**`,
1923
+ GLOB_ASTRO_TS
1924
+ ];
1925
+ const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
1926
+ const isTypeAware = !!tsconfigPath;
1927
+ const typeAwareRules = {
1928
+ "dot-notation": "off",
1929
+ "no-implied-eval": "off",
1930
+ "ts/await-thenable": "error",
1931
+ "ts/dot-notation": ["error", { allowKeywords: true }],
1932
+ "ts/no-floating-promises": "error",
1933
+ "ts/no-for-in-array": "error",
1934
+ "ts/no-implied-eval": "error",
1935
+ "ts/no-misused-promises": "error",
1936
+ "ts/no-unnecessary-type-assertion": "error",
1937
+ "ts/no-unsafe-argument": "error",
1938
+ "ts/no-unsafe-assignment": "error",
1939
+ "ts/no-unsafe-call": "error",
1940
+ "ts/no-unsafe-member-access": "error",
1941
+ "ts/no-unsafe-return": "error",
1942
+ "ts/promise-function-async": "error",
1943
+ "ts/restrict-plus-operands": "error",
1944
+ "ts/restrict-template-expressions": "error",
1945
+ "ts/return-await": ["error", "in-try-catch"],
1946
+ "ts/strict-boolean-expressions": ["error", { allowNullableBoolean: true, allowNullableObject: true }],
1947
+ "ts/switch-exhaustiveness-check": "error",
1948
+ "ts/unbound-method": "error"
1949
+ };
1950
+ const [
1951
+ pluginTs,
1952
+ parserTs
1953
+ ] = await Promise.all([
1954
+ interopDefault(import("@typescript-eslint/eslint-plugin")),
1955
+ interopDefault(import("@typescript-eslint/parser"))
1956
+ ]);
1957
+ function makeParser(typeAware, files2, ignores2) {
1958
+ return {
1959
+ files: files2,
1960
+ ...ignores2 ? { ignores: ignores2 } : {},
1961
+ languageOptions: {
1962
+ parser: parserTs,
1963
+ parserOptions: {
1964
+ extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1965
+ sourceType: "module",
1966
+ ...typeAware ? {
1967
+ projectService: {
1968
+ allowDefaultProject: ["./*.js"],
1969
+ defaultProject: tsconfigPath
1970
+ },
1971
+ tsconfigRootDir: import_node_process2.default.cwd()
1972
+ } : {},
1973
+ ...parserOptions
1974
+ }
1975
+ },
1976
+ name: `jun/typescript/${typeAware ? "type-aware-parser" : "parser"}`
1977
+ };
1978
+ }
1979
+ return [
1980
+ {
1981
+ // Install the plugins without globs, so they can be configured separately.
1982
+ name: "jun/typescript/setup",
1983
+ plugins: {
1984
+ jun: import_eslint_plugin_antfu.default,
1985
+ ts: pluginTs
1986
+ }
1987
+ },
1988
+ // assign type-aware parser for type-aware files and type-unaware parser for the rest
1989
+ ...isTypeAware ? [
1990
+ makeParser(false, files),
1991
+ makeParser(true, filesTypeAware, ignoresTypeAware)
1992
+ ] : [
1993
+ makeParser(false, files)
1994
+ ],
1995
+ {
1996
+ files,
1997
+ name: "jun/typescript/rules",
1998
+ rules: {
1999
+ ...renameRules(
2000
+ pluginTs.configs["eslint-recommended"].overrides[0].rules,
2001
+ { "@typescript-eslint": "ts" }
2002
+ ),
2003
+ ...renameRules(
2004
+ pluginTs.configs.strict.rules,
2005
+ { "@typescript-eslint": "ts" }
2006
+ ),
2007
+ "no-dupe-class-members": "off",
2008
+ "no-loss-of-precision": "off",
2009
+ "no-redeclare": "off",
2010
+ "no-use-before-define": "off",
2011
+ "no-useless-constructor": "off",
2012
+ "ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
2013
+ "ts/consistent-type-definitions": ["error", "interface"],
2014
+ "ts/consistent-type-imports": ["error", {
2015
+ disallowTypeAnnotations: false,
2016
+ prefer: "type-imports"
2017
+ }],
2018
+ "ts/method-signature-style": ["error", "property"],
2019
+ // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
2020
+ "ts/no-dupe-class-members": "error",
2021
+ "ts/no-dynamic-delete": "off",
2022
+ "ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
2023
+ "ts/no-explicit-any": "off",
2024
+ "ts/no-extraneous-class": "off",
2025
+ "ts/no-import-type-side-effects": "error",
2026
+ "ts/no-invalid-void-type": "off",
2027
+ "ts/no-loss-of-precision": "error",
2028
+ "ts/no-non-null-assertion": "off",
2029
+ "ts/no-redeclare": "error",
2030
+ "ts/no-require-imports": "error",
2031
+ "ts/no-unused-vars": "off",
2032
+ "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
2033
+ "ts/no-useless-constructor": "off",
2034
+ "ts/no-wrapper-object-types": "error",
2035
+ "ts/triple-slash-reference": "off",
2036
+ "ts/unified-signatures": "off",
2037
+ ...type === "lib" ? {
2038
+ "ts/explicit-function-return-type": ["error", {
2039
+ allowExpressions: true,
2040
+ allowHigherOrderFunctions: true,
2041
+ allowIIFEs: true
2042
+ }]
2043
+ } : {},
2044
+ ...overrides
2045
+ }
2046
+ },
2047
+ ...isTypeAware ? [{
2048
+ files: filesTypeAware,
2049
+ ignores: ignoresTypeAware,
2050
+ name: "jun/typescript/rules-type-aware",
2051
+ rules: {
2052
+ ...typeAwareRules,
2053
+ ...overridesTypeAware
2054
+ }
2055
+ }] : [],
2056
+ {
2057
+ files: ["**/*.d.?([cm])ts"],
2058
+ name: "jun/typescript/disables/dts",
2059
+ rules: {
2060
+ "eslint-comments/no-unlimited-disable": "off",
2061
+ "import/no-duplicates": "off",
2062
+ "no-restricted-syntax": "off",
2063
+ "unused-imports/no-unused-vars": "off"
2064
+ }
2065
+ },
2066
+ {
2067
+ files: ["**/*.{test,spec}.ts?(x)"],
2068
+ name: "jun/typescript/disables/test",
2069
+ rules: {
2070
+ "no-unused-expressions": "off"
2071
+ }
2072
+ },
2073
+ {
2074
+ files: ["**/*.js", "**/*.cjs"],
2075
+ name: "jun/typescript/disables/cjs",
2076
+ rules: {
2077
+ "ts/no-require-imports": "off",
2078
+ "ts/no-var-requires": "off"
2079
+ }
2080
+ }
2081
+ ];
2082
+ }
2083
+
2084
+ // src/configs/unicorn.ts
2085
+ async function unicorn() {
2086
+ return [
2087
+ {
2088
+ name: "jun/unicorn/rules",
2089
+ plugins: {
2090
+ unicorn: import_eslint_plugin_unicorn.default
2091
+ },
2092
+ rules: {
2093
+ // Pass error message when throwing errors
2094
+ "unicorn/error-message": "error",
2095
+ // Uppercase regex escapes
2096
+ "unicorn/escape-case": "error",
2097
+ // Array.isArray instead of instanceof
2098
+ "unicorn/no-instanceof-array": "error",
2099
+ // Ban `new Array` as `Array` constructor's params are ambiguous
2100
+ "unicorn/no-new-array": "error",
2101
+ // Prevent deprecated `new Buffer()`
2102
+ "unicorn/no-new-buffer": "error",
2103
+ // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
2104
+ "unicorn/number-literal-case": "error",
2105
+ // textContent instead of innerText
2106
+ "unicorn/prefer-dom-node-text-content": "error",
2107
+ // includes over indexOf when checking for existence
2108
+ "unicorn/prefer-includes": "error",
2109
+ // Prefer using the node: protocol
2110
+ "unicorn/prefer-node-protocol": "error",
2111
+ // Prefer using number properties like `Number.isNaN` rather than `isNaN`
2112
+ "unicorn/prefer-number-properties": "error",
2113
+ // String methods startsWith/endsWith instead of more complicated stuff
2114
+ "unicorn/prefer-string-starts-ends-with": "error",
2115
+ // Enforce throwing type error when throwing error while checking typeof
2116
+ "unicorn/prefer-type-error": "error",
2117
+ // Use new when throwing error
2118
+ "unicorn/throw-new-error": "error"
2119
+ }
2120
+ }
2121
+ ];
2122
+ }
2123
+
2124
+ // src/configs/unocss.ts
2125
+ async function unocss(options = {}) {
2126
+ const {
2127
+ attributify = true,
2128
+ strict = false
2129
+ } = options;
2130
+ await ensurePackages([
2131
+ "@unocss/eslint-plugin"
2132
+ ]);
2133
+ const [
2134
+ pluginUnoCSS
2135
+ ] = await Promise.all([
2136
+ interopDefault(import("@unocss/eslint-plugin"))
2137
+ ]);
2138
+ return [
2139
+ {
2140
+ name: "jun/unocss",
2141
+ plugins: {
2142
+ unocss: pluginUnoCSS
2143
+ },
2144
+ rules: {
2145
+ "unocss/order": "warn",
2146
+ ...attributify ? {
2147
+ "unocss/order-attributify": "warn"
2148
+ } : {},
2149
+ ...strict ? {
2150
+ "unocss/blocklist": "error"
2151
+ } : {}
2152
+ }
2153
+ }
2154
+ ];
2155
+ }
2156
+
2157
+ // src/configs/vue.ts
2158
+ var import_eslint_merge_processors2 = require("eslint-merge-processors");
2159
+ async function vue(options = {}) {
2160
+ const {
2161
+ files = [GLOB_VUE],
2162
+ overrides = {},
2163
+ stylistic: stylistic2 = true,
2164
+ vueVersion = 3
2165
+ } = options;
2166
+ const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
2167
+ const {
2168
+ indent = 2
2169
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
2170
+ const [
2171
+ pluginVue,
2172
+ parserVue,
2173
+ processorVueBlocks
2174
+ ] = await Promise.all([
2175
+ // @ts-expect-error missing types
2176
+ interopDefault(import("eslint-plugin-vue")),
2177
+ interopDefault(import("vue-eslint-parser")),
2178
+ interopDefault(import("eslint-processor-vue-blocks"))
2179
+ ]);
2180
+ return [
2181
+ {
2182
+ // This allows Vue plugin to work with auto imports
2183
+ // https://github.com/vuejs/eslint-plugin-vue/pull/2422
2184
+ languageOptions: {
2185
+ globals: {
2186
+ computed: "readonly",
2187
+ defineEmits: "readonly",
2188
+ defineExpose: "readonly",
2189
+ defineProps: "readonly",
2190
+ onMounted: "readonly",
2191
+ onUnmounted: "readonly",
2192
+ reactive: "readonly",
2193
+ ref: "readonly",
2194
+ shallowReactive: "readonly",
2195
+ shallowRef: "readonly",
2196
+ toRef: "readonly",
2197
+ toRefs: "readonly",
2198
+ watch: "readonly",
2199
+ watchEffect: "readonly"
2200
+ }
2201
+ },
2202
+ name: "jun/vue/setup",
2203
+ plugins: {
2204
+ vue: pluginVue
2205
+ }
2206
+ },
2207
+ {
2208
+ files,
2209
+ languageOptions: {
2210
+ parser: parserVue,
2211
+ parserOptions: {
2212
+ ecmaFeatures: {
2213
+ jsx: true
2214
+ },
2215
+ extraFileExtensions: [".vue"],
2216
+ parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
2217
+ sourceType: "module"
2218
+ }
2219
+ },
2220
+ name: "jun/vue/rules",
2221
+ processor: sfcBlocks === false ? pluginVue.processors[".vue"] : (0, import_eslint_merge_processors2.mergeProcessors)([
2222
+ pluginVue.processors[".vue"],
2223
+ processorVueBlocks({
2224
+ ...sfcBlocks,
2225
+ blocks: {
2226
+ styles: true,
2227
+ ...sfcBlocks.blocks
2228
+ }
2229
+ })
2230
+ ]),
2231
+ rules: {
2232
+ ...pluginVue.configs.base.rules,
2233
+ ...vueVersion === 2 ? {
2234
+ ...pluginVue.configs.essential.rules,
2235
+ ...pluginVue.configs["strongly-recommended"].rules,
2236
+ ...pluginVue.configs.recommended.rules
2237
+ } : {
2238
+ ...pluginVue.configs["vue3-essential"].rules,
2239
+ ...pluginVue.configs["vue3-strongly-recommended"].rules,
2240
+ ...pluginVue.configs["vue3-recommended"].rules
2241
+ },
2242
+ "node/prefer-global/process": "off",
2243
+ "vue/block-order": ["error", {
2244
+ order: ["script", "template", "style"]
2245
+ }],
2246
+ "vue/component-name-in-template-casing": ["error", "PascalCase"],
2247
+ "vue/component-options-name-casing": ["error", "PascalCase"],
2248
+ // this is deprecated
2249
+ "vue/component-tags-order": "off",
2250
+ "vue/custom-event-name-casing": ["error", "camelCase"],
2251
+ "vue/define-macros-order": ["error", {
2252
+ order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
2253
+ }],
2254
+ "vue/dot-location": ["error", "property"],
2255
+ "vue/dot-notation": ["error", { allowKeywords: true }],
2256
+ "vue/eqeqeq": ["error", "smart"],
2257
+ "vue/html-indent": ["error", indent],
2258
+ "vue/html-quotes": ["error", "double"],
2259
+ "vue/max-attributes-per-line": "off",
2260
+ "vue/multi-word-component-names": "off",
2261
+ "vue/no-dupe-keys": "off",
2262
+ "vue/no-empty-pattern": "error",
2263
+ "vue/no-irregular-whitespace": "error",
2264
+ "vue/no-loss-of-precision": "error",
2265
+ "vue/no-restricted-syntax": [
2266
+ "error",
2267
+ "DebuggerStatement",
2268
+ "LabeledStatement",
2269
+ "WithStatement"
2270
+ ],
2271
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
2272
+ "vue/no-setup-props-reactivity-loss": "off",
2273
+ "vue/no-sparse-arrays": "error",
2274
+ "vue/no-unused-refs": "error",
2275
+ "vue/no-useless-v-bind": "error",
2276
+ "vue/no-v-html": "off",
2277
+ "vue/object-shorthand": [
2278
+ "error",
2279
+ "always",
2280
+ {
2281
+ avoidQuotes: true,
2282
+ ignoreConstructors: false
2283
+ }
2284
+ ],
2285
+ "vue/prefer-separate-static-class": "error",
2286
+ "vue/prefer-template": "error",
2287
+ "vue/prop-name-casing": ["error", "camelCase"],
2288
+ "vue/require-default-prop": "off",
2289
+ "vue/require-prop-types": "off",
2290
+ "vue/space-infix-ops": "error",
2291
+ "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
2292
+ ...stylistic2 ? {
2293
+ "vue/array-bracket-spacing": ["error", "never"],
2294
+ "vue/arrow-spacing": ["error", { after: true, before: true }],
2295
+ "vue/block-spacing": ["error", "always"],
2296
+ "vue/block-tag-newline": ["error", {
2297
+ multiline: "always",
2298
+ singleline: "always"
2299
+ }],
2300
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
2301
+ "vue/comma-dangle": ["error", "always-multiline"],
2302
+ "vue/comma-spacing": ["error", { after: true, before: false }],
2303
+ "vue/comma-style": ["error", "last"],
2304
+ "vue/html-comment-content-spacing": ["error", "always", {
2305
+ exceptions: ["-"]
2306
+ }],
2307
+ "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
2308
+ "vue/keyword-spacing": ["error", { after: true, before: true }],
2309
+ "vue/object-curly-newline": "off",
2310
+ "vue/object-curly-spacing": ["error", "always"],
2311
+ "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
2312
+ "vue/operator-linebreak": ["error", "before"],
2313
+ "vue/padding-line-between-blocks": ["error", "always"],
2314
+ "vue/quote-props": ["error", "consistent-as-needed"],
2315
+ "vue/space-in-parens": ["error", "never"],
2316
+ "vue/template-curly-spacing": "error"
2317
+ } : {},
2318
+ ...overrides
2319
+ }
2320
+ }
2321
+ ];
2322
+ }
2323
+
2324
+ // src/configs/yaml.ts
2325
+ async function yaml(options = {}) {
2326
+ const {
2327
+ files = [GLOB_YAML],
2328
+ overrides = {},
2329
+ stylistic: stylistic2 = true
2330
+ } = options;
2331
+ const {
2332
+ indent = 2,
2333
+ quotes = "single"
2334
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
2335
+ const [
2336
+ pluginYaml,
2337
+ parserYaml
2338
+ ] = await Promise.all([
2339
+ interopDefault(import("eslint-plugin-yml")),
2340
+ interopDefault(import("yaml-eslint-parser"))
2341
+ ]);
2342
+ return [
2343
+ {
2344
+ name: "jun/yaml/setup",
2345
+ plugins: {
2346
+ yaml: pluginYaml
2347
+ }
2348
+ },
2349
+ {
2350
+ files,
2351
+ languageOptions: {
2352
+ parser: parserYaml
2353
+ },
2354
+ name: "jun/yaml/rules",
2355
+ rules: {
2356
+ "style/spaced-comment": "off",
2357
+ "yaml/block-mapping": "error",
2358
+ "yaml/block-sequence": "error",
2359
+ "yaml/no-empty-key": "error",
2360
+ "yaml/no-empty-sequence-entry": "error",
2361
+ "yaml/no-irregular-whitespace": "error",
2362
+ "yaml/plain-scalar": "error",
2363
+ "yaml/vue-custom-block/no-parsing-error": "error",
2364
+ ...stylistic2 ? {
2365
+ "yaml/block-mapping-question-indicator-newline": "error",
2366
+ "yaml/block-sequence-hyphen-indicator-newline": "error",
2367
+ "yaml/flow-mapping-curly-newline": "error",
2368
+ "yaml/flow-mapping-curly-spacing": "error",
2369
+ "yaml/flow-sequence-bracket-newline": "error",
2370
+ "yaml/flow-sequence-bracket-spacing": "error",
2371
+ "yaml/indent": ["error", indent === "tab" ? 2 : indent],
2372
+ "yaml/key-spacing": "error",
2373
+ "yaml/no-tab-indent": "error",
2374
+ "yaml/quotes": ["error", { avoidEscape: false, prefer: quotes }],
2375
+ "yaml/spaced-comment": "error"
2376
+ } : {},
2377
+ ...overrides
2378
+ }
2379
+ }
2380
+ ];
2381
+ }
2382
+
2383
+ // src/configs/regexp.ts
2384
+ var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
2385
+ async function regexp(options = {}) {
2386
+ const config = import_eslint_plugin_regexp.configs["flat/recommended"];
2387
+ const rules = {
2388
+ ...config.rules
2389
+ };
2390
+ if (options.level === "warn") {
2391
+ for (const key in rules) {
2392
+ if (rules[key] === "error")
2393
+ rules[key] = "warn";
2394
+ }
2395
+ }
2396
+ return [
2397
+ {
2398
+ ...config,
2399
+ name: "jun/regexp/rules",
2400
+ rules: {
2401
+ ...rules,
2402
+ ...options.overrides
2403
+ }
2404
+ }
2405
+ ];
2406
+ }
2407
+
2408
+ // src/factory.ts
2409
+ var flatConfigProps = [
2410
+ "name",
2411
+ "files",
2412
+ "ignores",
2413
+ "languageOptions",
2414
+ "linterOptions",
2415
+ "processor",
2416
+ "plugins",
2417
+ "rules",
2418
+ "settings"
2419
+ ];
2420
+ var VuePackages = [
2421
+ "vue",
2422
+ "nuxt",
2423
+ "vitepress",
2424
+ "@slidev/cli"
2425
+ ];
2426
+ var defaultPluginRenaming = {
2427
+ "@eslint-react": "react",
2428
+ "@eslint-react/dom": "react-dom",
2429
+ "@eslint-react/hooks-extra": "react-hooks-extra",
2430
+ "@eslint-react/naming-convention": "react-naming-convention",
2431
+ "@stylistic": "style",
2432
+ "@typescript-eslint": "ts",
2433
+ "import-x": "import",
2434
+ "n": "node",
2435
+ "vitest": "test",
2436
+ "yml": "yaml"
2437
+ };
2438
+ function jun(options = {}, ...userConfigs) {
2439
+ const {
2440
+ astro: enableAstro = false,
2441
+ autoRenamePlugins = true,
2442
+ componentExts = [],
2443
+ gitignore: enableGitignore = true,
2444
+ jsx: enableJsx = true,
2445
+ react: enableReact = false,
2446
+ regexp: enableRegexp = true,
2447
+ solid: enableSolid = false,
2448
+ svelte: enableSvelte = false,
2449
+ typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
2450
+ unocss: enableUnoCSS = false,
2451
+ vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
2452
+ } = options;
2453
+ let isInEditor = options.isInEditor;
2454
+ if (isInEditor == null) {
2455
+ isInEditor = isInEditorEnv();
2456
+ if (isInEditor)
2457
+ console.log("[@jun2030/eslint-config] Detected running in editor, some rules are disabled.");
2458
+ }
2459
+ const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2460
+ if (stylisticOptions && !("jsx" in stylisticOptions))
2461
+ stylisticOptions.jsx = enableJsx;
2462
+ const configs2 = [];
2463
+ if (enableGitignore) {
2464
+ if (typeof enableGitignore !== "boolean") {
2465
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
2466
+ } else {
2467
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({ strict: false })]));
2468
+ }
2469
+ }
2470
+ const typescriptOptions = resolveSubOptions(options, "typescript");
2471
+ const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
2472
+ configs2.push(
2473
+ ignores(),
2474
+ javascript({
2475
+ isInEditor,
2476
+ overrides: getOverrides(options, "javascript")
2477
+ }),
2478
+ comments(),
2479
+ node(),
2480
+ jsdoc({
2481
+ stylistic: stylisticOptions
2482
+ }),
2483
+ imports({
2484
+ stylistic: stylisticOptions
2485
+ }),
2486
+ unicorn(),
2487
+ command(),
2488
+ // Optional plugins (installed but not enabled by default)
2489
+ perfectionist()
2490
+ );
2491
+ if (enableVue) {
2492
+ componentExts.push("vue");
2493
+ }
2494
+ if (enableJsx) {
2495
+ configs2.push(jsx());
2496
+ }
2497
+ if (enableTypeScript) {
2498
+ configs2.push(typescript({
2499
+ ...typescriptOptions,
2500
+ componentExts,
2501
+ overrides: getOverrides(options, "typescript"),
2502
+ type: options.type
2503
+ }));
2504
+ }
2505
+ if (stylisticOptions) {
2506
+ configs2.push(stylistic({
2507
+ ...stylisticOptions,
2508
+ lessOpinionated: options.lessOpinionated,
2509
+ overrides: getOverrides(options, "stylistic")
2510
+ }));
2511
+ }
2512
+ if (enableRegexp) {
2513
+ configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
2514
+ }
2515
+ if (options.test ?? true) {
2516
+ configs2.push(test({
2517
+ isInEditor,
2518
+ overrides: getOverrides(options, "test")
2519
+ }));
2520
+ }
2521
+ if (enableVue) {
2522
+ configs2.push(vue({
2523
+ ...resolveSubOptions(options, "vue"),
2524
+ overrides: getOverrides(options, "vue"),
2525
+ stylistic: stylisticOptions,
2526
+ typescript: !!enableTypeScript
2527
+ }));
2528
+ }
2529
+ if (enableReact) {
2530
+ configs2.push(react({
2531
+ overrides: getOverrides(options, "react"),
2532
+ tsconfigPath
2533
+ }));
2534
+ }
2535
+ if (enableSolid) {
2536
+ configs2.push(solid({
2537
+ overrides: getOverrides(options, "solid"),
2538
+ tsconfigPath,
2539
+ typescript: !!enableTypeScript
2540
+ }));
2541
+ }
2542
+ if (enableSvelte) {
2543
+ configs2.push(svelte({
2544
+ overrides: getOverrides(options, "svelte"),
2545
+ stylistic: stylisticOptions,
2546
+ typescript: !!enableTypeScript
2547
+ }));
2548
+ }
2549
+ if (enableUnoCSS) {
2550
+ configs2.push(unocss({
2551
+ ...resolveSubOptions(options, "unocss"),
2552
+ overrides: getOverrides(options, "unocss")
2553
+ }));
2554
+ }
2555
+ if (enableAstro) {
2556
+ configs2.push(astro({
2557
+ overrides: getOverrides(options, "astro"),
2558
+ stylistic: stylisticOptions
2559
+ }));
2560
+ }
2561
+ if (options.jsonc ?? true) {
2562
+ configs2.push(
2563
+ jsonc({
2564
+ overrides: getOverrides(options, "jsonc"),
2565
+ stylistic: stylisticOptions
2566
+ }),
2567
+ sortPackageJson(),
2568
+ sortTsconfig()
2569
+ );
2570
+ }
2571
+ if (options.yaml ?? true) {
2572
+ configs2.push(yaml({
2573
+ overrides: getOverrides(options, "yaml"),
2574
+ stylistic: stylisticOptions
2575
+ }));
2576
+ }
2577
+ if (options.toml ?? true) {
2578
+ configs2.push(toml({
2579
+ overrides: getOverrides(options, "toml"),
2580
+ stylistic: stylisticOptions
2581
+ }));
2582
+ }
2583
+ if (options.markdown ?? true) {
2584
+ configs2.push(
2585
+ markdown(
2586
+ {
2587
+ componentExts,
2588
+ overrides: getOverrides(options, "markdown")
2589
+ }
2590
+ )
2591
+ );
2592
+ }
2593
+ if (options.formatters) {
2594
+ configs2.push(formatters(
2595
+ options.formatters,
2596
+ typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2597
+ ));
2598
+ }
2599
+ const fusedConfig = flatConfigProps.reduce((acc, key) => {
2600
+ if (key in options)
2601
+ acc[key] = options[key];
2602
+ return acc;
2603
+ }, {});
2604
+ if (Object.keys(fusedConfig).length)
2605
+ configs2.push([fusedConfig]);
2606
+ let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
2607
+ composer = composer.append(
2608
+ ...configs2,
2609
+ ...userConfigs
2610
+ );
2611
+ if (autoRenamePlugins) {
2612
+ composer = composer.renamePlugins(defaultPluginRenaming);
2613
+ }
2614
+ return composer;
2615
+ }
2616
+ function resolveSubOptions(options, key) {
2617
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
2618
+ }
2619
+ function getOverrides(options, key) {
2620
+ const sub = resolveSubOptions(options, key);
2621
+ return {
2622
+ ...options.overrides?.[key],
2623
+ ..."overrides" in sub ? sub.overrides : {}
2624
+ };
2625
+ }
2626
+
2627
+ // src/index.ts
2628
+ var src_default = jun;
2629
+ // Annotate the CommonJS export names for ESM import in node:
2630
+ 0 && (module.exports = {
2631
+ GLOB_ALL_SRC,
2632
+ GLOB_ASTRO,
2633
+ GLOB_ASTRO_TS,
2634
+ GLOB_CSS,
2635
+ GLOB_EXCLUDE,
2636
+ GLOB_GRAPHQL,
2637
+ GLOB_HTML,
2638
+ GLOB_JS,
2639
+ GLOB_JSON,
2640
+ GLOB_JSON5,
2641
+ GLOB_JSONC,
2642
+ GLOB_JSX,
2643
+ GLOB_LESS,
2644
+ GLOB_MARKDOWN,
2645
+ GLOB_MARKDOWN_CODE,
2646
+ GLOB_MARKDOWN_IN_MARKDOWN,
2647
+ GLOB_POSTCSS,
2648
+ GLOB_SCSS,
2649
+ GLOB_SRC,
2650
+ GLOB_SRC_EXT,
2651
+ GLOB_STYLE,
2652
+ GLOB_SVELTE,
2653
+ GLOB_SVG,
2654
+ GLOB_TESTS,
2655
+ GLOB_TOML,
2656
+ GLOB_TS,
2657
+ GLOB_TSX,
2658
+ GLOB_VUE,
2659
+ GLOB_XML,
2660
+ GLOB_YAML,
2661
+ StylisticConfigDefaults,
2662
+ astro,
2663
+ combine,
2664
+ command,
2665
+ comments,
2666
+ defaultPluginRenaming,
2667
+ ensurePackages,
2668
+ formatters,
2669
+ getOverrides,
2670
+ ignores,
2671
+ imports,
2672
+ interopDefault,
2673
+ isInEditorEnv,
2674
+ isInGitHooksOrLintStaged,
2675
+ isPackageInScope,
2676
+ javascript,
2677
+ jsdoc,
2678
+ jsonc,
2679
+ jsx,
2680
+ jun,
2681
+ markdown,
2682
+ node,
2683
+ parserPlain,
2684
+ perfectionist,
2685
+ react,
2686
+ regexp,
2687
+ renamePluginInConfigs,
2688
+ renameRules,
2689
+ resolveSubOptions,
2690
+ solid,
2691
+ sortPackageJson,
2692
+ sortTsconfig,
2693
+ stylistic,
2694
+ svelte,
2695
+ test,
2696
+ toArray,
2697
+ toml,
2698
+ typescript,
2699
+ unicorn,
2700
+ unocss,
2701
+ vue,
2702
+ yaml
2703
+ });