@favorodera/eslint-config 0.0.5 → 0.0.7
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/LICENSE +21 -0
- package/README.md +3 -2
- package/dist/index.cjs +474 -36
- package/dist/index.d.cts +962 -4
- package/dist/index.d.mts +962 -4
- package/dist/index.mjs +458 -37
- package/package.json +8 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Favour Emeka
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ The following configurations are bundled and enabled by default (they can be ind
|
|
|
32
32
|
- **Vue** — Single-file component support (`eslint-plugin-vue`, `vue-eslint-parser`)
|
|
33
33
|
- **Stylistic** — Formatting rules (`@stylistic/eslint-plugin`)
|
|
34
34
|
- **Tailwind CSS** — Utility class linting and sorting (`eslint-plugin-better-tailwindcss`)
|
|
35
|
+
- **Test** — Test and Vitest specific linting (`@vitest/eslint-plugin`)
|
|
35
36
|
- **Imports** — Auto-sorting and unused imports removal (`eslint-plugin-import-lite`, `eslint-plugin-unused-imports`)
|
|
36
37
|
- **Markdown** — Linting for markdown files and embedded code blocks (`@eslint/markdown`)
|
|
37
38
|
- **JSON/JSONC/JSON5** — Formatting and sorting for JSON files like `package.json` (`eslint-plugin-jsonc`)
|
|
@@ -79,9 +80,9 @@ bun add -D eslint @favorodera/eslint-config
|
|
|
79
80
|
|
|
80
81
|
### Configure
|
|
81
82
|
|
|
82
|
-
Create an `eslint.config.
|
|
83
|
+
Create an `eslint.config.ts` file in the root of your project. Since all configurations are enabled by default, you only need to pass options if you want to disable or customize something:
|
|
83
84
|
|
|
84
|
-
```
|
|
85
|
+
```ts
|
|
85
86
|
import { factory } from '@favorodera/eslint-config'
|
|
86
87
|
|
|
87
88
|
export default factory({
|
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,10 @@ const mdGlob = "**/*.md";
|
|
|
41
41
|
const mdInMdGlob = "**/*.md/*.md";
|
|
42
42
|
/** Glob pattern for matching code blocks embedded in Markdown files */
|
|
43
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}"];
|
|
44
48
|
/** Glob pattern for matching JSON files */
|
|
45
49
|
const jsonGlob = "**/*.json";
|
|
46
50
|
/** Glob pattern for matching JSON5 files */
|
|
@@ -49,11 +53,17 @@ const json5Glob = "**/*.json5";
|
|
|
49
53
|
const jsoncGlob = "**/*.jsonc";
|
|
50
54
|
/** Glob patterns for matching TypeScript configuration files */
|
|
51
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";
|
|
52
60
|
/** Glob pattern for matching package.json files */
|
|
53
61
|
const packageJsonGlob = "**/package.json";
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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 = [
|
|
57
67
|
"**/node_modules/**",
|
|
58
68
|
"**/dist/**",
|
|
59
69
|
"**/package-lock.json",
|
|
@@ -90,6 +100,9 @@ const defaultPatterns = [
|
|
|
90
100
|
"**/.agents",
|
|
91
101
|
"**/.*/skills"
|
|
92
102
|
];
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/configs/ignores.ts
|
|
105
|
+
const defaultPatterns = ignoresGlob;
|
|
93
106
|
/**
|
|
94
107
|
* Globs for ignoring files and directories from ESLint scanning.
|
|
95
108
|
* @param patterns Additional ignore patterns or a function to modify the defaults.
|
|
@@ -220,12 +233,182 @@ async function javascript(options) {
|
|
|
220
233
|
name: "favorodera/javascript/rules",
|
|
221
234
|
rules: {
|
|
222
235
|
...baseRules,
|
|
223
|
-
"accessor-pairs": ["error", {
|
|
224
|
-
enforceForClassMembers: true,
|
|
225
|
-
setWithoutGet: true
|
|
226
|
-
}],
|
|
227
236
|
"array-callback-return": "error",
|
|
228
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"],
|
|
229
412
|
...resolved.overrides
|
|
230
413
|
}
|
|
231
414
|
}];
|
|
@@ -255,7 +438,7 @@ async function jsdoc(options) {
|
|
|
255
438
|
plugins: { jsdoc: jsdocPlugin }
|
|
256
439
|
}, {
|
|
257
440
|
files: resolved.files,
|
|
258
|
-
name: "favorodera/
|
|
441
|
+
name: "favorodera/jsdoc/rules",
|
|
259
442
|
rules: {
|
|
260
443
|
...baseRules,
|
|
261
444
|
"jsdoc/check-access": "warn",
|
|
@@ -605,7 +788,7 @@ async function markdown(options) {
|
|
|
605
788
|
{
|
|
606
789
|
files: [codeInMdGlob],
|
|
607
790
|
languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
|
|
608
|
-
name: "favorodera/markdown/disables
|
|
791
|
+
name: "favorodera/markdown/code-in-md/disables",
|
|
609
792
|
rules: {
|
|
610
793
|
"no-alert": "off",
|
|
611
794
|
"no-console": "off",
|
|
@@ -742,6 +925,47 @@ async function perfectionist(options) {
|
|
|
742
925
|
}];
|
|
743
926
|
}
|
|
744
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
|
|
745
969
|
//#region src/configs/stylistic.ts
|
|
746
970
|
const stylisticDefaults = {
|
|
747
971
|
files: [
|
|
@@ -836,12 +1060,55 @@ async function tailwind(options) {
|
|
|
836
1060
|
rules: {
|
|
837
1061
|
...(0, eslint_flat_config_utils.renamePluginsInRules)(baseRules, { "better-tailwindcss": "tailwind" }),
|
|
838
1062
|
"tailwind/enforce-consistent-line-wrapping": ["error", { group: "emptyLine" }],
|
|
839
|
-
"tailwind/no-unregistered-classes": "off",
|
|
840
1063
|
...resolved.overrides
|
|
841
1064
|
}
|
|
842
1065
|
}];
|
|
843
1066
|
}
|
|
844
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
|
|
845
1112
|
//#region src/configs/typescript.ts
|
|
846
1113
|
const typescriptDefaults = { files: [tsGlob] };
|
|
847
1114
|
/**
|
|
@@ -892,7 +1159,7 @@ const unicornDefaults = { files: [
|
|
|
892
1159
|
async function unicorn(options) {
|
|
893
1160
|
const resolved = (0, defu.defu)(options, unicornDefaults);
|
|
894
1161
|
const unicornPlugin = await importModule(import("eslint-plugin-unicorn"));
|
|
895
|
-
const baseRules = unicornPlugin.configs
|
|
1162
|
+
const baseRules = unicornPlugin.configs.recommended?.rules || {};
|
|
896
1163
|
return [{
|
|
897
1164
|
name: "favorodera/unicorn/setup",
|
|
898
1165
|
plugins: { unicorn: unicornPlugin }
|
|
@@ -902,21 +1169,7 @@ async function unicorn(options) {
|
|
|
902
1169
|
name: "favorodera/unicorn/rules",
|
|
903
1170
|
rules: {
|
|
904
1171
|
...baseRules,
|
|
905
|
-
"unicorn/
|
|
906
|
-
"unicorn/error-message": "error",
|
|
907
|
-
"unicorn/escape-case": "error",
|
|
908
|
-
"unicorn/new-for-builtins": "error",
|
|
909
|
-
"unicorn/no-instanceof-builtins": "error",
|
|
910
|
-
"unicorn/no-new-array": "error",
|
|
911
|
-
"unicorn/no-new-buffer": "error",
|
|
912
|
-
"unicorn/number-literal-case": "error",
|
|
913
|
-
"unicorn/prefer-dom-node-text-content": "error",
|
|
914
|
-
"unicorn/prefer-includes": "error",
|
|
915
|
-
"unicorn/prefer-node-protocol": "error",
|
|
916
|
-
"unicorn/prefer-number-properties": "error",
|
|
917
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
918
|
-
"unicorn/prefer-type-error": "error",
|
|
919
|
-
"unicorn/throw-new-error": "error",
|
|
1172
|
+
"unicorn/filename-case": "off",
|
|
920
1173
|
...resolved.overrides
|
|
921
1174
|
}
|
|
922
1175
|
}];
|
|
@@ -946,7 +1199,7 @@ async function vue(options) {
|
|
|
946
1199
|
importModule(import("vue-eslint-parser")),
|
|
947
1200
|
importModule(import("typescript-eslint"))
|
|
948
1201
|
]);
|
|
949
|
-
const baseRules = extractRules(vuePlugin.configs["flat/
|
|
1202
|
+
const baseRules = extractRules(vuePlugin.configs["flat/recommended-error"]);
|
|
950
1203
|
const processor = sfcBlocks === false ? vuePlugin.processors[".vue"] : (0, eslint_merge_processors.mergeProcessors)([vuePlugin.processors[".vue"], (0, eslint_processor_vue_blocks.default)(sfcBlocks)]);
|
|
951
1204
|
return [{
|
|
952
1205
|
languageOptions: { globals: {
|
|
@@ -981,27 +1234,190 @@ async function vue(options) {
|
|
|
981
1234
|
processor,
|
|
982
1235
|
rules: {
|
|
983
1236
|
...baseRules,
|
|
1237
|
+
"vue/block-lang": ["error", { script: { lang: "ts" } }],
|
|
984
1238
|
"vue/block-order": ["error", { order: [
|
|
985
1239
|
"script",
|
|
986
1240
|
"template",
|
|
987
1241
|
"style"
|
|
988
1242
|
] }],
|
|
989
1243
|
"vue/block-tag-newline": ["error", {
|
|
990
|
-
multiline: "
|
|
991
|
-
singleline: "
|
|
1244
|
+
multiline: "always",
|
|
1245
|
+
singleline: "always"
|
|
992
1246
|
}],
|
|
993
|
-
"vue/
|
|
994
|
-
"vue/
|
|
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" }],
|
|
995
1261
|
"vue/multi-word-component-names": "off",
|
|
996
|
-
"vue/
|
|
997
|
-
|
|
998
|
-
|
|
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
|
|
999
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"],
|
|
1000
1309
|
...resolved.overrides
|
|
1001
1310
|
}
|
|
1002
1311
|
}];
|
|
1003
1312
|
}
|
|
1004
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
|
|
1005
1421
|
//#region src/factory.ts
|
|
1006
1422
|
/**
|
|
1007
1423
|
* Factory to create a flat ESLint config.
|
|
@@ -1019,11 +1435,14 @@ function factory(options = {}) {
|
|
|
1019
1435
|
markdown,
|
|
1020
1436
|
node,
|
|
1021
1437
|
perfectionist,
|
|
1438
|
+
pnpm,
|
|
1022
1439
|
stylistic,
|
|
1023
1440
|
tailwind,
|
|
1441
|
+
test,
|
|
1024
1442
|
typescript,
|
|
1025
1443
|
unicorn,
|
|
1026
|
-
vue
|
|
1444
|
+
vue,
|
|
1445
|
+
yaml
|
|
1027
1446
|
};
|
|
1028
1447
|
for (const [key, configFunction] of Object.entries(configFunctions)) {
|
|
1029
1448
|
const configOption = options[key];
|
|
@@ -1036,10 +1455,29 @@ function factory(options = {}) {
|
|
|
1036
1455
|
"better-tailwindcss": "tailwind",
|
|
1037
1456
|
"import-lite": "import",
|
|
1038
1457
|
"markdown": "md",
|
|
1039
|
-
"n": "node"
|
|
1458
|
+
"n": "node",
|
|
1459
|
+
"vitest": "test",
|
|
1460
|
+
"yml": "yaml"
|
|
1040
1461
|
});
|
|
1041
1462
|
return composer;
|
|
1042
1463
|
}
|
|
1043
1464
|
//#endregion
|
|
1465
|
+
exports.codeInMdGlob = codeInMdGlob;
|
|
1466
|
+
exports.extractRules = extractRules;
|
|
1044
1467
|
exports.factory = factory;
|
|
1468
|
+
exports.ignoresGlob = ignoresGlob;
|
|
1045
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;
|