@coderwyd/eslint-config 4.7.1 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +30 -34
- package/dist/index.d.ts +226 -143
- package/dist/index.js +40 -1
- package/package.json +28 -26
package/dist/index.js
CHANGED
|
@@ -615,6 +615,36 @@ function perfectionist() {
|
|
|
615
615
|
}];
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region src/configs/pnpm.ts
|
|
620
|
+
async function pnpm() {
|
|
621
|
+
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
622
|
+
interopDefault(import("eslint-plugin-pnpm")),
|
|
623
|
+
interopDefault(import("yaml-eslint-parser")),
|
|
624
|
+
interopDefault(import("jsonc-eslint-parser"))
|
|
625
|
+
]);
|
|
626
|
+
return [{
|
|
627
|
+
files: ["package.json", "**/package.json"],
|
|
628
|
+
languageOptions: { parser: jsoncParser },
|
|
629
|
+
name: "coderwyd/pnpm/package-json",
|
|
630
|
+
plugins: { pnpm: pluginPnpm },
|
|
631
|
+
rules: {
|
|
632
|
+
"pnpm/json-enforce-catalog": "error",
|
|
633
|
+
"pnpm/json-prefer-workspace-settings": "error",
|
|
634
|
+
"pnpm/json-valid-catalog": "error"
|
|
635
|
+
}
|
|
636
|
+
}, {
|
|
637
|
+
files: ["pnpm-workspace.yaml"],
|
|
638
|
+
languageOptions: { parser: yamlParser },
|
|
639
|
+
name: "coderwyd/pnpm/pnpm-workspace-yaml",
|
|
640
|
+
plugins: { pnpm: pluginPnpm },
|
|
641
|
+
rules: {
|
|
642
|
+
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
643
|
+
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
644
|
+
}
|
|
645
|
+
}];
|
|
646
|
+
}
|
|
647
|
+
|
|
618
648
|
//#endregion
|
|
619
649
|
//#region src/configs/prettier.ts
|
|
620
650
|
const { rules: eslintRules } = prettierRules;
|
|
@@ -1397,6 +1427,7 @@ function unicorn(options = {}) {
|
|
|
1397
1427
|
"unicorn/no-console-spaces": "error",
|
|
1398
1428
|
"unicorn/no-for-loop": "error",
|
|
1399
1429
|
"unicorn/no-hex-escape": "error",
|
|
1430
|
+
"unicorn/no-immediate-mutation": "error",
|
|
1400
1431
|
"unicorn/no-instanceof-builtins": "error",
|
|
1401
1432
|
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1402
1433
|
"unicorn/no-lonely-if": "error",
|
|
@@ -1409,6 +1440,8 @@ function unicorn(options = {}) {
|
|
|
1409
1440
|
"unicorn/no-unnecessary-array-splice-count": "error",
|
|
1410
1441
|
"unicorn/no-unnecessary-await": "error",
|
|
1411
1442
|
"unicorn/no-unnecessary-slice-end": "error",
|
|
1443
|
+
"unicorn/no-useless-collection-argument": "error",
|
|
1444
|
+
"unicorn/no-useless-error-capture-stack-trace": "error",
|
|
1412
1445
|
"unicorn/no-zero-fractions": "error",
|
|
1413
1446
|
"unicorn/prefer-add-event-listener": "error",
|
|
1414
1447
|
"unicorn/prefer-array-find": "error",
|
|
@@ -1416,8 +1449,10 @@ function unicorn(options = {}) {
|
|
|
1416
1449
|
"unicorn/prefer-array-index-of": "error",
|
|
1417
1450
|
"unicorn/prefer-array-some": "error",
|
|
1418
1451
|
"unicorn/prefer-at": "error",
|
|
1452
|
+
"unicorn/prefer-bigint-literals": "error",
|
|
1419
1453
|
"unicorn/prefer-blob-reading-methods": "error",
|
|
1420
1454
|
"unicorn/prefer-class-fields": "error",
|
|
1455
|
+
"unicorn/prefer-classlist-toggle": "error",
|
|
1421
1456
|
"unicorn/prefer-date-now": "error",
|
|
1422
1457
|
"unicorn/prefer-dom-node-append": "error",
|
|
1423
1458
|
"unicorn/prefer-dom-node-dataset": "error",
|
|
@@ -1436,12 +1471,15 @@ function unicorn(options = {}) {
|
|
|
1436
1471
|
"unicorn/prefer-prototype-methods": "error",
|
|
1437
1472
|
"unicorn/prefer-query-selector": "error",
|
|
1438
1473
|
"unicorn/prefer-reflect-apply": "error",
|
|
1474
|
+
"unicorn/prefer-response-static-json": "error",
|
|
1439
1475
|
"unicorn/prefer-single-call": "error",
|
|
1440
1476
|
"unicorn/prefer-string-replace-all": "error",
|
|
1441
1477
|
"unicorn/prefer-string-slice": "error",
|
|
1442
1478
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1443
1479
|
"unicorn/prefer-string-trim-start-end": "error",
|
|
1444
1480
|
"unicorn/prefer-type-error": "error",
|
|
1481
|
+
"unicorn/require-module-attributes": "error",
|
|
1482
|
+
"unicorn/require-module-specifiers": "error",
|
|
1445
1483
|
"unicorn/throw-new-error": "error",
|
|
1446
1484
|
...overrides
|
|
1447
1485
|
}
|
|
@@ -1687,7 +1725,7 @@ const defaultPluginRenaming = {
|
|
|
1687
1725
|
* The merged ESLint configurations.
|
|
1688
1726
|
*/
|
|
1689
1727
|
async function defineConfig(options = {}, ...userConfigs) {
|
|
1690
|
-
const { autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, react: enableReact = false, regexp: enableRegexp = true, svelte: enableSvelte = false, tailwindcss: enableTailwindCSS = false, typescript: enableTypeScript = isUsingTypeScript, unocss: enableUnoCSS = false, vue: enableVue = isUsingVue } = options;
|
|
1728
|
+
const { autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, pnpm: enableCatalogs = false, react: enableReact = false, regexp: enableRegexp = true, svelte: enableSvelte = false, tailwindcss: enableTailwindCSS = false, typescript: enableTypeScript = isUsingTypeScript, unocss: enableUnoCSS = false, vue: enableVue = isUsingVue } = options;
|
|
1691
1729
|
let isInEditor$1 = options.isInEditor;
|
|
1692
1730
|
if (isInEditor$1 == null) {
|
|
1693
1731
|
isInEditor$1 = isInEditorEnv();
|
|
@@ -1741,6 +1779,7 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
1741
1779
|
overrides: getOverrides(options, "tailwindcss")
|
|
1742
1780
|
}));
|
|
1743
1781
|
if (options.jsonc ?? true) configs$1.push(jsonc({ overrides: getOverrides(options, "jsonc") }), sortPackageJson(), sortTsconfig());
|
|
1782
|
+
if (enableCatalogs) configs$1.push(pnpm());
|
|
1744
1783
|
if (options.yaml ?? true) configs$1.push(yaml({ overrides: getOverrides(options, "yaml") }));
|
|
1745
1784
|
configs$1.push(specials(), prettier());
|
|
1746
1785
|
if ("files" in options) throw new Error("[@coderwyd/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderwyd/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.8.0",
|
|
5
5
|
"description": "Donny's ESLint config",
|
|
6
6
|
"author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://github.com/coderwyd/eslint-config",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/coderwyd/eslint-config.git"
|
|
12
|
+
},
|
|
9
13
|
"keywords": [
|
|
10
14
|
"eslint",
|
|
11
15
|
"eslint-config",
|
|
@@ -33,7 +37,7 @@
|
|
|
33
37
|
"node": ">=18.18.0"
|
|
34
38
|
},
|
|
35
39
|
"peerDependencies": {
|
|
36
|
-
"@eslint-react/eslint-plugin": "^1.5.8",
|
|
40
|
+
"@eslint-react/eslint-plugin": "^1.5.8 || ^2.0.0",
|
|
37
41
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
38
42
|
"eslint": "^9.5.0",
|
|
39
43
|
"eslint-plugin-react-hooks": "^4.6.0 || ^5.0.0 || ^7.0.0",
|
|
@@ -71,24 +75,26 @@
|
|
|
71
75
|
"dependencies": {
|
|
72
76
|
"@antfu/install-pkg": "^1.1.0",
|
|
73
77
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "^8.46.
|
|
75
|
-
"@typescript-eslint/parser": "^8.46.
|
|
76
|
-
"@vitest/eslint-plugin": "^1.3.
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
79
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
80
|
+
"@vitest/eslint-plugin": "^1.3.26",
|
|
81
|
+
"cac": "^6.7.14",
|
|
77
82
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
78
83
|
"eslint-config-prettier": "^10.1.8",
|
|
79
84
|
"eslint-plugin-antfu": "^3.1.1",
|
|
80
85
|
"eslint-plugin-command": "^3.3.1",
|
|
81
86
|
"eslint-plugin-de-morgan": "^2.0.0",
|
|
82
87
|
"eslint-plugin-import-lite": "^0.3.0",
|
|
83
|
-
"eslint-plugin-jsdoc": "61.1.
|
|
88
|
+
"eslint-plugin-jsdoc": "61.1.8",
|
|
84
89
|
"eslint-plugin-jsonc": "^2.21.0",
|
|
85
90
|
"eslint-plugin-n": "^17.23.1",
|
|
86
91
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
87
92
|
"eslint-plugin-perfectionist": "^4.15.1",
|
|
93
|
+
"eslint-plugin-pnpm": "^1.3.0",
|
|
88
94
|
"eslint-plugin-regexp": "^2.10.0",
|
|
89
|
-
"eslint-plugin-unicorn": "^
|
|
90
|
-
"eslint-plugin-unused-imports": "^4.
|
|
91
|
-
"eslint-plugin-vue": "^10.5.
|
|
95
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
96
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
97
|
+
"eslint-plugin-vue": "^10.5.1",
|
|
92
98
|
"eslint-plugin-yml": "^1.19.0",
|
|
93
99
|
"globals": "^16.4.0",
|
|
94
100
|
"jsonc-eslint-parser": "^2.4.1",
|
|
@@ -96,33 +102,29 @@
|
|
|
96
102
|
"parse-gitignore": "^2.0.0",
|
|
97
103
|
"prompts": "^2.4.2",
|
|
98
104
|
"vue-eslint-parser": "^10.2.0",
|
|
99
|
-
"yaml-eslint-parser": "^1.3.0"
|
|
100
|
-
"yargs": "^18.0.0"
|
|
105
|
+
"yaml-eslint-parser": "^1.3.0"
|
|
101
106
|
},
|
|
102
107
|
"devDependencies": {
|
|
103
|
-
"@
|
|
104
|
-
"@eslint-react/eslint-plugin": "^2.2.2",
|
|
108
|
+
"@eslint-react/eslint-plugin": "^2.2.4",
|
|
105
109
|
"@eslint/config-inspector": "^1.3.0",
|
|
106
110
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
107
|
-
"@types/node": "^24.
|
|
111
|
+
"@types/node": "^24.9.2",
|
|
108
112
|
"@types/prompts": "^2.4.9",
|
|
109
|
-
"@
|
|
110
|
-
"@unocss/eslint-plugin": "^66.5.3",
|
|
113
|
+
"@unocss/eslint-plugin": "^66.5.4",
|
|
111
114
|
"bumpp": "^10.3.1",
|
|
112
|
-
"eslint": "^9.
|
|
113
|
-
"eslint-plugin-react-hooks": "7.0.
|
|
114
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
115
|
-
"eslint-plugin-svelte": "^3.12.
|
|
115
|
+
"eslint": "^9.38.0",
|
|
116
|
+
"eslint-plugin-react-hooks": "7.0.1",
|
|
117
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
118
|
+
"eslint-plugin-svelte": "^3.12.5",
|
|
116
119
|
"eslint-plugin-tailwindcss": "^3.18.2",
|
|
117
120
|
"eslint-typegen": "^2.3.0",
|
|
118
121
|
"jiti": "^2.6.1",
|
|
119
122
|
"nano-staged": "^0.8.0",
|
|
120
123
|
"prettier": "^3.6.2",
|
|
121
|
-
"publint": "^0.3.
|
|
124
|
+
"publint": "^0.3.15",
|
|
122
125
|
"simple-git-hooks": "^2.13.1",
|
|
123
|
-
"svelte": "^
|
|
124
|
-
"
|
|
125
|
-
"tsdown": "^0.15.7",
|
|
126
|
+
"svelte-eslint-parser": "^1.4.0",
|
|
127
|
+
"tsdown": "^0.15.12",
|
|
126
128
|
"typescript": "^5.9.3",
|
|
127
129
|
"unplugin-unused": "^0.5.4"
|
|
128
130
|
},
|
|
@@ -133,13 +135,13 @@
|
|
|
133
135
|
"*": "eslint --fix"
|
|
134
136
|
},
|
|
135
137
|
"scripts": {
|
|
136
|
-
"build": "
|
|
138
|
+
"build": "pnpm build:typegen && tsdown",
|
|
137
139
|
"dev": "pnpx @eslint/config-inspector",
|
|
138
140
|
"lint": "eslint .",
|
|
139
141
|
"lint:fix": "eslint . --fix",
|
|
140
142
|
"build:inspector": "pnpm build && pnpx @eslint/config-inspector build",
|
|
141
143
|
"build:typegen": "jiti scripts/typegen.ts",
|
|
142
|
-
"release": "bumpp
|
|
144
|
+
"release": "bumpp",
|
|
143
145
|
"typecheck": "tsc --noEmit"
|
|
144
146
|
}
|
|
145
147
|
}
|