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