@eienjs/eslint-config 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1861 @@
1
+ import { isPackageExists } from "local-pkg";
2
+ import process from "node:process";
3
+ import { fileURLToPath } from "node:url";
4
+ import createCommand from "eslint-plugin-command/config";
5
+ import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
6
+ import pluginAntfu from "eslint-plugin-antfu";
7
+ import pluginImportLite from "eslint-plugin-import-lite";
8
+ import pluginNode from "eslint-plugin-n";
9
+ import pluginPerfectionist from "eslint-plugin-perfectionist";
10
+ import pluginUnicorn from "eslint-plugin-unicorn";
11
+ import pluginUnusedImports from "eslint-plugin-unused-imports";
12
+ import globals from "globals";
13
+ import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
14
+ import { configs } from "eslint-plugin-regexp";
15
+
16
+ //#region src/globs.ts
17
+ const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
18
+ const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
19
+ const GLOB_JS = "**/*.?([cm])js";
20
+ const GLOB_JSX = "**/*.?([cm])jsx";
21
+ const GLOB_TS = "**/*.?([cm])ts";
22
+ const GLOB_TSX = "**/*.?([cm])tsx";
23
+ const GLOB_STYLE = "**/*.{c,le,sc}ss";
24
+ const GLOB_CSS = "**/*.css";
25
+ const GLOB_POSTCSS = "**/*.{p,post}css";
26
+ const GLOB_LESS = "**/*.less";
27
+ const GLOB_SCSS = "**/*.scss";
28
+ const GLOB_JSON = "**/*.json";
29
+ const GLOB_JSON5 = "**/*.json5";
30
+ const GLOB_JSONC = "**/*.jsonc";
31
+ const GLOB_MARKDOWN = "**/*.md";
32
+ const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
33
+ const GLOB_VUE = "**/*.vue";
34
+ const GLOB_YAML = "**/*.y?(a)ml";
35
+ const GLOB_TOML = "**/*.toml";
36
+ const GLOB_XML = "**/*.xml";
37
+ const GLOB_SVG = "**/*.svg";
38
+ const GLOB_HTML = "**/*.htm?(l)";
39
+ const GLOB_ASTRO = "**/*.astro";
40
+ const GLOB_ASTRO_TS = "**/*.astro/*.ts";
41
+ const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
42
+ const GLOB_TESTS = [
43
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
44
+ `**/*.spec.${GLOB_SRC_EXT}`,
45
+ `**/*.test.${GLOB_SRC_EXT}`,
46
+ `**/*.bench.${GLOB_SRC_EXT}`,
47
+ `**/*.benchmark.${GLOB_SRC_EXT}`
48
+ ];
49
+ const GLOB_ALL_SRC = [
50
+ GLOB_SRC,
51
+ GLOB_STYLE,
52
+ GLOB_JSON,
53
+ GLOB_JSON5,
54
+ GLOB_MARKDOWN,
55
+ GLOB_VUE,
56
+ GLOB_YAML,
57
+ GLOB_XML,
58
+ GLOB_HTML
59
+ ];
60
+ const GLOB_EXCLUDE = [
61
+ "**/node_modules",
62
+ "**/dist",
63
+ "**/package-lock.json",
64
+ "**/yarn.lock",
65
+ "**/pnpm-lock.yaml",
66
+ "**/bun.lockb",
67
+ "**/output",
68
+ "**/coverage",
69
+ "**/temp",
70
+ "**/.temp",
71
+ "**/tmp",
72
+ "**/.tmp",
73
+ "**/.history",
74
+ "**/.vitepress/cache",
75
+ "**/.nuxt",
76
+ "**/.next",
77
+ "**/.svelte-kit",
78
+ "**/.vercel",
79
+ "**/.changeset",
80
+ "**/.idea",
81
+ "**/.cache",
82
+ "**/.output",
83
+ "**/.vite-inspect",
84
+ "**/.yarn",
85
+ "**/vite.config.*.timestamp-*",
86
+ "**/CHANGELOG*.md",
87
+ "**/*.min.*",
88
+ "**/LICENSE*",
89
+ "**/__snapshots__",
90
+ "**/auto-import?(s).d.ts",
91
+ "**/components.d.ts"
92
+ ];
93
+
94
+ //#endregion
95
+ //#region src/utils.ts
96
+ const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
97
+ const isCwdInScope = isPackageExists("@eienjs/eslint-config");
98
+ const parserPlain = {
99
+ meta: { name: "parser-plain" },
100
+ parseForESLint: (code) => ({
101
+ ast: {
102
+ body: [],
103
+ comments: [],
104
+ loc: {
105
+ end: code.length,
106
+ start: 0
107
+ },
108
+ range: [0, code.length],
109
+ tokens: [],
110
+ type: "Program"
111
+ },
112
+ scopeManager: null,
113
+ services: { isPlain: true },
114
+ visitorKeys: { Program: [] }
115
+ })
116
+ };
117
+ /**
118
+ * Combine array and non-array configs into a single array.
119
+ */
120
+ async function combine(...configs$1) {
121
+ const resolved = await Promise.all(configs$1);
122
+ return resolved.flat();
123
+ }
124
+ function toArray(value) {
125
+ return Array.isArray(value) ? value : [value];
126
+ }
127
+ async function interopDefault(m) {
128
+ const resolved = await m;
129
+ return resolved.default || resolved;
130
+ }
131
+ function isPackageInScope(name) {
132
+ return isPackageExists(name, { paths: [scopeUrl] });
133
+ }
134
+ async function ensurePackages(packages) {
135
+ if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false) return;
136
+ const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
137
+ if (nonExistingPackages.length === 0) return;
138
+ const p = await import("@clack/prompts");
139
+ const result = await p.confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` });
140
+ if (result) await import("@antfu/install-pkg").then(async (i) => i.installPackage(nonExistingPackages, { dev: true }));
141
+ }
142
+ function isInEditorEnv() {
143
+ if (process.env.CI) return false;
144
+ if (isInGitHooksOrLintStaged()) return false;
145
+ return Boolean(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
146
+ }
147
+ function isInGitHooksOrLintStaged() {
148
+ return Boolean(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
149
+ }
150
+
151
+ //#endregion
152
+ //#region src/configs/astro.ts
153
+ async function astro(options = {}) {
154
+ const { files = [GLOB_ASTRO], overrides = {}, stylistic: stylistic$1 = true } = options;
155
+ const [pluginAstro, parserAstro, parserTs] = await Promise.all([
156
+ interopDefault(import("eslint-plugin-astro")),
157
+ interopDefault(import("astro-eslint-parser")),
158
+ interopDefault(import("@typescript-eslint/parser"))
159
+ ]);
160
+ return [{
161
+ name: "eienjs/astro/setup",
162
+ plugins: { astro: pluginAstro }
163
+ }, {
164
+ files,
165
+ languageOptions: {
166
+ globals: pluginAstro.environments.astro.globals,
167
+ parser: parserAstro,
168
+ parserOptions: {
169
+ extraFileExtensions: [".astro"],
170
+ parser: parserTs
171
+ },
172
+ sourceType: "module"
173
+ },
174
+ name: "eienjs/astro/rules",
175
+ processor: "astro/client-side-ts",
176
+ rules: {
177
+ "antfu/no-top-level-await": "off",
178
+ "astro/missing-client-only-directive-value": "error",
179
+ "astro/no-conflict-set-directives": "error",
180
+ "astro/no-deprecated-astro-canonicalurl": "error",
181
+ "astro/no-deprecated-astro-fetchcontent": "error",
182
+ "astro/no-deprecated-astro-resolve": "error",
183
+ "astro/no-deprecated-getentrybyslug": "error",
184
+ "astro/no-set-html-directive": "off",
185
+ "astro/no-unused-define-vars-in-style": "error",
186
+ "astro/semi": "off",
187
+ "astro/valid-compile": "error",
188
+ ...stylistic$1 ? {} : {
189
+ "@stylistic/indent": "off",
190
+ "@stylistic/jsx-closing-tag-location": "off",
191
+ "@stylistic/jsx-one-expression-per-line": "off",
192
+ "@stylistic/no-multiple-empty-lines": "off"
193
+ },
194
+ ...overrides
195
+ }
196
+ }];
197
+ }
198
+
199
+ //#endregion
200
+ //#region src/configs/command.ts
201
+ async function command() {
202
+ return [{
203
+ ...createCommand(),
204
+ name: "eienjs/command/rules"
205
+ }];
206
+ }
207
+
208
+ //#endregion
209
+ //#region src/configs/comments.ts
210
+ async function comments() {
211
+ return [{
212
+ name: "eienjs/eslint-comments/rules",
213
+ plugins: { "@eslint-community/eslint-comments": pluginComments },
214
+ rules: {
215
+ "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
216
+ "@eslint-community/eslint-comments/no-aggregating-enable": "error",
217
+ "@eslint-community/eslint-comments/no-duplicate-disable": "error",
218
+ "@eslint-community/eslint-comments/no-unlimited-disable": "error",
219
+ "@eslint-community/eslint-comments/no-unused-enable": "error"
220
+ }
221
+ }];
222
+ }
223
+
224
+ //#endregion
225
+ //#region src/configs/disables.ts
226
+ async function disables() {
227
+ return [
228
+ {
229
+ files: [`**/scripts/${GLOB_SRC}`],
230
+ name: "eienjs/disables/scripts",
231
+ rules: {
232
+ "antfu/no-top-level-await": "off",
233
+ "no-console": "off",
234
+ "@typescript-eslint/explicit-function-return-type": "off"
235
+ }
236
+ },
237
+ {
238
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
239
+ name: "eienjs/disables/bin",
240
+ rules: {
241
+ "antfu/no-import-dist": "off",
242
+ "antfu/no-import-node-modules-by-path": "off"
243
+ }
244
+ },
245
+ {
246
+ files: ["**/*.d.?([cm])ts"],
247
+ name: "eienjs/disables/dts",
248
+ rules: {
249
+ "@eslint-community/eslint-comments/no-unlimited-disable": "off",
250
+ "no-restricted-syntax": "off",
251
+ "unused-imports/no-unused-vars": "off"
252
+ }
253
+ },
254
+ {
255
+ files: ["**/*.js", "**/*.cjs"],
256
+ name: "eienjs/disables/cjs",
257
+ rules: { "@typescript-eslint/no-require-imports": "off" }
258
+ },
259
+ {
260
+ files: [GLOB_MARKDOWN],
261
+ name: "eienjs/disables/markdown",
262
+ rules: { "unicorn/filename-case": "off" }
263
+ },
264
+ {
265
+ files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
266
+ name: "eienjs/disables/config-files",
267
+ rules: {
268
+ "antfu/no-top-level-await": "off",
269
+ "no-console": "off",
270
+ "@typescript-eslint/explicit-function-return-type": "off"
271
+ }
272
+ }
273
+ ];
274
+ }
275
+
276
+ //#endregion
277
+ //#region src/configs/stylistic.ts
278
+ const StylisticConfigDefaults = {
279
+ indent: 2,
280
+ quotes: "single",
281
+ maxLineLength: 120
282
+ };
283
+ async function stylistic(options = {}) {
284
+ const { indent, overrides = {}, quotes, maxLineLength = 120 } = {
285
+ ...StylisticConfigDefaults,
286
+ ...options
287
+ };
288
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
289
+ const config = pluginStylistic.configs.customize({
290
+ indent,
291
+ quotes,
292
+ semi: true
293
+ });
294
+ return [{
295
+ name: "eienjs/stylistic/rules",
296
+ plugins: {
297
+ "antfu": pluginAntfu,
298
+ "@stylistic": pluginStylistic
299
+ },
300
+ rules: {
301
+ ...config.rules,
302
+ "antfu/consistent-chaining": "error",
303
+ "antfu/consistent-list-newline": "error",
304
+ "antfu/top-level-function": "error",
305
+ "@stylistic/max-len": ["error", {
306
+ "code": maxLineLength,
307
+ "ignoreStrings": true,
308
+ "ignoreComments": true
309
+ }],
310
+ "@stylistic/padding-line-between-statements": [
311
+ "error",
312
+ {
313
+ blankLine: "always",
314
+ prev: "*",
315
+ next: ["interface", "type"]
316
+ },
317
+ {
318
+ blankLine: "always",
319
+ next: "return",
320
+ prev: "*"
321
+ }
322
+ ],
323
+ "@stylistic/generator-star-spacing": ["error", {
324
+ after: true,
325
+ before: false
326
+ }],
327
+ "@stylistic/quote-props": ["error", "consistent"],
328
+ "@stylistic/semi": "error",
329
+ "@stylistic/comma-spacing": "error",
330
+ "@stylistic/yield-star-spacing": ["error", {
331
+ after: true,
332
+ before: false
333
+ }],
334
+ ...overrides
335
+ }
336
+ }];
337
+ }
338
+
339
+ //#endregion
340
+ //#region src/configs/formatters.ts
341
+ function mergePrettierOptions(options, overrides = {}) {
342
+ return {
343
+ ...options,
344
+ ...overrides,
345
+ plugins: [...overrides.plugins ?? [], ...options.plugins ?? []]
346
+ };
347
+ }
348
+ async function formatters(options = {}, stylistic$1 = {}) {
349
+ if (options === true) {
350
+ const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
351
+ options = {
352
+ astro: isPackageInScope("prettier-plugin-astro"),
353
+ css: true,
354
+ html: true,
355
+ markdown: true,
356
+ svg: isPrettierPluginXmlInScope,
357
+ xml: isPrettierPluginXmlInScope
358
+ };
359
+ }
360
+ await ensurePackages([
361
+ "eslint-plugin-format",
362
+ options.astro ? "prettier-plugin-astro" : void 0,
363
+ options.xml || options.svg ? "@prettier/plugin-xml" : void 0
364
+ ]);
365
+ const { indent, quotes } = {
366
+ ...StylisticConfigDefaults,
367
+ ...stylistic$1
368
+ };
369
+ const prettierOptions = Object.assign({
370
+ arrowParens: "always",
371
+ endOfLine: "lf",
372
+ printWidth: 120,
373
+ semi: true,
374
+ singleQuote: quotes === "single",
375
+ tabWidth: typeof indent === "number" ? indent : 2,
376
+ trailingComma: "all",
377
+ useTabs: indent === "tab"
378
+ }, options.prettierOptions ?? {});
379
+ const prettierXmlOptions = {
380
+ xmlQuoteAttributes: "double",
381
+ xmlSelfClosingSpace: true,
382
+ xmlSortAttributesByKey: false,
383
+ xmlWhitespaceSensitivity: "ignore"
384
+ };
385
+ const pluginFormat = await interopDefault(import("eslint-plugin-format"));
386
+ const configs$1 = [{
387
+ name: "eienjs/formatter/setup",
388
+ plugins: { format: pluginFormat }
389
+ }];
390
+ if (options.css) configs$1.push({
391
+ files: [GLOB_CSS, GLOB_POSTCSS],
392
+ languageOptions: { parser: parserPlain },
393
+ name: "eienjs/formatter/css",
394
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "css" })] }
395
+ }, {
396
+ files: [GLOB_SCSS],
397
+ languageOptions: { parser: parserPlain },
398
+ name: "eienjs/formatter/scss",
399
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "scss" })] }
400
+ }, {
401
+ files: [GLOB_LESS],
402
+ languageOptions: { parser: parserPlain },
403
+ name: "eienjs/formatter/less",
404
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "less" })] }
405
+ });
406
+ if (options.html) configs$1.push({
407
+ files: [GLOB_HTML],
408
+ languageOptions: { parser: parserPlain },
409
+ name: "eienjs/formatter/html",
410
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
411
+ });
412
+ if (options.xml) configs$1.push({
413
+ files: [GLOB_XML],
414
+ languageOptions: { parser: parserPlain },
415
+ name: "eienjs/formatter/xml",
416
+ rules: { "format/prettier": ["error", mergePrettierOptions({
417
+ ...prettierXmlOptions,
418
+ ...prettierOptions
419
+ }, {
420
+ parser: "xml",
421
+ plugins: ["@prettier/plugin-xml"]
422
+ })] }
423
+ });
424
+ if (options.svg) configs$1.push({
425
+ files: [GLOB_SVG],
426
+ languageOptions: { parser: parserPlain },
427
+ name: "eienjs/formatter/svg",
428
+ rules: { "format/prettier": ["error", mergePrettierOptions({
429
+ ...prettierXmlOptions,
430
+ ...prettierOptions
431
+ }, {
432
+ parser: "xml",
433
+ plugins: ["@prettier/plugin-xml"]
434
+ })] }
435
+ });
436
+ if (options.markdown) configs$1.push({
437
+ files: [GLOB_MARKDOWN],
438
+ languageOptions: { parser: parserPlain },
439
+ name: "eienjs/formatter/markdown",
440
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
441
+ embeddedLanguageFormatting: "off",
442
+ parser: "markdown"
443
+ })] }
444
+ });
445
+ if (options.astro) configs$1.push({
446
+ files: [GLOB_ASTRO],
447
+ languageOptions: { parser: parserPlain },
448
+ name: "eienjs/formatter/astro",
449
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
450
+ parser: "astro",
451
+ plugins: ["prettier-plugin-astro"]
452
+ })] }
453
+ }, {
454
+ files: [GLOB_ASTRO, GLOB_ASTRO_TS],
455
+ name: "eienjs/formatter/astro/disables",
456
+ rules: {
457
+ "@stylistic/arrow-parens": "off",
458
+ "@stylistic/block-spacing": "off",
459
+ "@stylistic/comma-dangle": "off",
460
+ "@stylistic/indent": "off",
461
+ "@stylistic/no-multi-spaces": "off",
462
+ "@stylistic/quotes": "off",
463
+ "@stylistic/semi": "off"
464
+ }
465
+ });
466
+ return configs$1;
467
+ }
468
+
469
+ //#endregion
470
+ //#region src/configs/ignores.ts
471
+ async function ignores(userIgnores = []) {
472
+ return [{
473
+ ignores: [...GLOB_EXCLUDE, ...userIgnores],
474
+ name: "eienjs/ignores"
475
+ }];
476
+ }
477
+
478
+ //#endregion
479
+ //#region src/configs/imports.ts
480
+ async function imports(options = {}) {
481
+ const { overrides = {}, stylistic: stylistic$1 = true } = options;
482
+ return [{
483
+ name: "eienjs/imports/rules",
484
+ plugins: {
485
+ antfu: pluginAntfu,
486
+ import: pluginImportLite
487
+ },
488
+ rules: {
489
+ "antfu/import-dedupe": "error",
490
+ "antfu/no-import-dist": "error",
491
+ "antfu/no-import-node-modules-by-path": "error",
492
+ "import/consistent-type-specifier-style": ["error", "top-level"],
493
+ "import/first": "error",
494
+ "import/no-duplicates": "error",
495
+ "import/no-mutable-exports": "error",
496
+ "import/no-named-default": "error",
497
+ ...stylistic$1 ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
498
+ ...overrides
499
+ }
500
+ }];
501
+ }
502
+
503
+ //#endregion
504
+ //#region src/configs/javascript.ts
505
+ async function javascript(options = {}) {
506
+ const { isInEditor = false, overrides = {} } = options;
507
+ return [{
508
+ languageOptions: {
509
+ ecmaVersion: 2022,
510
+ globals: {
511
+ ...globals.browser,
512
+ ...globals.es2021,
513
+ ...globals.node,
514
+ document: "readonly",
515
+ navigator: "readonly",
516
+ window: "readonly"
517
+ },
518
+ parserOptions: {
519
+ ecmaVersion: 2022,
520
+ sourceType: "module"
521
+ },
522
+ sourceType: "module"
523
+ },
524
+ linterOptions: { reportUnusedDisableDirectives: true },
525
+ name: "eienjs/javascript/setup"
526
+ }, {
527
+ name: "eienjs/javascript/rules",
528
+ plugins: {
529
+ "antfu": pluginAntfu,
530
+ "unused-imports": pluginUnusedImports
531
+ },
532
+ rules: {
533
+ "accessor-pairs": ["error", {
534
+ enforceForClassMembers: true,
535
+ setWithoutGet: true
536
+ }],
537
+ "antfu/no-top-level-await": "error",
538
+ "array-callback-return": ["error", {
539
+ allowImplicit: true,
540
+ checkForEach: true
541
+ }],
542
+ "block-scoped-var": "error",
543
+ "constructor-super": "error",
544
+ "default-case-last": "error",
545
+ "dot-notation": ["error", { allowKeywords: true }],
546
+ "eqeqeq": ["error", "smart"],
547
+ "logical-assignment-operators": ["error", "never"],
548
+ "new-cap": ["error", {
549
+ capIsNew: false,
550
+ newIsCap: true,
551
+ properties: true
552
+ }],
553
+ "no-alert": "error",
554
+ "no-array-constructor": "error",
555
+ "no-async-promise-executor": "error",
556
+ "no-caller": "error",
557
+ "no-case-declarations": "error",
558
+ "no-class-assign": "error",
559
+ "no-compare-neg-zero": "error",
560
+ "no-cond-assign": ["error", "always"],
561
+ "no-console": ["error", { allow: [
562
+ "warn",
563
+ "error",
564
+ "info",
565
+ "table"
566
+ ] }],
567
+ "no-constant-binary-expression": "error",
568
+ "no-const-assign": "error",
569
+ "no-control-regex": "error",
570
+ "no-debugger": "error",
571
+ "no-delete-var": "error",
572
+ "no-dupe-args": "error",
573
+ "no-dupe-class-members": "error",
574
+ "no-dupe-keys": "error",
575
+ "no-duplicate-case": "error",
576
+ "no-else-return": ["error", { allowElseIf: false }],
577
+ "no-empty": ["error", { allowEmptyCatch: true }],
578
+ "no-empty-character-class": "error",
579
+ "no-empty-pattern": "error",
580
+ "no-eval": "error",
581
+ "no-ex-assign": "error",
582
+ "no-extend-native": "error",
583
+ "no-extra-bind": "error",
584
+ "no-extra-boolean-cast": "error",
585
+ "no-extra-label": "error",
586
+ "no-fallthrough": "error",
587
+ "no-func-assign": "error",
588
+ "no-global-assign": "error",
589
+ "no-implicit-coercion": "error",
590
+ "no-implied-eval": "error",
591
+ "no-import-assign": "error",
592
+ "no-invalid-regexp": "error",
593
+ "no-irregular-whitespace": "error",
594
+ "no-iterator": "error",
595
+ "no-labels": ["error", {
596
+ allowLoop: false,
597
+ allowSwitch: false
598
+ }],
599
+ "no-lone-blocks": "error",
600
+ "no-loss-of-precision": "error",
601
+ "no-misleading-character-class": "error",
602
+ "no-multi-str": "error",
603
+ "no-negated-condition": "error",
604
+ "no-new": "error",
605
+ "no-new-func": "error",
606
+ "no-new-native-nonconstructor": "error",
607
+ "no-new-wrappers": "error",
608
+ "no-obj-calls": "error",
609
+ "no-octal": "error",
610
+ "no-octal-escape": "error",
611
+ "no-promise-executor-return": "error",
612
+ "no-proto": "error",
613
+ "no-prototype-builtins": "error",
614
+ "no-redeclare": ["error", { builtinGlobals: false }],
615
+ "no-regex-spaces": "error",
616
+ "no-restricted-globals": [
617
+ "error",
618
+ {
619
+ message: "Use `globalThis` instead.",
620
+ name: "global"
621
+ },
622
+ {
623
+ message: "Use `globalThis` instead.",
624
+ name: "self"
625
+ }
626
+ ],
627
+ "no-restricted-properties": [
628
+ "error",
629
+ {
630
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
631
+ property: "__proto__"
632
+ },
633
+ {
634
+ message: "Use `Object.defineProperty` instead.",
635
+ property: "__defineGetter__"
636
+ },
637
+ {
638
+ message: "Use `Object.defineProperty` instead.",
639
+ property: "__defineSetter__"
640
+ },
641
+ {
642
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
643
+ property: "__lookupGetter__"
644
+ },
645
+ {
646
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
647
+ property: "__lookupSetter__"
648
+ },
649
+ {
650
+ message: "Please use Number.isFinite instead",
651
+ object: "global",
652
+ property: "isFinite"
653
+ },
654
+ {
655
+ message: "Please use Number.isFinite instead",
656
+ object: "self",
657
+ property: "isFinite"
658
+ },
659
+ {
660
+ message: "Please use Number.isFinite instead",
661
+ object: "window",
662
+ property: "isFinite"
663
+ },
664
+ {
665
+ message: "Please use Number.isNaN instead",
666
+ object: "global",
667
+ property: "isNaN"
668
+ },
669
+ {
670
+ message: "Please use Number.isNaN instead",
671
+ object: "self",
672
+ property: "isNaN"
673
+ },
674
+ {
675
+ message: "Please use Number.isNaN instead",
676
+ object: "window",
677
+ property: "isNaN"
678
+ }
679
+ ],
680
+ "no-restricted-syntax": [
681
+ "error",
682
+ "TSEnumDeclaration[const=true]",
683
+ "TSExportAssignment"
684
+ ],
685
+ "no-return-assign": ["error", "always"],
686
+ "no-self-assign": ["error", { props: true }],
687
+ "no-self-compare": "error",
688
+ "no-sequences": ["error", { allowInParentheses: false }],
689
+ "no-shadow-restricted-names": "error",
690
+ "no-sparse-arrays": "error",
691
+ "no-template-curly-in-string": "error",
692
+ "no-this-before-super": "error",
693
+ "no-throw-literal": "error",
694
+ "no-undef": "error",
695
+ "no-undef-init": "error",
696
+ "no-unexpected-multiline": "error",
697
+ "no-unmodified-loop-condition": "error",
698
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
699
+ "no-unreachable": "error",
700
+ "no-unreachable-loop": "error",
701
+ "no-unsafe-finally": "error",
702
+ "no-unsafe-negation": "error",
703
+ "no-unused-expressions": ["error", {
704
+ allowShortCircuit: true,
705
+ allowTaggedTemplates: true,
706
+ allowTernary: true
707
+ }],
708
+ "no-unused-vars": ["error", {
709
+ args: "none",
710
+ caughtErrors: "none",
711
+ ignoreRestSiblings: true,
712
+ vars: "all"
713
+ }],
714
+ "no-use-before-define": ["error", {
715
+ classes: false,
716
+ functions: false,
717
+ variables: true
718
+ }],
719
+ "no-useless-backreference": "error",
720
+ "no-useless-call": "error",
721
+ "no-useless-catch": "error",
722
+ "no-useless-computed-key": "error",
723
+ "no-useless-constructor": "error",
724
+ "no-useless-rename": "error",
725
+ "no-useless-return": "error",
726
+ "no-var": "error",
727
+ "no-void": ["error", { allowAsStatement: true }],
728
+ "no-with": "error",
729
+ "object-shorthand": [
730
+ "error",
731
+ "always",
732
+ {
733
+ avoidQuotes: true,
734
+ ignoreConstructors: false
735
+ }
736
+ ],
737
+ "one-var": ["error", { initialized: "never" }],
738
+ "operator-assignment": ["error", "always"],
739
+ "prefer-arrow-callback": ["error", {
740
+ allowNamedFunctions: false,
741
+ allowUnboundThis: true
742
+ }],
743
+ "prefer-const": [isInEditor ? "warn" : "error", {
744
+ destructuring: "all",
745
+ ignoreReadBeforeAssign: true
746
+ }],
747
+ "prefer-destructuring": [
748
+ "error",
749
+ {
750
+ AssignmentExpression: {
751
+ array: false,
752
+ object: false
753
+ },
754
+ VariableDeclarator: {
755
+ array: false,
756
+ object: true
757
+ }
758
+ },
759
+ { enforceForRenamedProperties: false }
760
+ ],
761
+ "prefer-exponentiation-operator": "error",
762
+ "prefer-object-has-own": "error",
763
+ "prefer-object-spread": "error",
764
+ "prefer-promise-reject-errors": "error",
765
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
766
+ "prefer-rest-params": "error",
767
+ "prefer-spread": "error",
768
+ "prefer-template": "error",
769
+ "symbol-description": "error",
770
+ "unicode-bom": ["error", "never"],
771
+ "unused-imports/no-unused-imports": isInEditor ? "warn" : "error",
772
+ "unused-imports/no-unused-vars": ["error", {
773
+ args: "after-used",
774
+ argsIgnorePattern: "^_",
775
+ ignoreRestSiblings: true,
776
+ vars: "all",
777
+ varsIgnorePattern: "^_"
778
+ }],
779
+ "use-isnan": ["error", {
780
+ enforceForIndexOf: true,
781
+ enforceForSwitchCase: true
782
+ }],
783
+ "valid-typeof": ["error", { requireStringLiterals: true }],
784
+ "vars-on-top": "error",
785
+ "yoda": ["error", "never"],
786
+ ...overrides
787
+ }
788
+ }];
789
+ }
790
+
791
+ //#endregion
792
+ //#region src/configs/jsdoc.ts
793
+ async function jsdoc(options = {}) {
794
+ const { stylistic: stylistic$1 = true } = options;
795
+ return [{
796
+ name: "eienjs/jsdoc/rules",
797
+ plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) },
798
+ rules: {
799
+ "jsdoc/check-access": "warn",
800
+ "jsdoc/check-param-names": "warn",
801
+ "jsdoc/check-property-names": "warn",
802
+ "jsdoc/check-types": "warn",
803
+ "jsdoc/empty-tags": "warn",
804
+ "jsdoc/implements-on-classes": "warn",
805
+ "jsdoc/no-defaults": "warn",
806
+ "jsdoc/no-multi-asterisks": "warn",
807
+ "jsdoc/require-param-name": "warn",
808
+ "jsdoc/require-property": "warn",
809
+ "jsdoc/require-property-description": "warn",
810
+ "jsdoc/require-property-name": "warn",
811
+ "jsdoc/require-returns-check": "warn",
812
+ "jsdoc/require-returns-description": "warn",
813
+ "jsdoc/require-yields-check": "warn",
814
+ ...stylistic$1 ? {
815
+ "jsdoc/check-alignment": "warn",
816
+ "jsdoc/multiline-blocks": "warn"
817
+ } : {}
818
+ }
819
+ }];
820
+ }
821
+
822
+ //#endregion
823
+ //#region src/configs/jsonc.ts
824
+ async function jsonc(options = {}) {
825
+ const { files = [
826
+ GLOB_JSON,
827
+ GLOB_JSON5,
828
+ GLOB_JSONC
829
+ ], overrides = {}, stylistic: stylistic$1 = true } = options;
830
+ const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
831
+ const [pluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
832
+ return [{
833
+ name: "eienjs/jsonc/setup",
834
+ plugins: { jsonc: pluginJsonc }
835
+ }, {
836
+ files,
837
+ languageOptions: { parser: parserJsonc },
838
+ name: "eienjs/jsonc/rules",
839
+ rules: {
840
+ "jsonc/no-bigint-literals": "error",
841
+ "jsonc/no-binary-expression": "error",
842
+ "jsonc/no-binary-numeric-literals": "error",
843
+ "jsonc/no-dupe-keys": "error",
844
+ "jsonc/no-escape-sequence-in-identifier": "error",
845
+ "jsonc/no-floating-decimal": "error",
846
+ "jsonc/no-hexadecimal-numeric-literals": "error",
847
+ "jsonc/no-infinity": "error",
848
+ "jsonc/no-multi-str": "error",
849
+ "jsonc/no-nan": "error",
850
+ "jsonc/no-number-props": "error",
851
+ "jsonc/no-numeric-separators": "error",
852
+ "jsonc/no-octal": "error",
853
+ "jsonc/no-octal-escape": "error",
854
+ "jsonc/no-octal-numeric-literals": "error",
855
+ "jsonc/no-parenthesized": "error",
856
+ "jsonc/no-plus-sign": "error",
857
+ "jsonc/no-regexp-literals": "error",
858
+ "jsonc/no-sparse-arrays": "error",
859
+ "jsonc/no-template-literals": "error",
860
+ "jsonc/no-undefined-value": "error",
861
+ "jsonc/no-unicode-codepoint-escapes": "error",
862
+ "jsonc/no-useless-escape": "error",
863
+ "jsonc/space-unary-ops": "error",
864
+ "jsonc/valid-json-number": "error",
865
+ "jsonc/vue-custom-block/no-parsing-error": "error",
866
+ ...stylistic$1 ? {
867
+ "jsonc/array-bracket-spacing": ["error", "never"],
868
+ "jsonc/comma-dangle": ["error", "never"],
869
+ "jsonc/comma-style": ["error", "last"],
870
+ "jsonc/indent": ["error", indent],
871
+ "jsonc/key-spacing": ["error", {
872
+ afterColon: true,
873
+ beforeColon: false
874
+ }],
875
+ "jsonc/object-curly-newline": ["error", {
876
+ consistent: true,
877
+ multiline: true
878
+ }],
879
+ "jsonc/object-curly-spacing": ["error", "always"],
880
+ "jsonc/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
881
+ "jsonc/quote-props": "error",
882
+ "jsonc/quotes": "error"
883
+ } : {},
884
+ ...overrides
885
+ }
886
+ }];
887
+ }
888
+
889
+ //#endregion
890
+ //#region src/configs/markdown.ts
891
+ async function markdown(options = {}) {
892
+ const { componentExts = [], files = [GLOB_MARKDOWN], overrides = {} } = options;
893
+ const markdown$1 = await interopDefault(import("@eslint/markdown"));
894
+ return [
895
+ {
896
+ name: "eienjs/markdown/setup",
897
+ plugins: { markdown: markdown$1 }
898
+ },
899
+ {
900
+ files,
901
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
902
+ name: "eienjs/markdown/processor",
903
+ processor: mergeProcessors([markdown$1.processors.markdown, processorPassThrough])
904
+ },
905
+ {
906
+ files,
907
+ languageOptions: { parser: parserPlain },
908
+ name: "eienjs/markdown/parser"
909
+ },
910
+ {
911
+ files: [
912
+ GLOB_MARKDOWN,
913
+ GLOB_MARKDOWN_CODE,
914
+ ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
915
+ ],
916
+ languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
917
+ name: "eienjs/markdown/disables",
918
+ rules: {
919
+ "antfu/no-top-level-await": "off",
920
+ "no-alert": "off",
921
+ "no-console": "off",
922
+ "no-labels": "off",
923
+ "no-lone-blocks": "off",
924
+ "no-restricted-syntax": "off",
925
+ "no-undef": "off",
926
+ "no-unused-expressions": "off",
927
+ "no-unused-labels": "off",
928
+ "no-unused-vars": "off",
929
+ "n/prefer-global/process": "off",
930
+ "@stylistic/comma-dangle": "off",
931
+ "@stylistic/eol-last": "off",
932
+ "@stylistic/padding-line-between-statements": "off",
933
+ "@stylistic/max-len": "off",
934
+ "@typescript-eslint/consistent-type-imports": "off",
935
+ "@typescript-eslint/explicit-function-return-type": "off",
936
+ "@typescript-eslint/no-namespace": "off",
937
+ "@typescript-eslint/no-redeclare": "off",
938
+ "@typescript-eslint/no-require-imports": "off",
939
+ "@typescript-eslint/no-unused-expressions": "off",
940
+ "@typescript-eslint/no-unused-vars": "off",
941
+ "@typescript-eslint/no-use-before-define": "off",
942
+ "unicode-bom": "off",
943
+ "unused-imports/no-unused-imports": "off",
944
+ "unused-imports/no-unused-vars": "off",
945
+ ...overrides
946
+ }
947
+ }
948
+ ];
949
+ }
950
+
951
+ //#endregion
952
+ //#region src/configs/node.ts
953
+ async function node() {
954
+ return [{
955
+ name: "eienjs/node/rules",
956
+ plugins: { n: pluginNode },
957
+ rules: {
958
+ "n/handle-callback-err": ["error", "^(err|error)$"],
959
+ "n/no-deprecated-api": "error",
960
+ "n/no-exports-assign": "error",
961
+ "n/no-new-require": "error",
962
+ "n/no-path-concat": "error",
963
+ "n/prefer-global/buffer": ["error", "never"],
964
+ "n/prefer-global/process": ["error", "never"],
965
+ "n/process-exit-as-throw": "error"
966
+ }
967
+ }];
968
+ }
969
+
970
+ //#endregion
971
+ //#region src/configs/perfectionist.ts
972
+ /**
973
+ * Perfectionist plugin for props and items sorting.
974
+ *
975
+ * @see https://github.com/azat-io/eslint-plugin-perfectionist
976
+ */
977
+ async function perfectionist() {
978
+ return [{
979
+ name: "eienjs/perfectionist/setup",
980
+ plugins: { perfectionist: pluginPerfectionist },
981
+ rules: {
982
+ "perfectionist/sort-exports": ["error", {
983
+ order: "asc",
984
+ type: "natural"
985
+ }],
986
+ "perfectionist/sort-imports": ["error", {
987
+ groups: [
988
+ "type",
989
+ [
990
+ "parent-type",
991
+ "sibling-type",
992
+ "index-type",
993
+ "internal-type"
994
+ ],
995
+ "builtin",
996
+ "external",
997
+ "internal",
998
+ [
999
+ "parent",
1000
+ "sibling",
1001
+ "index"
1002
+ ],
1003
+ "side-effect",
1004
+ "object",
1005
+ "unknown"
1006
+ ],
1007
+ newlinesBetween: "ignore",
1008
+ order: "asc",
1009
+ type: "natural"
1010
+ }],
1011
+ "perfectionist/sort-named-exports": ["error", {
1012
+ order: "asc",
1013
+ type: "natural"
1014
+ }],
1015
+ "perfectionist/sort-named-imports": ["error", {
1016
+ order: "asc",
1017
+ type: "natural"
1018
+ }]
1019
+ }
1020
+ }];
1021
+ }
1022
+
1023
+ //#endregion
1024
+ //#region src/configs/pnpm.ts
1025
+ async function pnpm() {
1026
+ const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
1027
+ interopDefault(import("eslint-plugin-pnpm")),
1028
+ interopDefault(import("yaml-eslint-parser")),
1029
+ interopDefault(import("jsonc-eslint-parser"))
1030
+ ]);
1031
+ return [{
1032
+ files: ["package.json", "**/package.json"],
1033
+ languageOptions: { parser: jsoncParser },
1034
+ name: "eienjs/pnpm/package-json",
1035
+ plugins: { pnpm: pluginPnpm },
1036
+ rules: {
1037
+ "pnpm/json-enforce-catalog": "error",
1038
+ "pnpm/json-prefer-workspace-settings": "error",
1039
+ "pnpm/json-valid-catalog": "error"
1040
+ }
1041
+ }, {
1042
+ files: ["pnpm-workspace.yaml"],
1043
+ languageOptions: { parser: yamlParser },
1044
+ name: "eienjs/pnpm/pnpm-workspace-yaml",
1045
+ plugins: { pnpm: pluginPnpm },
1046
+ rules: {
1047
+ "pnpm/yaml-no-duplicate-catalog-item": "error",
1048
+ "pnpm/yaml-no-unused-catalog-item": "error"
1049
+ }
1050
+ }];
1051
+ }
1052
+
1053
+ //#endregion
1054
+ //#region src/configs/regexp.ts
1055
+ async function regexp(options = {}) {
1056
+ const config = configs["flat/recommended"];
1057
+ const rules = { ...config.rules };
1058
+ if (options.level === "warn") {
1059
+ for (const key in rules) if (rules[key] === "error") rules[key] = "warn";
1060
+ }
1061
+ return [{
1062
+ ...config,
1063
+ name: "eienjs/regexp/rules",
1064
+ rules: {
1065
+ ...rules,
1066
+ ...options.overrides
1067
+ }
1068
+ }];
1069
+ }
1070
+
1071
+ //#endregion
1072
+ //#region src/configs/sort.ts
1073
+ /**
1074
+ * Sort package.json
1075
+ *
1076
+ * Requires `jsonc` config
1077
+ */
1078
+ async function sortPackageJson() {
1079
+ return [{
1080
+ files: ["**/package.json"],
1081
+ name: "eienjs/sort/package-json",
1082
+ rules: {
1083
+ "jsonc/sort-array-values": ["error", {
1084
+ order: { type: "asc" },
1085
+ pathPattern: "^files$"
1086
+ }],
1087
+ "jsonc/sort-keys": [
1088
+ "error",
1089
+ {
1090
+ order: [
1091
+ "publisher",
1092
+ "name",
1093
+ "displayName",
1094
+ "type",
1095
+ "version",
1096
+ "private",
1097
+ "packageManager",
1098
+ "description",
1099
+ "author",
1100
+ "contributors",
1101
+ "license",
1102
+ "funding",
1103
+ "homepage",
1104
+ "repository",
1105
+ "bugs",
1106
+ "keywords",
1107
+ "categories",
1108
+ "sideEffects",
1109
+ "imports",
1110
+ "exports",
1111
+ "main",
1112
+ "module",
1113
+ "unpkg",
1114
+ "jsdelivr",
1115
+ "types",
1116
+ "typesVersions",
1117
+ "bin",
1118
+ "icon",
1119
+ "files",
1120
+ "engines",
1121
+ "activationEvents",
1122
+ "contributes",
1123
+ "scripts",
1124
+ "peerDependencies",
1125
+ "peerDependenciesMeta",
1126
+ "dependencies",
1127
+ "optionalDependencies",
1128
+ "devDependencies",
1129
+ "pnpm",
1130
+ "overrides",
1131
+ "resolutions",
1132
+ "husky",
1133
+ "simple-git-hooks",
1134
+ "lint-staged",
1135
+ "eslintConfig",
1136
+ "commitlint",
1137
+ "publishConfig",
1138
+ "auto-changelog",
1139
+ "np"
1140
+ ],
1141
+ pathPattern: "^$"
1142
+ },
1143
+ {
1144
+ order: { type: "asc" },
1145
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
1146
+ },
1147
+ {
1148
+ order: { type: "asc" },
1149
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1150
+ },
1151
+ {
1152
+ order: [
1153
+ "types",
1154
+ "import",
1155
+ "require",
1156
+ "default"
1157
+ ],
1158
+ pathPattern: "^exports.*$"
1159
+ },
1160
+ {
1161
+ order: [
1162
+ "pre-commit",
1163
+ "prepare-commit-msg",
1164
+ "commit-msg",
1165
+ "post-commit",
1166
+ "pre-rebase",
1167
+ "post-rewrite",
1168
+ "post-checkout",
1169
+ "post-merge",
1170
+ "pre-push",
1171
+ "pre-auto-gc"
1172
+ ],
1173
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1174
+ }
1175
+ ]
1176
+ }
1177
+ }];
1178
+ }
1179
+ /**
1180
+ * Sort tsconfig.json
1181
+ *
1182
+ * Requires `jsonc` config
1183
+ */
1184
+ function sortTsconfig() {
1185
+ return [{
1186
+ files: ["**/[jt]sconfig.json", "**/[jt]sconfig.*.json"],
1187
+ name: "eienjs/sort/tsconfig-json",
1188
+ rules: { "jsonc/sort-keys": [
1189
+ "error",
1190
+ {
1191
+ order: [
1192
+ "extends",
1193
+ "compilerOptions",
1194
+ "references",
1195
+ "files",
1196
+ "include",
1197
+ "exclude"
1198
+ ],
1199
+ pathPattern: "^$"
1200
+ },
1201
+ {
1202
+ order: [
1203
+ "incremental",
1204
+ "composite",
1205
+ "tsBuildInfoFile",
1206
+ "disableSourceOfProjectReferenceRedirect",
1207
+ "disableSolutionSearching",
1208
+ "disableReferencedProjectLoad",
1209
+ "target",
1210
+ "jsx",
1211
+ "jsxFactory",
1212
+ "jsxFragmentFactory",
1213
+ "jsxImportSource",
1214
+ "lib",
1215
+ "moduleDetection",
1216
+ "noLib",
1217
+ "reactNamespace",
1218
+ "useDefineForClassFields",
1219
+ "emitDecoratorMetadata",
1220
+ "experimentalDecorators",
1221
+ "libReplacement",
1222
+ "baseUrl",
1223
+ "rootDir",
1224
+ "rootDirs",
1225
+ "customConditions",
1226
+ "module",
1227
+ "moduleResolution",
1228
+ "moduleSuffixes",
1229
+ "noResolve",
1230
+ "paths",
1231
+ "resolveJsonModule",
1232
+ "resolvePackageJsonExports",
1233
+ "resolvePackageJsonImports",
1234
+ "typeRoots",
1235
+ "types",
1236
+ "allowArbitraryExtensions",
1237
+ "allowImportingTsExtensions",
1238
+ "allowUmdGlobalAccess",
1239
+ "allowJs",
1240
+ "checkJs",
1241
+ "maxNodeModuleJsDepth",
1242
+ "strict",
1243
+ "strictBindCallApply",
1244
+ "strictFunctionTypes",
1245
+ "strictNullChecks",
1246
+ "strictPropertyInitialization",
1247
+ "allowUnreachableCode",
1248
+ "allowUnusedLabels",
1249
+ "alwaysStrict",
1250
+ "exactOptionalPropertyTypes",
1251
+ "noFallthroughCasesInSwitch",
1252
+ "noImplicitAny",
1253
+ "noImplicitOverride",
1254
+ "noImplicitReturns",
1255
+ "noImplicitThis",
1256
+ "noPropertyAccessFromIndexSignature",
1257
+ "noUncheckedIndexedAccess",
1258
+ "noUnusedLocals",
1259
+ "noUnusedParameters",
1260
+ "useUnknownInCatchVariables",
1261
+ "declaration",
1262
+ "declarationDir",
1263
+ "declarationMap",
1264
+ "downlevelIteration",
1265
+ "emitBOM",
1266
+ "emitDeclarationOnly",
1267
+ "importHelpers",
1268
+ "importsNotUsedAsValues",
1269
+ "inlineSourceMap",
1270
+ "inlineSources",
1271
+ "mapRoot",
1272
+ "newLine",
1273
+ "noEmit",
1274
+ "noEmitHelpers",
1275
+ "noEmitOnError",
1276
+ "outDir",
1277
+ "outFile",
1278
+ "preserveConstEnums",
1279
+ "preserveValueImports",
1280
+ "removeComments",
1281
+ "sourceMap",
1282
+ "sourceRoot",
1283
+ "stripInternal",
1284
+ "allowSyntheticDefaultImports",
1285
+ "esModuleInterop",
1286
+ "forceConsistentCasingInFileNames",
1287
+ "isolatedDeclarations",
1288
+ "isolatedModules",
1289
+ "preserveSymlinks",
1290
+ "verbatimModuleSyntax",
1291
+ "erasableSyntaxOnly",
1292
+ "skipDefaultLibCheck",
1293
+ "skipLibCheck"
1294
+ ],
1295
+ pathPattern: "^compilerOptions$"
1296
+ }
1297
+ ] }
1298
+ }];
1299
+ }
1300
+
1301
+ //#endregion
1302
+ //#region src/configs/test.ts
1303
+ let _pluginTest;
1304
+ async function test(options = {}) {
1305
+ const { files = GLOB_TESTS, isInEditor = false, overrides = {} } = options;
1306
+ const [pluginVitest, pluginNoOnlyTests] = await Promise.all([interopDefault(import("@vitest/eslint-plugin")), interopDefault(import("eslint-plugin-no-only-tests"))]);
1307
+ _pluginTest = _pluginTest || {
1308
+ ...pluginVitest,
1309
+ rules: {
1310
+ ...pluginVitest.rules,
1311
+ ...pluginNoOnlyTests.rules
1312
+ }
1313
+ };
1314
+ return [{
1315
+ name: "eienjs/test/setup",
1316
+ plugins: { test: _pluginTest }
1317
+ }, {
1318
+ files,
1319
+ name: "eienjs/test/rules",
1320
+ rules: {
1321
+ "test/consistent-test-it": ["error", {
1322
+ fn: "test",
1323
+ withinDescribe: "test"
1324
+ }],
1325
+ "test/no-identical-title": "error",
1326
+ "test/no-import-node-test": "error",
1327
+ "test/no-only-tests": isInEditor ? "warn" : "error",
1328
+ "test/prefer-hooks-in-order": "error",
1329
+ "test/prefer-lowercase-title": "error",
1330
+ "antfu/no-top-level-await": "off",
1331
+ "no-unused-expressions": "off",
1332
+ "n/prefer-global/process": "off",
1333
+ "@typescript-eslint/explicit-function-return-type": "off",
1334
+ ...overrides
1335
+ }
1336
+ }];
1337
+ }
1338
+
1339
+ //#endregion
1340
+ //#region src/configs/toml.ts
1341
+ async function toml(options = {}) {
1342
+ const { files = [GLOB_TOML], overrides = {}, stylistic: stylistic$1 = true } = options;
1343
+ const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
1344
+ const [pluginToml, parserToml] = await Promise.all([interopDefault(import("eslint-plugin-toml")), interopDefault(import("toml-eslint-parser"))]);
1345
+ return [{
1346
+ name: "eienjs/toml/setup",
1347
+ plugins: { toml: pluginToml }
1348
+ }, {
1349
+ files,
1350
+ languageOptions: { parser: parserToml },
1351
+ name: "eienjs/toml/rules",
1352
+ rules: {
1353
+ "@stylistic/spaced-comment": "off",
1354
+ "toml/comma-style": "error",
1355
+ "toml/keys-order": "error",
1356
+ "toml/no-space-dots": "error",
1357
+ "toml/no-unreadable-number-separator": "error",
1358
+ "toml/precision-of-fractional-seconds": "error",
1359
+ "toml/precision-of-integer": "error",
1360
+ "toml/tables-order": "error",
1361
+ "toml/vue-custom-block/no-parsing-error": "error",
1362
+ ...stylistic$1 ? {
1363
+ "toml/array-bracket-newline": "error",
1364
+ "toml/array-bracket-spacing": "error",
1365
+ "toml/array-element-newline": "error",
1366
+ "toml/indent": ["error", indent === "tab" ? 2 : indent],
1367
+ "toml/inline-table-curly-spacing": "error",
1368
+ "toml/key-spacing": "error",
1369
+ "toml/padding-line-between-pairs": "error",
1370
+ "toml/padding-line-between-tables": "error",
1371
+ "toml/quoted-keys": "error",
1372
+ "toml/spaced-comment": "error",
1373
+ "toml/table-bracket-spacing": "error"
1374
+ } : {},
1375
+ ...overrides
1376
+ }
1377
+ }];
1378
+ }
1379
+
1380
+ //#endregion
1381
+ //#region src/configs/typescript.ts
1382
+ async function typescript(options = {}) {
1383
+ const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {} } = options;
1384
+ const files = options.files ?? [
1385
+ GLOB_TS,
1386
+ GLOB_TSX,
1387
+ ...componentExts.map((ext) => `**/*.${ext}`)
1388
+ ];
1389
+ const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1390
+ const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS];
1391
+ const tsconfigPath = options?.tsconfigPath ?? void 0;
1392
+ const isTypeAware = Boolean(tsconfigPath);
1393
+ const typeAwareRules = {
1394
+ "dot-notation": "off",
1395
+ "no-implied-eval": "off",
1396
+ "@typescript-eslint/await-thenable": "error",
1397
+ "@typescript-eslint/consistent-type-exports": ["error", { fixMixedExportsWithInlineTypeSpecifier: true }],
1398
+ "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
1399
+ "@typescript-eslint/explicit-member-accessibility": "error",
1400
+ "@typescript-eslint/explicit-module-boundary-types": "error",
1401
+ "@typescript-eslint/naming-convention": [
1402
+ "error",
1403
+ {
1404
+ format: ["camelCase", "UPPER_CASE"],
1405
+ leadingUnderscore: "allowSingleOrDouble",
1406
+ modifiers: ["const"],
1407
+ selector: "variable",
1408
+ trailingUnderscore: "allowSingleOrDouble",
1409
+ types: ["string", "number"]
1410
+ },
1411
+ {
1412
+ format: null,
1413
+ leadingUnderscore: "allowSingleOrDouble",
1414
+ selector: "objectLiteralProperty",
1415
+ trailingUnderscore: "allowSingleOrDouble"
1416
+ },
1417
+ {
1418
+ format: ["PascalCase"],
1419
+ leadingUnderscore: "allowSingleOrDouble",
1420
+ selector: "typeLike",
1421
+ trailingUnderscore: "allowSingleOrDouble"
1422
+ },
1423
+ {
1424
+ format: null,
1425
+ modifiers: ["destructured"],
1426
+ selector: "variable"
1427
+ },
1428
+ {
1429
+ format: null,
1430
+ selector: "typeProperty"
1431
+ },
1432
+ {
1433
+ format: ["PascalCase"],
1434
+ selector: "class"
1435
+ },
1436
+ {
1437
+ custom: {
1438
+ match: false,
1439
+ regex: "^I[A-Z]"
1440
+ },
1441
+ format: ["PascalCase"],
1442
+ selector: "interface"
1443
+ },
1444
+ {
1445
+ selector: "variable",
1446
+ format: [
1447
+ "camelCase",
1448
+ "UPPER_CASE",
1449
+ "PascalCase"
1450
+ ],
1451
+ leadingUnderscore: "allow"
1452
+ }
1453
+ ],
1454
+ "@typescript-eslint/no-floating-promises": "error",
1455
+ "@typescript-eslint/no-for-in-array": "error",
1456
+ "@typescript-eslint/no-implied-eval": "error",
1457
+ "@typescript-eslint/no-misused-promises": "error",
1458
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
1459
+ "@typescript-eslint/no-unsafe-argument": "error",
1460
+ "@typescript-eslint/no-unsafe-assignment": "error",
1461
+ "@typescript-eslint/no-unsafe-call": "error",
1462
+ "@typescript-eslint/no-unsafe-member-access": "error",
1463
+ "@typescript-eslint/no-unsafe-return": "error",
1464
+ "@typescript-eslint/prefer-nullish-coalescing": ["error", { ignorePrimitives: { string: true } }],
1465
+ "@typescript-eslint/prefer-optional-chain": "error",
1466
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
1467
+ "@typescript-eslint/promise-function-async": "error",
1468
+ "@typescript-eslint/restrict-plus-operands": "error",
1469
+ "@typescript-eslint/restrict-template-expressions": "error",
1470
+ "@typescript-eslint/return-await": ["error", "in-try-catch"],
1471
+ "@typescript-eslint/switch-exhaustiveness-check": ["error", { considerDefaultExhaustiveForUnions: true }],
1472
+ "@typescript-eslint/unbound-method": "error"
1473
+ };
1474
+ const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
1475
+ function makeParser(typeAware, files$1, ignores$1) {
1476
+ return {
1477
+ files: files$1,
1478
+ ...ignores$1 ? { ignores: ignores$1 } : {},
1479
+ languageOptions: {
1480
+ parser: parserTs,
1481
+ parserOptions: {
1482
+ extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1483
+ sourceType: "module",
1484
+ ...typeAware ? {
1485
+ projectService: {
1486
+ allowDefaultProject: ["./*.js"],
1487
+ defaultProject: tsconfigPath
1488
+ },
1489
+ tsconfigRootDir: process.cwd()
1490
+ } : {},
1491
+ ...parserOptions
1492
+ }
1493
+ },
1494
+ name: `eienjs/typescript/${typeAware ? "type-aware-parser" : "parser"}`
1495
+ };
1496
+ }
1497
+ return [
1498
+ {
1499
+ name: "eienjs/typescript/setup",
1500
+ plugins: {
1501
+ "antfu": pluginAntfu,
1502
+ "@typescript-eslint": pluginTs
1503
+ }
1504
+ },
1505
+ ...isTypeAware ? [makeParser(false, files), makeParser(true, filesTypeAware, ignoresTypeAware)] : [makeParser(false, files)],
1506
+ {
1507
+ files,
1508
+ name: "eienjs/typescript/rules",
1509
+ rules: {
1510
+ ...pluginTs.configs["eslint-recommended"].overrides[0].rules,
1511
+ ...pluginTs.configs.strict.rules,
1512
+ "no-dupe-class-members": "off",
1513
+ "no-redeclare": "off",
1514
+ "no-use-before-define": "off",
1515
+ "no-useless-constructor": "off",
1516
+ "@typescript-eslint/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
1517
+ "@typescript-eslint/consistent-type-assertions": "error",
1518
+ "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
1519
+ "@typescript-eslint/consistent-type-imports": ["error", {
1520
+ disallowTypeAnnotations: false,
1521
+ fixStyle: "separate-type-imports",
1522
+ prefer: "type-imports"
1523
+ }],
1524
+ "@typescript-eslint/default-param-last": "error",
1525
+ "@typescript-eslint/method-signature-style": ["error", "property"],
1526
+ "@typescript-eslint/no-dupe-class-members": "error",
1527
+ "@typescript-eslint/no-dynamic-delete": "off",
1528
+ "@typescript-eslint/no-empty-object-type": ["error", { allowInterfaces: "always" }],
1529
+ "@typescript-eslint/no-explicit-any": "off",
1530
+ "@typescript-eslint/no-extraneous-class": "off",
1531
+ "@typescript-eslint/no-import-type-side-effects": "error",
1532
+ "@typescript-eslint/no-invalid-void-type": "off",
1533
+ "@typescript-eslint/no-non-null-assertion": "off",
1534
+ "@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
1535
+ "@typescript-eslint/no-require-imports": "error",
1536
+ "@typescript-eslint/no-unused-expressions": ["error", {
1537
+ allowShortCircuit: true,
1538
+ allowTaggedTemplates: true,
1539
+ allowTernary: true
1540
+ }],
1541
+ "@typescript-eslint/no-unused-vars": "off",
1542
+ "@typescript-eslint/no-use-before-define": ["error", {
1543
+ classes: false,
1544
+ functions: false,
1545
+ variables: true
1546
+ }],
1547
+ "@typescript-eslint/no-useless-constructor": "off",
1548
+ "@typescript-eslint/no-wrapper-object-types": "error",
1549
+ "@typescript-eslint/triple-slash-reference": "off",
1550
+ "@typescript-eslint/unified-signatures": "off",
1551
+ ...overrides
1552
+ }
1553
+ },
1554
+ ...isTypeAware ? [{
1555
+ files: filesTypeAware,
1556
+ ignores: ignoresTypeAware,
1557
+ name: "eienjs/typescript/rules-type-aware",
1558
+ rules: {
1559
+ ...typeAwareRules,
1560
+ ...overridesTypeAware
1561
+ }
1562
+ }] : []
1563
+ ];
1564
+ }
1565
+
1566
+ //#endregion
1567
+ //#region src/configs/unicorn.ts
1568
+ async function unicorn(options = {}) {
1569
+ const { overrides = {} } = options;
1570
+ return [{
1571
+ name: "eienjs/unicorn/rules",
1572
+ plugins: { unicorn: pluginUnicorn },
1573
+ rules: {
1574
+ ...pluginUnicorn.configs.recommended.rules,
1575
+ "unicorn/no-this-assignment": "off",
1576
+ "unicorn/consistent-destructuring": "error",
1577
+ "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
1578
+ "unicorn/filename-case": ["error", { case: "snakeCase" }],
1579
+ "unicorn/no-null": "off",
1580
+ "unicorn/no-static-only-class": "off",
1581
+ "unicorn/numeric-separators-style": "off",
1582
+ "unicorn/prefer-dom-node-append": "off",
1583
+ "unicorn/prefer-dom-node-dataset": "off",
1584
+ "unicorn/prefer-dom-node-remove": "off",
1585
+ "unicorn/prefer-dom-node-text-content": "off",
1586
+ "unicorn/prefer-modern-dom-apis": "off",
1587
+ "unicorn/prefer-query-selector": "off",
1588
+ "unicorn/prefer-switch": ["error", { emptyDefaultCase: "do-nothing-comment" }],
1589
+ "unicorn/prevent-abbreviations": "off",
1590
+ "unicorn/no-thenable": "off",
1591
+ "unicorn/expiring-todo-comments": "off",
1592
+ "unicorn/no-array-reduce": "off",
1593
+ "unicorn/prefer-export-from": "off",
1594
+ ...overrides
1595
+ }
1596
+ }];
1597
+ }
1598
+
1599
+ //#endregion
1600
+ //#region src/configs/vue.ts
1601
+ async function vue(options = {}) {
1602
+ const { files = [GLOB_VUE], overrides = {}, stylistic: stylistic$1 = true, typescript: typescript$1 } = options;
1603
+ const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
1604
+ const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
1605
+ const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
1606
+ interopDefault(import("eslint-plugin-vue")),
1607
+ interopDefault(import("vue-eslint-parser")),
1608
+ interopDefault(import("eslint-processor-vue-blocks"))
1609
+ ]);
1610
+ return [{
1611
+ languageOptions: { globals: {
1612
+ computed: "readonly",
1613
+ defineEmits: "readonly",
1614
+ defineExpose: "readonly",
1615
+ defineProps: "readonly",
1616
+ onMounted: "readonly",
1617
+ onUnmounted: "readonly",
1618
+ reactive: "readonly",
1619
+ ref: "readonly",
1620
+ shallowReactive: "readonly",
1621
+ shallowRef: "readonly",
1622
+ toRef: "readonly",
1623
+ toRefs: "readonly",
1624
+ watch: "readonly",
1625
+ watchEffect: "readonly"
1626
+ } },
1627
+ name: "eienjs/vue/setup",
1628
+ plugins: { vue: pluginVue }
1629
+ }, {
1630
+ files,
1631
+ languageOptions: {
1632
+ parser: parserVue,
1633
+ parserOptions: {
1634
+ ecmaFeatures: { jsx: true },
1635
+ extraFileExtensions: [".vue"],
1636
+ parser: typescript$1 ? await interopDefault(import("@typescript-eslint/parser")) : null,
1637
+ sourceType: "module"
1638
+ }
1639
+ },
1640
+ name: "eienjs/vue/rules",
1641
+ processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors([pluginVue.processors[".vue"], processorVueBlocks({
1642
+ ...sfcBlocks,
1643
+ blocks: {
1644
+ styles: true,
1645
+ ...sfcBlocks.blocks
1646
+ }
1647
+ })]),
1648
+ rules: {
1649
+ ...pluginVue.configs.base.rules,
1650
+ ...pluginVue.configs["flat/essential"].map((c) => c.rules).reduce((acc, c) => ({
1651
+ ...acc,
1652
+ ...c
1653
+ }), {}),
1654
+ ...pluginVue.configs["flat/strongly-recommended"].map((c) => c.rules).reduce((acc, c) => ({
1655
+ ...acc,
1656
+ ...c
1657
+ }), {}),
1658
+ ...pluginVue.configs["flat/recommended"].map((c) => c.rules).reduce((acc, c) => ({
1659
+ ...acc,
1660
+ ...c
1661
+ }), {}),
1662
+ "antfu/no-top-level-await": "off",
1663
+ "n/prefer-global/process": "off",
1664
+ "@typescript-eslint/explicit-function-return-type": "off",
1665
+ "@typescript-eslint/naming-convention": "off",
1666
+ "vue/block-order": ["error", { order: [
1667
+ "script",
1668
+ "template",
1669
+ "style"
1670
+ ] }],
1671
+ "vue/component-name-in-template-casing": ["error", "PascalCase"],
1672
+ "vue/component-options-name-casing": ["error", "PascalCase"],
1673
+ "vue/custom-event-name-casing": ["error", "camelCase"],
1674
+ "vue/define-macros-order": ["error", { order: [
1675
+ "defineOptions",
1676
+ "defineProps",
1677
+ "defineEmits",
1678
+ "defineSlots"
1679
+ ] }],
1680
+ "vue/define-props-declaration": ["error", "runtime"],
1681
+ "vue/dot-location": ["error", "property"],
1682
+ "vue/dot-notation": ["error", { allowKeywords: true }],
1683
+ "vue/eqeqeq": ["error", "smart"],
1684
+ "vue/html-indent": ["error", indent],
1685
+ "vue/html-quotes": ["error", "double"],
1686
+ "vue/max-attributes-per-line": "off",
1687
+ "vue/multi-word-component-names": "off",
1688
+ "vue/no-dupe-keys": "off",
1689
+ "vue/no-empty-pattern": "error",
1690
+ "vue/no-irregular-whitespace": "error",
1691
+ "vue/no-loss-of-precision": "error",
1692
+ "vue/no-multiple-objects-in-class": "error",
1693
+ "vue/no-ref-object-reactivity-loss": "error",
1694
+ "vue/no-required-prop-with-default": "error",
1695
+ "vue/no-restricted-syntax": [
1696
+ "error",
1697
+ "DebuggerStatement",
1698
+ "LabeledStatement",
1699
+ "WithStatement"
1700
+ ],
1701
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
1702
+ "vue/no-root-v-if": "error",
1703
+ "vue/no-setup-props-reactivity-loss": "off",
1704
+ "vue/no-sparse-arrays": "error",
1705
+ "vue/no-template-target-blank": "error",
1706
+ "vue/no-unused-refs": "error",
1707
+ "vue/no-unused-properties": "error",
1708
+ "vue/no-use-v-else-with-v-for": "error",
1709
+ "vue/no-useless-mustaches": "error",
1710
+ "vue/no-useless-v-bind": "error",
1711
+ "vue/no-v-html": "off",
1712
+ "vue/object-shorthand": [
1713
+ "error",
1714
+ "always",
1715
+ {
1716
+ avoidQuotes: true,
1717
+ ignoreConstructors: false
1718
+ }
1719
+ ],
1720
+ "vue/prefer-separate-static-class": "error",
1721
+ "vue/prefer-template": "error",
1722
+ "vue/prop-name-casing": ["error", "camelCase"],
1723
+ "vue/require-default-prop": "off",
1724
+ "vue/require-prop-types": "off",
1725
+ "vue/space-infix-ops": "error",
1726
+ "vue/space-unary-ops": ["error", {
1727
+ nonwords: false,
1728
+ words: true
1729
+ }],
1730
+ ...stylistic$1 ? {
1731
+ "vue/array-bracket-spacing": ["error", "never"],
1732
+ "vue/arrow-spacing": ["error", {
1733
+ after: true,
1734
+ before: true
1735
+ }],
1736
+ "vue/block-spacing": ["error", "always"],
1737
+ "vue/block-tag-newline": ["error", {
1738
+ multiline: "always",
1739
+ singleline: "always"
1740
+ }],
1741
+ "vue/brace-style": [
1742
+ "error",
1743
+ "stroustrup",
1744
+ { allowSingleLine: true }
1745
+ ],
1746
+ "vue/comma-dangle": ["error", "always-multiline"],
1747
+ "vue/comma-spacing": ["error", {
1748
+ after: true,
1749
+ before: false
1750
+ }],
1751
+ "vue/comma-style": ["error", "last"],
1752
+ "vue/html-comment-content-spacing": [
1753
+ "error",
1754
+ "always",
1755
+ { exceptions: ["-"] }
1756
+ ],
1757
+ "vue/key-spacing": ["error", {
1758
+ afterColon: true,
1759
+ beforeColon: false
1760
+ }],
1761
+ "vue/keyword-spacing": ["error", {
1762
+ after: true,
1763
+ before: true
1764
+ }],
1765
+ "vue/object-curly-newline": "off",
1766
+ "vue/object-curly-spacing": ["error", "always"],
1767
+ "vue/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
1768
+ "vue/operator-linebreak": ["error", "before"],
1769
+ "vue/padding-line-between-blocks": ["error", "always"],
1770
+ "vue/quote-props": ["error", "consistent-as-needed"],
1771
+ "vue/space-in-parens": ["error", "never"],
1772
+ "vue/template-curly-spacing": "error"
1773
+ } : {},
1774
+ "unicorn/filename-case": "off",
1775
+ ...overrides
1776
+ }
1777
+ }];
1778
+ }
1779
+
1780
+ //#endregion
1781
+ //#region src/configs/yaml.ts
1782
+ async function yaml(options = {}) {
1783
+ const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
1784
+ const { indent = 2, quotes = "single" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
1785
+ const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
1786
+ return [
1787
+ {
1788
+ name: "eienjs/yaml/setup",
1789
+ plugins: { yaml: pluginYaml }
1790
+ },
1791
+ {
1792
+ files,
1793
+ languageOptions: { parser: parserYaml },
1794
+ name: "eienjs/yaml/rules",
1795
+ rules: {
1796
+ "@stylistic/spaced-comment": "off",
1797
+ "unicorn/filename-case": "off",
1798
+ "yaml/block-mapping": "error",
1799
+ "yaml/block-sequence": "error",
1800
+ "yaml/no-empty-key": "error",
1801
+ "yaml/no-empty-sequence-entry": "error",
1802
+ "yaml/no-irregular-whitespace": "error",
1803
+ "yaml/plain-scalar": "error",
1804
+ "yaml/vue-custom-block/no-parsing-error": "error",
1805
+ ...stylistic$1 ? {
1806
+ "yaml/block-mapping-question-indicator-newline": "error",
1807
+ "yaml/block-sequence-hyphen-indicator-newline": "error",
1808
+ "yaml/flow-mapping-curly-newline": "error",
1809
+ "yaml/flow-mapping-curly-spacing": "error",
1810
+ "yaml/flow-sequence-bracket-newline": "error",
1811
+ "yaml/flow-sequence-bracket-spacing": "error",
1812
+ "yaml/indent": ["error", indent === "tab" ? 2 : indent],
1813
+ "yaml/key-spacing": "error",
1814
+ "yaml/no-tab-indent": "error",
1815
+ "yaml/quotes": ["error", {
1816
+ avoidEscape: true,
1817
+ prefer: quotes === "backtick" ? "single" : quotes
1818
+ }],
1819
+ "yaml/spaced-comment": "error"
1820
+ } : {},
1821
+ ...overrides
1822
+ }
1823
+ },
1824
+ {
1825
+ files: ["pnpm-workspace.yaml"],
1826
+ name: "eienjs/yaml/pnpm-workspace",
1827
+ rules: { "yaml/sort-keys": [
1828
+ "error",
1829
+ {
1830
+ order: [
1831
+ "packages",
1832
+ "overrides",
1833
+ "patchedDependencies",
1834
+ "hoistPattern",
1835
+ "catalog",
1836
+ "catalogs",
1837
+ "allowedDeprecatedVersions",
1838
+ "allowNonAppliedPatches",
1839
+ "configDependencies",
1840
+ "ignoredBuiltDependencies",
1841
+ "ignoredOptionalDependencies",
1842
+ "neverBuiltDependencies",
1843
+ "onlyBuiltDependencies",
1844
+ "onlyBuiltDependenciesFile",
1845
+ "packageExtensions",
1846
+ "peerDependencyRules",
1847
+ "supportedArchitectures"
1848
+ ],
1849
+ pathPattern: "^$"
1850
+ },
1851
+ {
1852
+ order: { type: "asc" },
1853
+ pathPattern: ".*"
1854
+ }
1855
+ ] }
1856
+ }
1857
+ ];
1858
+ }
1859
+
1860
+ //#endregion
1861
+ export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, astro, combine, command, comments, disables, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, vue, yaml };