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