@favorodera/eslint-config 0.0.6 → 0.0.8

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 DELETED
@@ -1,1435 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region \0rolldown/runtime.js
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
- get: ((k) => from[k]).bind(null, key),
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
- value: mod,
21
- enumerable: true
22
- }) : target, mod));
23
- //#endregion
24
- let eslint_flat_config_utils = require("eslint-flat-config-utils");
25
- let defu = require("defu");
26
- let globals = require("globals");
27
- globals = __toESM(globals, 1);
28
- let eslint_merge_processors = require("eslint-merge-processors");
29
- let eslint_processor_vue_blocks = require("eslint-processor-vue-blocks");
30
- eslint_processor_vue_blocks = __toESM(eslint_processor_vue_blocks, 1);
31
- //#region src/globs.ts
32
- /** Glob pattern for matching JavaScript files */
33
- const jsGlob = "**/*.{js,cjs,mjs}";
34
- /** Glob pattern for matching TypeScript files */
35
- const tsGlob = "**/*.{ts,cts,mts}";
36
- /** Glob pattern for matching Vue single-file components */
37
- const vueGlob = "**/*.vue";
38
- /** Glob pattern for matching Markdown files */
39
- const mdGlob = "**/*.md";
40
- /** Glob pattern for matching virtual files extracted from Markdown */
41
- const mdInMdGlob = "**/*.md/*.md";
42
- /** Glob pattern for matching code blocks embedded in Markdown files */
43
- const codeInMdGlob = "**/*.md/**/*.{js,cjs,mjs,ts,cts,mts,vue}";
44
- /** Glob pattern for matching test files */
45
- const testsGlob = ["**/*.{tests,specs,benchmark,bench}.{js,cjs,mjs,ts,cts,mts}", "**/__tests__/**/*.{js,cjs,mjs,ts,cts,mts}"];
46
- /** Glob pattern for matching JSON files */
47
- const jsonGlob = "**/*.json";
48
- /** Glob pattern for matching JSON5 files */
49
- const json5Glob = "**/*.json5";
50
- /** Glob pattern for matching JSON with Comments files */
51
- const jsoncGlob = "**/*.jsonc";
52
- /** Glob patterns for matching TypeScript configuration files */
53
- const tsConfigGlob = ["**/tsconfig.json", "**/tsconfig.*.json"];
54
- /** Glob pattern for matching YAML files */
55
- const yamlGlob = "**/*.{yml,yaml}";
56
- /** Glob pattern for matching pnpm-workspace.yaml file */
57
- const pnpmWorkspaceGlob = "pnpm-workspace.yaml";
58
- /** Glob pattern for matching package.json files */
59
- const packageJsonGlob = "**/package.json";
60
- //#endregion
61
- //#region src/configs/ignores.ts
62
- const defaultPatterns = [
63
- "**/node_modules/**",
64
- "**/dist/**",
65
- "**/package-lock.json",
66
- "**/yarn.lock",
67
- "**/pnpm-lock.yaml",
68
- "**/bun.lockb",
69
- "**/output",
70
- "**/coverage",
71
- "**/temp",
72
- "**/.temp",
73
- "**/tmp",
74
- "**/.tmp",
75
- "**/.history",
76
- "**/.vitepress/cache",
77
- "**/.nuxt",
78
- "**/.next",
79
- "**/.svelte-kit",
80
- "**/.vercel",
81
- "**/.changeset",
82
- "**/.idea",
83
- "**/.cache",
84
- "**/.output",
85
- "**/.vite-inspect",
86
- "**/.yarn",
87
- "**/CHANGELOG*.md",
88
- "**/LICENSE*",
89
- "**/*.min.*",
90
- "**/__snapshots__",
91
- "**/vite.config.*.timestamp-*",
92
- "**/auto-import?(s).d.ts",
93
- "**/components.d.ts",
94
- "**/.context",
95
- "**/.claude",
96
- "**/.agents",
97
- "**/.*/skills"
98
- ];
99
- /**
100
- * Globs for ignoring files and directories from ESLint scanning.
101
- * @param patterns Additional ignore patterns or a function to modify the defaults.
102
- * @returns An array containing the ignore flat config item.
103
- */
104
- function ignores(patterns = []) {
105
- return [{
106
- ignores: typeof patterns === "function" ? patterns(defaultPatterns) : [...defaultPatterns, ...patterns],
107
- name: "favorodera/ignores"
108
- }];
109
- }
110
- //#endregion
111
- //#region src/utils.ts
112
- /**
113
- * Extracts and merges the rules from multiple ESLint configuration arrays.
114
- * @param configArrays Rest parameter representing multiple arrays of ESLint flat config items.
115
- * @returns A single object containing all the merged rules from the provided configurations.
116
- */
117
- function extractRules(...configArrays) {
118
- return Object.assign({}, ...configArrays.flat().map((config) => config?.rules || {}));
119
- }
120
- /**
121
- * Resolves a module (or a promise of one) and returns its default export
122
- * if present, otherwise returns the module itself.
123
- *
124
- * Handles both ESM modules (which wrap exports under `.default`) and
125
- * CJS / plain-object modules uniformly.
126
- * @template TModule The type of the module being imported.
127
- * @param module A module or a promise that resolves to one.
128
- * @returns The `.default` export if it exists, otherwise the module itself.
129
- */
130
- async function importModule(module) {
131
- const resolved = await module;
132
- if (resolved !== null && typeof resolved === "object" && "default" in resolved) return resolved.default;
133
- return resolved;
134
- }
135
- /**
136
- * Normalize boolean or options value into merged options or null.
137
- * Returns null when the input is false or undefined.
138
- * @template TOptions The type of the options object.
139
- * @param value The configuration value, which can be a boolean, an options object, or undefined.
140
- * @param defaults The default options to merge with if `value` is true or an object.
141
- * @returns The merged options object, or false if the feature is disabled.
142
- */
143
- function resolveOptions(value, defaults) {
144
- if (!value) return false;
145
- return (0, defu.defu)(value === true ? {} : value, defaults);
146
- }
147
- //#endregion
148
- //#region src/configs/imports.ts
149
- const importsDefaults = { files: [
150
- jsGlob,
151
- tsGlob,
152
- vueGlob
153
- ] };
154
- /**
155
- * Constructs the flat config items for imports linting, providing plugin setup and
156
- * specific rules to enforce consistent import ordering and unused variable checks.
157
- * @param options Configuration options for imports linting.
158
- * @returns Promise resolving to imports ESLint config items.
159
- */
160
- async function imports(options) {
161
- const resolved = (0, defu.defu)(options, importsDefaults);
162
- const [importPlugin, unusedImportsPlugin] = await Promise.all([importModule(import("eslint-plugin-import-lite")), importModule(import("eslint-plugin-unused-imports"))]);
163
- const baseRules = importPlugin.configs.recommended?.rules || {};
164
- return [{
165
- name: "favorodera/imports/setup",
166
- plugins: {
167
- "import": importPlugin,
168
- "unused-imports": unusedImportsPlugin
169
- }
170
- }, {
171
- files: resolved.files,
172
- name: "favorodera/imports/rules",
173
- rules: {
174
- ...(0, eslint_flat_config_utils.renamePluginsInRules)(baseRules, { "import-lite": "import" }),
175
- "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
176
- "import/first": "error",
177
- "import/newline-after-import": ["error", { count: 1 }],
178
- "import/no-duplicates": "error",
179
- "import/no-mutable-exports": "error",
180
- "import/no-named-default": "error",
181
- "unused-imports/no-unused-imports": "error",
182
- "unused-imports/no-unused-vars": ["error", {
183
- args: "after-used",
184
- argsIgnorePattern: "^_",
185
- ignoreRestSiblings: true,
186
- vars: "all",
187
- varsIgnorePattern: "^_"
188
- }],
189
- ...resolved.overrides
190
- }
191
- }];
192
- }
193
- //#endregion
194
- //#region src/configs/javascript.ts
195
- const javascriptDefaults = { files: [
196
- jsGlob,
197
- tsGlob,
198
- vueGlob
199
- ] };
200
- /**
201
- * Constructs the flat config items for core JavaScript linting, setting up the required
202
- * language options, globals, and recommended baseline rules.
203
- * @param options Javascript configuration options.
204
- * @returns Promise resolving to javascript ESLint config items.
205
- */
206
- async function javascript(options) {
207
- const resolved = (0, defu.defu)(options, javascriptDefaults);
208
- const baseRules = (await importModule(import("@eslint/js"))).configs.recommended.rules;
209
- return [{
210
- languageOptions: {
211
- ecmaVersion: "latest",
212
- globals: {
213
- ...globals.default.browser,
214
- ...globals.default.es2021,
215
- ...globals.default.node,
216
- document: "readonly",
217
- navigator: "readonly",
218
- window: "readonly"
219
- },
220
- sourceType: "module"
221
- },
222
- linterOptions: { reportUnusedDisableDirectives: true },
223
- name: "favorodera/javascript/setup"
224
- }, {
225
- files: resolved.files,
226
- name: "favorodera/javascript/rules",
227
- rules: {
228
- ...baseRules,
229
- "array-callback-return": "error",
230
- "block-scoped-var": "error",
231
- "constructor-super": "error",
232
- "default-case-last": "error",
233
- "dot-notation": ["error", { allowKeywords: true }],
234
- "eqeqeq": ["error", "smart"],
235
- "new-cap": ["error", {
236
- capIsNew: false,
237
- newIsCap: true,
238
- properties: true
239
- }],
240
- "no-alert": "error",
241
- "no-array-constructor": "error",
242
- "no-async-promise-executor": "error",
243
- "no-caller": "error",
244
- "no-case-declarations": "error",
245
- "no-class-assign": "error",
246
- "no-compare-neg-zero": "error",
247
- "no-cond-assign": ["error", "always"],
248
- "no-console": ["error", { allow: ["warn", "error"] }],
249
- "no-const-assign": "error",
250
- "no-control-regex": "error",
251
- "no-debugger": "error",
252
- "no-delete-var": "error",
253
- "no-dupe-args": "error",
254
- "no-dupe-class-members": "error",
255
- "no-dupe-keys": "error",
256
- "no-duplicate-case": "error",
257
- "no-empty": ["error", { allowEmptyCatch: true }],
258
- "no-empty-character-class": "error",
259
- "no-empty-pattern": "error",
260
- "no-eval": "error",
261
- "no-ex-assign": "error",
262
- "no-extend-native": "error",
263
- "no-extra-bind": "error",
264
- "no-extra-boolean-cast": "error",
265
- "no-fallthrough": "error",
266
- "no-func-assign": "error",
267
- "no-global-assign": "error",
268
- "no-implied-eval": "error",
269
- "no-import-assign": "error",
270
- "no-invalid-regexp": "error",
271
- "no-irregular-whitespace": "error",
272
- "no-iterator": "error",
273
- "no-labels": ["error", {
274
- allowLoop: false,
275
- allowSwitch: false
276
- }],
277
- "no-lone-blocks": "error",
278
- "no-loss-of-precision": "error",
279
- "no-misleading-character-class": "error",
280
- "no-multi-str": "error",
281
- "no-new": "error",
282
- "no-new-func": "error",
283
- "no-new-native-nonconstructor": "error",
284
- "no-new-wrappers": "error",
285
- "no-obj-calls": "error",
286
- "no-octal": "error",
287
- "no-octal-escape": "error",
288
- "no-proto": "error",
289
- "no-prototype-builtins": "error",
290
- "no-redeclare": ["error", { builtinGlobals: false }],
291
- "no-regex-spaces": "error",
292
- "no-restricted-globals": [
293
- "error",
294
- {
295
- message: "Use `globalThis` instead.",
296
- name: "global"
297
- },
298
- {
299
- message: "Use `globalThis` instead.",
300
- name: "self"
301
- }
302
- ],
303
- "no-restricted-properties": [
304
- "error",
305
- {
306
- message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
307
- property: "__proto__"
308
- },
309
- {
310
- message: "Use `Object.defineProperty` instead.",
311
- property: "__defineGetter__"
312
- },
313
- {
314
- message: "Use `Object.defineProperty` instead.",
315
- property: "__defineSetter__"
316
- },
317
- {
318
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
319
- property: "__lookupGetter__"
320
- },
321
- {
322
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
323
- property: "__lookupSetter__"
324
- }
325
- ],
326
- "no-restricted-syntax": [
327
- "error",
328
- "TSEnumDeclaration[const=true]",
329
- "TSExportAssignment"
330
- ],
331
- "no-self-assign": ["error", { props: true }],
332
- "no-self-compare": "error",
333
- "no-sequences": "error",
334
- "no-shadow-restricted-names": "error",
335
- "no-sparse-arrays": "error",
336
- "no-template-curly-in-string": "error",
337
- "no-this-before-super": "error",
338
- "no-throw-literal": "error",
339
- "no-undef": "error",
340
- "no-undef-init": "error",
341
- "no-unexpected-multiline": "error",
342
- "no-unmodified-loop-condition": "error",
343
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
344
- "no-unreachable": "error",
345
- "no-unreachable-loop": "error",
346
- "no-unsafe-finally": "error",
347
- "no-unsafe-negation": "error",
348
- "no-unused-expressions": ["error", {
349
- allowShortCircuit: true,
350
- allowTaggedTemplates: true,
351
- allowTernary: true
352
- }],
353
- "no-unused-vars": ["error", {
354
- args: "none",
355
- caughtErrors: "none",
356
- ignoreRestSiblings: true,
357
- vars: "all"
358
- }],
359
- "no-use-before-define": ["error", {
360
- classes: false,
361
- functions: false,
362
- variables: true
363
- }],
364
- "no-useless-backreference": "error",
365
- "no-useless-call": "error",
366
- "no-useless-catch": "error",
367
- "no-useless-computed-key": "error",
368
- "no-useless-constructor": "error",
369
- "no-useless-rename": "error",
370
- "no-useless-return": "error",
371
- "no-var": "error",
372
- "no-with": "error",
373
- "object-shorthand": [
374
- "error",
375
- "always",
376
- {
377
- avoidQuotes: true,
378
- ignoreConstructors: false
379
- }
380
- ],
381
- "one-var": ["error", { initialized: "never" }],
382
- "prefer-arrow-callback": ["error", {
383
- allowNamedFunctions: false,
384
- allowUnboundThis: true
385
- }],
386
- "prefer-const": ["error", {
387
- destructuring: "all",
388
- ignoreReadBeforeAssign: true
389
- }],
390
- "prefer-exponentiation-operator": "error",
391
- "prefer-promise-reject-errors": "error",
392
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
393
- "prefer-rest-params": "error",
394
- "prefer-spread": "error",
395
- "prefer-template": "error",
396
- "symbol-description": "error",
397
- "unicode-bom": ["error", "never"],
398
- "use-isnan": ["error", {
399
- enforceForIndexOf: true,
400
- enforceForSwitchCase: true
401
- }],
402
- "valid-typeof": ["error", { requireStringLiterals: true }],
403
- "vars-on-top": "error",
404
- "yoda": ["error", "never"],
405
- ...resolved.overrides
406
- }
407
- }];
408
- }
409
- //#endregion
410
- //#region src/configs/jsdoc.ts
411
- const jsdocDefaults = { files: [
412
- jsGlob,
413
- tsGlob,
414
- vueGlob
415
- ] };
416
- /**
417
- * Constructs the flat config items for JSDoc linting, ensuring comments follow
418
- * proper styling, parameter checks, and types alignment.
419
- * @param options JSDoc configuration options.
420
- * @returns Promise resolving to JSDoc ESLint config items.
421
- */
422
- async function jsdoc(options) {
423
- const resolved = (0, defu.defu)(options, jsdocDefaults);
424
- const jsdocPlugin = await importModule(import("eslint-plugin-jsdoc"));
425
- const baseRules = {
426
- ...jsdocPlugin.configs["flat/recommended-typescript-error"]?.rules,
427
- ...jsdocPlugin.configs["flat/stylistic-typescript-error"]?.rules
428
- };
429
- return [{
430
- name: "favorodera/jsdoc/setup",
431
- plugins: { jsdoc: jsdocPlugin }
432
- }, {
433
- files: resolved.files,
434
- name: "favorodera/jsdoc/rules",
435
- rules: {
436
- ...baseRules,
437
- "jsdoc/check-access": "warn",
438
- "jsdoc/check-alignment": "warn",
439
- "jsdoc/check-param-names": "warn",
440
- "jsdoc/check-property-names": "warn",
441
- "jsdoc/check-types": "warn",
442
- "jsdoc/empty-tags": "warn",
443
- "jsdoc/implements-on-classes": "warn",
444
- "jsdoc/multiline-blocks": "warn",
445
- "jsdoc/no-defaults": "warn",
446
- "jsdoc/no-multi-asterisks": "warn",
447
- "jsdoc/require-param-name": "warn",
448
- "jsdoc/require-property": "warn",
449
- "jsdoc/require-property-description": "warn",
450
- "jsdoc/require-property-name": "warn",
451
- "jsdoc/require-returns-check": "warn",
452
- "jsdoc/require-returns-description": "warn",
453
- "jsdoc/require-yields-check": "warn",
454
- ...resolved.overrides
455
- }
456
- }];
457
- }
458
- //#endregion
459
- //#region src/configs/jsonc.ts
460
- const jsoncDefaults = { files: [
461
- json5Glob,
462
- jsoncGlob,
463
- jsonGlob
464
- ] };
465
- /**
466
- * Constructs the flat config items for JSON, JSON5, and JSONC linting, setting up
467
- * the custom parser, rule validations, and sorting rules for package.json/tsconfig.json.
468
- * @param options JSONC configuration options.
469
- * @returns Promise resolving to JSONC ESLint config items.
470
- */
471
- async function jsonc(options) {
472
- const resolved = (0, defu.defu)(options, jsoncDefaults);
473
- return [
474
- {
475
- name: "favorodera/jsonc/setup",
476
- plugins: { jsonc: await importModule(import("eslint-plugin-jsonc")) }
477
- },
478
- {
479
- files: resolved.files,
480
- language: "jsonc/x",
481
- name: "favorodera/jsonc/rules",
482
- rules: {
483
- "jsonc/array-bracket-spacing": ["error", "never"],
484
- "jsonc/comma-dangle": ["error", "never"],
485
- "jsonc/comma-style": ["error", "last"],
486
- "jsonc/indent": ["error", 2],
487
- "jsonc/key-spacing": ["error", {
488
- afterColon: true,
489
- beforeColon: false
490
- }],
491
- "jsonc/no-bigint-literals": "error",
492
- "jsonc/no-binary-expression": "error",
493
- "jsonc/no-binary-numeric-literals": "error",
494
- "jsonc/no-dupe-keys": "error",
495
- "jsonc/no-escape-sequence-in-identifier": "error",
496
- "jsonc/no-floating-decimal": "error",
497
- "jsonc/no-hexadecimal-numeric-literals": "error",
498
- "jsonc/no-infinity": "error",
499
- "jsonc/no-multi-str": "error",
500
- "jsonc/no-nan": "error",
501
- "jsonc/no-number-props": "error",
502
- "jsonc/no-numeric-separators": "error",
503
- "jsonc/no-octal": "error",
504
- "jsonc/no-octal-escape": "error",
505
- "jsonc/no-octal-numeric-literals": "error",
506
- "jsonc/no-parenthesized": "error",
507
- "jsonc/no-plus-sign": "error",
508
- "jsonc/no-regexp-literals": "error",
509
- "jsonc/no-sparse-arrays": "error",
510
- "jsonc/no-template-literals": "error",
511
- "jsonc/no-undefined-value": "error",
512
- "jsonc/no-unicode-codepoint-escapes": "error",
513
- "jsonc/no-useless-escape": "error",
514
- "jsonc/object-curly-newline": ["error", {
515
- consistent: true,
516
- multiline: true
517
- }],
518
- "jsonc/object-curly-spacing": ["error", "always"],
519
- "jsonc/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
520
- "jsonc/quote-props": "error",
521
- "jsonc/quotes": "error",
522
- "jsonc/space-unary-ops": "error",
523
- "jsonc/valid-json-number": "error",
524
- "jsonc/vue-custom-block/no-parsing-error": "error",
525
- ...resolved.overrides
526
- }
527
- },
528
- {
529
- files: [packageJsonGlob],
530
- name: "favorodera/jsonc/sort/package-json",
531
- rules: {
532
- "jsonc/sort-array-values": ["error", {
533
- order: { type: "asc" },
534
- pathPattern: "^files$"
535
- }],
536
- "jsonc/sort-keys": [
537
- "error",
538
- {
539
- order: [
540
- "publisher",
541
- "name",
542
- "displayName",
543
- "type",
544
- "version",
545
- "private",
546
- "packageManager",
547
- "description",
548
- "author",
549
- "contributors",
550
- "license",
551
- "funding",
552
- "homepage",
553
- "repository",
554
- "bugs",
555
- "keywords",
556
- "categories",
557
- "sideEffects",
558
- "imports",
559
- "exports",
560
- "main",
561
- "module",
562
- "unpkg",
563
- "jsdelivr",
564
- "types",
565
- "typesVersions",
566
- "bin",
567
- "icon",
568
- "files",
569
- "engines",
570
- "activationEvents",
571
- "contributes",
572
- "scripts",
573
- "peerDependencies",
574
- "peerDependenciesMeta",
575
- "dependencies",
576
- "optionalDependencies",
577
- "devDependencies",
578
- "pnpm",
579
- "overrides",
580
- "resolutions",
581
- "husky",
582
- "simple-git-hooks",
583
- "lint-staged",
584
- "eslintConfig"
585
- ],
586
- pathPattern: "^$"
587
- },
588
- {
589
- order: { type: "asc" },
590
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
591
- },
592
- {
593
- order: { type: "asc" },
594
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
595
- },
596
- {
597
- order: { type: "asc" },
598
- pathPattern: String.raw`^workspaces\.catalog$`
599
- },
600
- {
601
- order: { type: "asc" },
602
- pathPattern: String.raw`^workspaces\.catalogs\.[^.]+$`
603
- },
604
- {
605
- order: [
606
- "types",
607
- "import",
608
- "require",
609
- "default"
610
- ],
611
- pathPattern: "^exports.*$"
612
- },
613
- {
614
- order: [
615
- "pre-commit",
616
- "prepare-commit-msg",
617
- "commit-msg",
618
- "post-commit",
619
- "pre-rebase",
620
- "post-rewrite",
621
- "post-checkout",
622
- "post-merge",
623
- "pre-push",
624
- "pre-auto-gc"
625
- ],
626
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
627
- }
628
- ]
629
- }
630
- },
631
- {
632
- files: tsConfigGlob,
633
- name: "favorodera/jsonc/sort/tsconfig-json",
634
- rules: { "jsonc/sort-keys": [
635
- "error",
636
- {
637
- order: [
638
- "extends",
639
- "compilerOptions",
640
- "references",
641
- "files",
642
- "include",
643
- "exclude"
644
- ],
645
- pathPattern: "^$"
646
- },
647
- {
648
- order: [
649
- "incremental",
650
- "composite",
651
- "tsBuildInfoFile",
652
- "disableSourceOfProjectReferenceRedirect",
653
- "disableSolutionSearching",
654
- "disableReferencedProjectLoad",
655
- "target",
656
- "jsx",
657
- "jsxFactory",
658
- "jsxFragmentFactory",
659
- "jsxImportSource",
660
- "lib",
661
- "moduleDetection",
662
- "noLib",
663
- "reactNamespace",
664
- "useDefineForClassFields",
665
- "emitDecoratorMetadata",
666
- "experimentalDecorators",
667
- "libReplacement",
668
- "baseUrl",
669
- "rootDir",
670
- "rootDirs",
671
- "customConditions",
672
- "module",
673
- "moduleResolution",
674
- "moduleSuffixes",
675
- "noResolve",
676
- "paths",
677
- "resolveJsonModule",
678
- "resolvePackageJsonExports",
679
- "resolvePackageJsonImports",
680
- "typeRoots",
681
- "types",
682
- "allowArbitraryExtensions",
683
- "allowImportingTsExtensions",
684
- "allowUmdGlobalAccess",
685
- "allowJs",
686
- "checkJs",
687
- "maxNodeModuleJsDepth",
688
- "strict",
689
- "strictBindCallApply",
690
- "strictFunctionTypes",
691
- "strictNullChecks",
692
- "strictPropertyInitialization",
693
- "allowUnreachableCode",
694
- "allowUnusedLabels",
695
- "alwaysStrict",
696
- "exactOptionalPropertyTypes",
697
- "noFallthroughCasesInSwitch",
698
- "noImplicitAny",
699
- "noImplicitOverride",
700
- "noImplicitReturns",
701
- "noImplicitThis",
702
- "noPropertyAccessFromIndexSignature",
703
- "noUncheckedIndexedAccess",
704
- "noUnusedLocals",
705
- "noUnusedParameters",
706
- "useUnknownInCatchVariables",
707
- "declaration",
708
- "declarationDir",
709
- "declarationMap",
710
- "downlevelIteration",
711
- "emitBOM",
712
- "emitDeclarationOnly",
713
- "importHelpers",
714
- "importsNotUsedAsValues",
715
- "inlineSourceMap",
716
- "inlineSources",
717
- "mapRoot",
718
- "newLine",
719
- "noEmit",
720
- "noEmitHelpers",
721
- "noEmitOnError",
722
- "outDir",
723
- "outFile",
724
- "preserveConstEnums",
725
- "preserveValueImports",
726
- "removeComments",
727
- "sourceMap",
728
- "sourceRoot",
729
- "stripInternal",
730
- "allowSyntheticDefaultImports",
731
- "esModuleInterop",
732
- "forceConsistentCasingInFileNames",
733
- "isolatedDeclarations",
734
- "isolatedModules",
735
- "preserveSymlinks",
736
- "verbatimModuleSyntax",
737
- "erasableSyntaxOnly",
738
- "skipDefaultLibCheck",
739
- "skipLibCheck"
740
- ],
741
- pathPattern: "^compilerOptions$"
742
- }
743
- ] }
744
- }
745
- ];
746
- }
747
- //#endregion
748
- //#region src/configs/markdown.ts
749
- const markdownDefaults = {
750
- files: [mdGlob],
751
- gfm: true
752
- };
753
- /**
754
- * Constructs the flat config items for Markdown linting, extracting and linting
755
- * embedded code blocks within the document according to specified rules.
756
- * @param options Markdown configuration options.
757
- * @returns Promise resolving to Markdown ESLint config items.
758
- */
759
- async function markdown(options) {
760
- const resolved = (0, defu.defu)(options, markdownDefaults);
761
- const markdownPlugin = await importModule(import("@eslint/markdown"));
762
- const baseRules = extractRules(markdownPlugin.configs.recommended);
763
- return [
764
- {
765
- name: "favorodera/markdown/setup",
766
- plugins: { md: markdownPlugin }
767
- },
768
- {
769
- files: resolved.files,
770
- ignores: [mdInMdGlob],
771
- language: resolved.gfm ? "md/gfm" : "md/commonmark",
772
- name: "favorodera/markdown/rules",
773
- processor: (0, eslint_merge_processors.mergeProcessors)([markdownPlugin.processors?.markdown, eslint_merge_processors.processorPassThrough]),
774
- rules: {
775
- ...(0, eslint_flat_config_utils.renamePluginsInRules)(baseRules, { markdown: "md" }),
776
- "md/fenced-code-language": "off",
777
- "md/no-missing-label-refs": "off",
778
- ...resolved.overrides
779
- }
780
- },
781
- {
782
- files: [codeInMdGlob],
783
- languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
784
- name: "favorodera/markdown/code-in-md/disables",
785
- rules: {
786
- "no-alert": "off",
787
- "no-console": "off",
788
- "no-labels": "off",
789
- "no-lone-blocks": "off",
790
- "no-restricted-syntax": "off",
791
- "no-undef": "off",
792
- "no-unused-expressions": "off",
793
- "no-unused-labels": "off",
794
- "no-unused-vars": "off",
795
- "node/prefer-global/process": "off",
796
- "style/comma-dangle": "off",
797
- "style/eol-last": "off",
798
- "style/padding-line-between-statements": "off",
799
- "ts/consistent-type-imports": "off",
800
- "ts/explicit-function-return-type": "off",
801
- "ts/no-namespace": "off",
802
- "ts/no-redeclare": "off",
803
- "ts/no-require-imports": "off",
804
- "ts/no-unused-expressions": "off",
805
- "ts/no-unused-vars": "off",
806
- "ts/no-use-before-define": "off",
807
- "unicode-bom": "off",
808
- "unused-imports/no-unused-imports": "off",
809
- "unused-imports/no-unused-vars": "off"
810
- }
811
- }
812
- ];
813
- }
814
- //#endregion
815
- //#region src/configs/node.ts
816
- const nodeDefaults = { files: [
817
- jsGlob,
818
- tsGlob,
819
- vueGlob
820
- ] };
821
- /**
822
- * Constructs the flat config items for Node.js linting, providing rules
823
- * to enforce best practices for Node.js environments.
824
- * @param options Node configuration options.
825
- * @returns Promise resolving to Node ESLint config items.
826
- */
827
- async function node(options) {
828
- const resolved = (0, defu.defu)(options, nodeDefaults);
829
- const nodePlugin = await importModule(import("eslint-plugin-n"));
830
- const baseRules = nodePlugin.configs?.["flat/recommended"]?.rules || {};
831
- return [{
832
- name: "favorodera/node/setup",
833
- plugins: { node: nodePlugin }
834
- }, {
835
- files: resolved.files,
836
- name: "favorodera/node/rules",
837
- rules: {
838
- ...(0, eslint_flat_config_utils.renamePluginsInRules)(baseRules, { n: "node" }),
839
- "node/handle-callback-err": ["error", "^(err|error)$"],
840
- "node/no-deprecated-api": "error",
841
- "node/no-exports-assign": "error",
842
- "node/no-missing-import": "off",
843
- "node/no-new-require": "error",
844
- "node/no-path-concat": "error",
845
- "node/no-unpublished-import": "off",
846
- "node/prefer-global/buffer": ["error", "never"],
847
- "node/prefer-global/process": ["error", "never"],
848
- "node/process-exit-as-throw": "error",
849
- ...resolved.overrides
850
- }
851
- }];
852
- }
853
- //#endregion
854
- //#region src/configs/perfectionist.ts
855
- const perfectionistDefaults = { files: [
856
- jsGlob,
857
- tsGlob,
858
- vueGlob
859
- ] };
860
- /**
861
- * Constructs the flat config items for Perfectionist linting, providing rules
862
- * to naturally sort objects, imports, classes, and other elements in your code.
863
- * @param options Perfectionist configuration options.
864
- * @returns Promise resolving to Perfectionist ESLint config items.
865
- */
866
- async function perfectionist(options) {
867
- const resolved = (0, defu.defu)(options, perfectionistDefaults);
868
- const perfectionistPlugin = await importModule(import("eslint-plugin-perfectionist"));
869
- const baseRules = perfectionistPlugin.configs["recommended-natural"]?.rules || {};
870
- return [{
871
- name: "favorodera/perfectionist/setup",
872
- plugins: { perfectionist: perfectionistPlugin }
873
- }, {
874
- files: resolved.files,
875
- name: "favorodera/perfectionist/rules",
876
- rules: {
877
- ...baseRules,
878
- "perfectionist/sort-exports": ["error", {
879
- order: "asc",
880
- type: "natural"
881
- }],
882
- "perfectionist/sort-imports": ["error", {
883
- groups: [
884
- "type-import",
885
- [
886
- "type-parent",
887
- "type-sibling",
888
- "type-index",
889
- "type-internal"
890
- ],
891
- "value-builtin",
892
- "value-external",
893
- "value-internal",
894
- [
895
- "value-parent",
896
- "value-sibling",
897
- "value-index"
898
- ],
899
- "side-effect",
900
- "ts-equals-import",
901
- "unknown"
902
- ],
903
- newlinesBetween: "ignore",
904
- newlinesInside: "ignore",
905
- order: "asc",
906
- type: "natural"
907
- }],
908
- "perfectionist/sort-named-exports": ["error", {
909
- order: "asc",
910
- type: "natural"
911
- }],
912
- "perfectionist/sort-named-imports": ["error", {
913
- order: "asc",
914
- type: "natural"
915
- }],
916
- ...resolved.overrides
917
- }
918
- }];
919
- }
920
- //#endregion
921
- //#region src/configs/pnpm.ts
922
- /**
923
- * Constructs the flat config items for pnpm linting.
924
- * @returns Promise resolving to pnpm ESLint config items.
925
- */
926
- async function pnpm() {
927
- const [pnpmPlugin, yamlParser] = await Promise.all([importModule(import("eslint-plugin-pnpm")), importModule(import("yaml-eslint-parser"))]);
928
- return [
929
- {
930
- name: "favorodera/pnpm/setup",
931
- plugins: { pnpm: pnpmPlugin }
932
- },
933
- {
934
- files: [packageJsonGlob],
935
- language: "jsonc/x",
936
- name: "favorodera/pnpm/package-json",
937
- rules: {
938
- "pnpm/json-enforce-catalog": ["error", {
939
- autofix: true,
940
- ignores: ["@types/vscode"]
941
- }],
942
- "pnpm/json-prefer-workspace-settings": ["error", { autofix: true }],
943
- "pnpm/json-valid-catalog": ["error", { autofix: true }]
944
- }
945
- },
946
- {
947
- files: [pnpmWorkspaceGlob],
948
- languageOptions: { parser: yamlParser },
949
- name: "favorodera/pnpm/pnpm-workspace-yaml",
950
- rules: {
951
- "pnpm/yaml-enforce-settings": ["error", { settings: {
952
- shellEmulator: true,
953
- trustPolicy: "no-downgrade"
954
- } }],
955
- "pnpm/yaml-no-duplicate-catalog-item": ["error", { checkDuplicates: "exact-version" }],
956
- "pnpm/yaml-no-unused-catalog-item": "error"
957
- }
958
- }
959
- ];
960
- }
961
- //#endregion
962
- //#region src/configs/stylistic.ts
963
- const stylisticDefaults = {
964
- files: [
965
- jsGlob,
966
- tsGlob,
967
- vueGlob
968
- ],
969
- settings: {
970
- experimental: false,
971
- indent: 2,
972
- jsx: false,
973
- quotes: "single",
974
- semi: false
975
- }
976
- };
977
- /**
978
- * Constructs the flat config items for Stylistic linting, applying customized
979
- * formatting settings such as quotes, indentation, and spacing.
980
- * @param options Stylistic configuration options.
981
- * @returns Promise resolving to stylistic ESLint config items.
982
- */
983
- async function stylistic(options) {
984
- const resolved = (0, defu.defu)(options, stylisticDefaults);
985
- const stylePlugin = await importModule(import("@stylistic/eslint-plugin"));
986
- const baseRules = stylePlugin.configs.customize({
987
- pluginName: "style",
988
- ...resolved.settings
989
- })?.rules || {};
990
- return [{
991
- name: "favorodera/stylistic/setup",
992
- plugins: { style: stylePlugin }
993
- }, {
994
- files: resolved.files,
995
- name: "favorodera/stylistic/rules",
996
- rules: {
997
- ...baseRules,
998
- "style/brace-style": "off",
999
- "style/generator-star-spacing": ["error", {
1000
- after: true,
1001
- before: false
1002
- }],
1003
- "style/no-multiple-empty-lines": ["error", {
1004
- max: 2,
1005
- maxBOF: 0,
1006
- maxEOF: 2
1007
- }],
1008
- "style/no-trailing-spaces": ["error", { skipBlankLines: true }],
1009
- "style/padded-blocks": "off",
1010
- "style/quotes": [
1011
- "error",
1012
- "single",
1013
- { avoidEscape: true }
1014
- ],
1015
- "style/yield-star-spacing": ["error", {
1016
- after: true,
1017
- before: false
1018
- }],
1019
- ...resolved.overrides
1020
- }
1021
- }];
1022
- }
1023
- //#endregion
1024
- //#region src/configs/tailwind.ts
1025
- const tailwindDefaults = {
1026
- files: [
1027
- jsGlob,
1028
- tsGlob,
1029
- vueGlob
1030
- ],
1031
- settings: { detectComponentClasses: true }
1032
- };
1033
- /**
1034
- * Constructs the flat config items for Tailwind CSS linting, providing custom settings
1035
- * to parse and lint utility classes, and enforcing consistent ordering.
1036
- * @param options Tailwind configuration options.
1037
- * @returns Promise resolving to Tailwind ESLint config items.
1038
- */
1039
- async function tailwind(options) {
1040
- const resolved = (0, defu.defu)(options, tailwindDefaults);
1041
- const tailwindPlugin = await importModule(import("eslint-plugin-better-tailwindcss"));
1042
- const baseRules = {
1043
- ...tailwindPlugin.configs["recommended-error"].rules,
1044
- ...tailwindPlugin.configs["stylistic-error"].rules
1045
- };
1046
- return [{
1047
- name: "favorodera/tailwind/setup",
1048
- plugins: { tailwind: tailwindPlugin },
1049
- settings: { tailwindcss: resolved.settings }
1050
- }, {
1051
- files: resolved.files,
1052
- name: "favorodera/tailwind/rules",
1053
- rules: {
1054
- ...(0, eslint_flat_config_utils.renamePluginsInRules)(baseRules, { "better-tailwindcss": "tailwind" }),
1055
- "tailwind/enforce-consistent-line-wrapping": ["error", { group: "emptyLine" }],
1056
- ...resolved.overrides
1057
- }
1058
- }];
1059
- }
1060
- //#endregion
1061
- //#region src/configs/test.ts
1062
- const testDefaults = { files: testsGlob };
1063
- /**
1064
- * Constructs the flat config items for test linting, extending
1065
- * the recommended Vitest rule sets.
1066
- * @param options Test configuration options.
1067
- * @returns Promise resolving to test ESLint config items.
1068
- */
1069
- async function test(options) {
1070
- const resolved = (0, defu.defu)(options, testDefaults);
1071
- const testPlugin = await importModule(import("@vitest/eslint-plugin"));
1072
- const baseRules = extractRules(testPlugin.configs.recommended);
1073
- return [
1074
- {
1075
- name: "favorodera/test/setup",
1076
- plugins: { test: testPlugin }
1077
- },
1078
- {
1079
- files: resolved.files,
1080
- name: "favorodera/test/rules",
1081
- rules: {
1082
- ...(0, eslint_flat_config_utils.renamePluginsInRules)(baseRules, { vitest: "test" }),
1083
- "test/consistent-test-it": ["error", {
1084
- fn: "it",
1085
- withinDescribe: "it"
1086
- }],
1087
- "test/no-identical-title": "error",
1088
- "test/no-import-node-test": "error",
1089
- "test/prefer-hooks-in-order": "error",
1090
- "test/prefer-lowercase-title": "error",
1091
- ...resolved.overrides
1092
- }
1093
- },
1094
- {
1095
- files: resolved.files,
1096
- name: "favorodera/test/disables",
1097
- rules: {
1098
- "no-unused-expressions": "off",
1099
- "node/prefer-global/process": "off"
1100
- }
1101
- }
1102
- ];
1103
- }
1104
- //#endregion
1105
- //#region src/configs/typescript.ts
1106
- const typescriptDefaults = { files: [tsGlob] };
1107
- /**
1108
- * Constructs the flat config items for TypeScript linting, initializing the parser
1109
- * and extending the recommended and strict type-aware rule sets.
1110
- * @param options TypeScript configuration options.
1111
- * @returns Promise resolving to TypeScript ESLint config items.
1112
- */
1113
- async function typescript(options) {
1114
- const resolved = (0, defu.defu)(options, typescriptDefaults);
1115
- const tsEsLint = await importModule(import("typescript-eslint"));
1116
- const baseRules = extractRules(tsEsLint.configs.recommended, tsEsLint.configs.strict);
1117
- return [{
1118
- name: "favorodera/typescript/setup",
1119
- plugins: { ts: tsEsLint.plugin }
1120
- }, {
1121
- files: resolved.files,
1122
- languageOptions: {
1123
- parser: tsEsLint.parser,
1124
- parserOptions: { sourceType: "module" }
1125
- },
1126
- name: "favorodera/typescript/rules",
1127
- rules: {
1128
- ...(0, eslint_flat_config_utils.renamePluginsInRules)(baseRules, { "@typescript-eslint": "ts" }),
1129
- "ts/array-type": ["error", {
1130
- default: "generic",
1131
- readonly: "generic"
1132
- }],
1133
- "ts/consistent-type-imports": ["error", { prefer: "type-imports" }],
1134
- "ts/no-empty-object-type": ["error", { allowInterfaces: "with-single-extends" }],
1135
- ...resolved.overrides
1136
- }
1137
- }];
1138
- }
1139
- //#endregion
1140
- //#region src/configs/unicorn.ts
1141
- const unicornDefaults = { files: [
1142
- jsGlob,
1143
- tsGlob,
1144
- vueGlob
1145
- ] };
1146
- /**
1147
- * Constructs the flat config items for Unicorn linting, providing a collection of
1148
- * awesome ESLint rules to improve code quality and enforce best practices.
1149
- * @param options Unicorn configuration options.
1150
- * @returns Promise resolving to Unicorn ESLint config items.
1151
- */
1152
- async function unicorn(options) {
1153
- const resolved = (0, defu.defu)(options, unicornDefaults);
1154
- const unicornPlugin = await importModule(import("eslint-plugin-unicorn"));
1155
- const baseRules = unicornPlugin.configs.unopinionated?.rules || {};
1156
- return [{
1157
- name: "favorodera/unicorn/setup",
1158
- plugins: { unicorn: unicornPlugin }
1159
- }, {
1160
- files: resolved.files,
1161
- languageOptions: { globals: globals.default.builtin },
1162
- name: "favorodera/unicorn/rules",
1163
- rules: {
1164
- ...baseRules,
1165
- "unicorn/consistent-empty-array-spread": "error",
1166
- "unicorn/error-message": "error",
1167
- "unicorn/escape-case": "error",
1168
- "unicorn/new-for-builtins": "error",
1169
- "unicorn/no-instanceof-builtins": "error",
1170
- "unicorn/no-new-array": "error",
1171
- "unicorn/no-new-buffer": "error",
1172
- "unicorn/number-literal-case": "error",
1173
- "unicorn/prefer-dom-node-text-content": "error",
1174
- "unicorn/prefer-includes": "error",
1175
- "unicorn/prefer-node-protocol": "error",
1176
- "unicorn/prefer-number-properties": "error",
1177
- "unicorn/prefer-string-starts-ends-with": "error",
1178
- "unicorn/prefer-type-error": "error",
1179
- "unicorn/throw-new-error": "error",
1180
- ...resolved.overrides
1181
- }
1182
- }];
1183
- }
1184
- //#endregion
1185
- //#region src/configs/vue.ts
1186
- const sfcBlocksDefaults = { blocks: {
1187
- customBlocks: true,
1188
- styles: true,
1189
- template: false
1190
- } };
1191
- const vueDefaults = {
1192
- files: [vueGlob],
1193
- sfcBlocks: sfcBlocksDefaults
1194
- };
1195
- /**
1196
- * Constructs the flat config items for Vue linting, setting up the custom template parser,
1197
- * Vue block processors, and rules to enforce recommended component syntax.
1198
- * @param options Vue configuration options.
1199
- * @returns Promise resolving to Vue ESLint config items.
1200
- */
1201
- async function vue(options) {
1202
- const resolved = (0, defu.defu)(options, vueDefaults);
1203
- const sfcBlocks = resolveOptions(resolved.sfcBlocks, sfcBlocksDefaults);
1204
- const [vuePlugin, vueParser, tsEsLint] = await Promise.all([
1205
- importModule(import("eslint-plugin-vue")),
1206
- importModule(import("vue-eslint-parser")),
1207
- importModule(import("typescript-eslint"))
1208
- ]);
1209
- const baseRules = extractRules(vuePlugin.configs["flat/essential"], vuePlugin.configs["flat/strongly-recommended"], vuePlugin.configs["flat/recommended"]);
1210
- const processor = sfcBlocks === false ? vuePlugin.processors[".vue"] : (0, eslint_merge_processors.mergeProcessors)([vuePlugin.processors[".vue"], (0, eslint_processor_vue_blocks.default)(sfcBlocks)]);
1211
- return [{
1212
- languageOptions: { globals: {
1213
- computed: "readonly",
1214
- defineEmits: "readonly",
1215
- defineExpose: "readonly",
1216
- defineProps: "readonly",
1217
- onMounted: "readonly",
1218
- onUnmounted: "readonly",
1219
- reactive: "readonly",
1220
- ref: "readonly",
1221
- shallowReactive: "readonly",
1222
- shallowRef: "readonly",
1223
- toRef: "readonly",
1224
- toRefs: "readonly",
1225
- watch: "readonly",
1226
- watchEffect: "readonly"
1227
- } },
1228
- name: "favorodera/vue/setup",
1229
- plugins: { vue: vuePlugin }
1230
- }, {
1231
- files: resolved.files,
1232
- languageOptions: {
1233
- parser: vueParser,
1234
- parserOptions: {
1235
- extraFileExtensions: [".vue"],
1236
- parser: tsEsLint.parser,
1237
- sourceType: "module"
1238
- }
1239
- },
1240
- name: "favorodera/vue/rules",
1241
- processor,
1242
- rules: {
1243
- ...baseRules,
1244
- "vue/block-order": ["error", { order: [
1245
- "script",
1246
- "template",
1247
- "style"
1248
- ] }],
1249
- "vue/block-tag-newline": ["error", {
1250
- multiline: "ignore",
1251
- singleline: "ignore"
1252
- }],
1253
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
1254
- "vue/component-options-name-casing": ["error", "PascalCase"],
1255
- "vue/multi-word-component-names": "off",
1256
- "vue/multiline-html-element-content-newline": ["error", {
1257
- allowEmptyLines: true,
1258
- ignores: ["pre", "textarea"]
1259
- }],
1260
- ...resolved.overrides
1261
- }
1262
- }];
1263
- }
1264
- //#endregion
1265
- //#region src/configs/yaml.ts
1266
- const yamlDefaults = { files: [yamlGlob] };
1267
- /**
1268
- * Constructs the flat config items for YAML linting, setting up
1269
- * the custom parser and rule validations.
1270
- * @param options YAML configuration options.
1271
- * @returns Promise resolving to YAML ESLint config items.
1272
- */
1273
- async function yaml(options) {
1274
- const resolved = (0, defu.defu)(options, yamlDefaults);
1275
- const [yamlPlugin, yamlParser] = await Promise.all([importModule(import("eslint-plugin-yml")), importModule(import("yaml-eslint-parser"))]);
1276
- const baseRules = extractRules(yamlPlugin.configs.recommended);
1277
- return [
1278
- {
1279
- name: "favorodera/yaml/setup",
1280
- plugins: { yaml: yamlPlugin }
1281
- },
1282
- {
1283
- files: resolved.files,
1284
- languageOptions: { parser: yamlParser },
1285
- name: "favorodera/yaml/rules",
1286
- rules: {
1287
- ...(0, eslint_flat_config_utils.renamePluginsInRules)(baseRules, { yml: "yaml" }),
1288
- "style/spaced-comment": "off",
1289
- "yaml/block-mapping": "error",
1290
- "yaml/block-mapping-question-indicator-newline": "error",
1291
- "yaml/block-sequence": "error",
1292
- "yaml/block-sequence-hyphen-indicator-newline": "error",
1293
- "yaml/flow-mapping-curly-newline": "error",
1294
- "yaml/flow-mapping-curly-spacing": "error",
1295
- "yaml/flow-sequence-bracket-newline": "error",
1296
- "yaml/flow-sequence-bracket-spacing": "error",
1297
- "yaml/indent": ["error", 2],
1298
- "yaml/key-spacing": "error",
1299
- "yaml/no-empty-key": "error",
1300
- "yaml/no-empty-sequence-entry": "error",
1301
- "yaml/no-irregular-whitespace": "error",
1302
- "yaml/no-tab-indent": "error",
1303
- "yaml/plain-scalar": "error",
1304
- "yaml/quotes": ["error", {
1305
- avoidEscape: true,
1306
- prefer: "single"
1307
- }],
1308
- "yaml/spaced-comment": "error",
1309
- "yaml/vue-custom-block/no-parsing-error": "error",
1310
- ...resolved.overrides
1311
- }
1312
- },
1313
- {
1314
- files: [pnpmWorkspaceGlob],
1315
- languageOptions: { parser: yamlParser },
1316
- name: "favorodera/yaml/sort/pnpm-workspace-yaml",
1317
- rules: { "yaml/sort-keys": [
1318
- "error",
1319
- {
1320
- order: [
1321
- "cacheDir",
1322
- "catalogMode",
1323
- "cleanupUnusedCatalogs",
1324
- "dedupeDirectDeps",
1325
- "deployAllFiles",
1326
- "enablePrePostScripts",
1327
- "engineStrict",
1328
- "extendNodePath",
1329
- "hoist",
1330
- "hoistPattern",
1331
- "hoistWorkspacePackages",
1332
- "ignoreCompatibilityDb",
1333
- "ignoreDepScripts",
1334
- "ignoreScripts",
1335
- "ignoreWorkspaceRootCheck",
1336
- "managePackageManagerVersions",
1337
- "minimumReleaseAge",
1338
- "minimumReleaseAgeExclude",
1339
- "modulesDir",
1340
- "nodeLinker",
1341
- "nodeVersion",
1342
- "optimisticRepeatInstall",
1343
- "packageManagerStrict",
1344
- "packageManagerStrictVersion",
1345
- "preferSymlinkedExecutables",
1346
- "preferWorkspacePackages",
1347
- "publicHoistPattern",
1348
- "registrySupportsTimeField",
1349
- "requiredScripts",
1350
- "resolutionMode",
1351
- "savePrefix",
1352
- "scriptShell",
1353
- "shamefullyHoist",
1354
- "shellEmulator",
1355
- "stateDir",
1356
- "supportedArchitectures",
1357
- "symlink",
1358
- "tag",
1359
- "trustPolicy",
1360
- "trustPolicyExclude",
1361
- "updateNotifier",
1362
- "packages",
1363
- "overrides",
1364
- "patchedDependencies",
1365
- "catalog",
1366
- "catalogs",
1367
- "allowedDeprecatedVersions",
1368
- "allowNonAppliedPatches",
1369
- "configDependencies",
1370
- "ignoredBuiltDependencies",
1371
- "ignoredOptionalDependencies",
1372
- "neverBuiltDependencies",
1373
- "onlyBuiltDependencies",
1374
- "onlyBuiltDependenciesFile",
1375
- "packageExtensions",
1376
- "peerDependencyRules"
1377
- ],
1378
- pathPattern: "^$"
1379
- },
1380
- {
1381
- order: { type: "asc" },
1382
- pathPattern: ".*"
1383
- }
1384
- ] }
1385
- }
1386
- ];
1387
- }
1388
- //#endregion
1389
- //#region src/factory.ts
1390
- /**
1391
- * Factory to create a flat ESLint config.
1392
- * It builds an ESLint config by sequentially adding sub-configs based on the provided options.
1393
- * @param options Configuration options for enabling/disabling or configuring specific rule sets.
1394
- * @returns A flat config composer instance that can be exported directly or further modified.
1395
- */
1396
- function factory(options = {}) {
1397
- const configs = [ignores(options.ignores)];
1398
- const configFunctions = {
1399
- imports,
1400
- javascript,
1401
- jsdoc,
1402
- jsonc,
1403
- markdown,
1404
- node,
1405
- perfectionist,
1406
- pnpm,
1407
- stylistic,
1408
- tailwind,
1409
- test,
1410
- typescript,
1411
- unicorn,
1412
- vue,
1413
- yaml
1414
- };
1415
- for (const [key, configFunction] of Object.entries(configFunctions)) {
1416
- const configOption = options[key];
1417
- const resolved = resolveOptions(configOption ?? true, {});
1418
- if (resolved) configs.push(configFunction(resolved));
1419
- }
1420
- let composer = new eslint_flat_config_utils.FlatConfigComposer();
1421
- composer = composer.append(...configs).renamePlugins({
1422
- "@typescript-eslint": "ts",
1423
- "better-tailwindcss": "tailwind",
1424
- "import-lite": "import",
1425
- "markdown": "md",
1426
- "n": "node",
1427
- "vitest": "test",
1428
- "yml": "yaml"
1429
- });
1430
- return composer;
1431
- }
1432
- //#endregion
1433
- exports.extractRules = extractRules;
1434
- exports.factory = factory;
1435
- exports.importModule = importModule;