@coderwyd/eslint-config 4.6.3 → 4.7.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.d.ts +1 -1
- package/dist/cli.js +21 -19
- package/dist/index.d.ts +388 -286
- package/dist/index.js +11 -15
- package/package.json +28 -27
package/dist/index.js
CHANGED
|
@@ -123,8 +123,7 @@ const isCwdInScope = isPackageExists("@coderwyd/eslint-config");
|
|
|
123
123
|
* Combine array and non-array configs into a single array.
|
|
124
124
|
*/
|
|
125
125
|
async function combine(...configs$1) {
|
|
126
|
-
|
|
127
|
-
return resolved.flat();
|
|
126
|
+
return (await Promise.all(configs$1)).flat();
|
|
128
127
|
}
|
|
129
128
|
/**
|
|
130
129
|
* Rename plugin prefixes in a rule object.
|
|
@@ -702,6 +701,9 @@ async function react(options = {}) {
|
|
|
702
701
|
},
|
|
703
702
|
name: "coderwyd/react/rules",
|
|
704
703
|
rules: {
|
|
704
|
+
"react/jsx-no-comment-textnodes": "warn",
|
|
705
|
+
"react/jsx-no-duplicate-props": "warn",
|
|
706
|
+
"react/jsx-uses-vars": "warn",
|
|
705
707
|
"react/no-access-state-in-setstate": "error",
|
|
706
708
|
"react/no-array-index-key": "warn",
|
|
707
709
|
"react/no-children-count": "warn",
|
|
@@ -710,7 +712,6 @@ async function react(options = {}) {
|
|
|
710
712
|
"react/no-children-only": "warn",
|
|
711
713
|
"react/no-children-to-array": "warn",
|
|
712
714
|
"react/no-clone-element": "warn",
|
|
713
|
-
"react/no-comment-textnodes": "warn",
|
|
714
715
|
"react/no-component-will-mount": "error",
|
|
715
716
|
"react/no-component-will-receive-props": "error",
|
|
716
717
|
"react/no-component-will-update": "error",
|
|
@@ -718,7 +719,6 @@ async function react(options = {}) {
|
|
|
718
719
|
"react/no-create-ref": "error",
|
|
719
720
|
"react/no-default-props": "error",
|
|
720
721
|
"react/no-direct-mutation-state": "error",
|
|
721
|
-
"react/no-duplicate-jsx-props": "warn",
|
|
722
722
|
"react/no-duplicate-key": "warn",
|
|
723
723
|
"react/no-forward-ref": "warn",
|
|
724
724
|
"react/no-implicit-key": "warn",
|
|
@@ -730,6 +730,7 @@ async function react(options = {}) {
|
|
|
730
730
|
"react/no-set-state-in-component-did-update": "warn",
|
|
731
731
|
"react/no-set-state-in-component-will-update": "warn",
|
|
732
732
|
"react/no-string-refs": "error",
|
|
733
|
+
"react/no-unnecessary-use-prefix": "warn",
|
|
733
734
|
"react/no-unsafe-component-will-mount": "warn",
|
|
734
735
|
"react/no-unsafe-component-will-receive-props": "warn",
|
|
735
736
|
"react/no-unsafe-component-will-update": "warn",
|
|
@@ -739,7 +740,7 @@ async function react(options = {}) {
|
|
|
739
740
|
"react/no-unused-state": "warn",
|
|
740
741
|
"react/no-use-context": "warn",
|
|
741
742
|
"react/no-useless-forward-ref": "warn",
|
|
742
|
-
"react/use-
|
|
743
|
+
"react/prefer-use-state-lazy-initialization": "warn",
|
|
743
744
|
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
744
745
|
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
745
746
|
"react-dom/no-find-dom-node": "error",
|
|
@@ -757,9 +758,7 @@ async function react(options = {}) {
|
|
|
757
758
|
"react-dom/no-void-elements-with-children": "error",
|
|
758
759
|
"react-hooks/exhaustive-deps": "warn",
|
|
759
760
|
"react-hooks/rules-of-hooks": "error",
|
|
760
|
-
"react-hooks/react-compiler": "warn",
|
|
761
761
|
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
762
|
-
"react-hooks-extra/no-unnecessary-use-prefix": "warn",
|
|
763
762
|
"react-web-api/no-leaked-event-listener": "warn",
|
|
764
763
|
"react-web-api/no-leaked-interval": "warn",
|
|
765
764
|
"react-web-api/no-leaked-resize-observer": "warn",
|
|
@@ -798,7 +797,7 @@ async function react(options = {}) {
|
|
|
798
797
|
...isTypeAware ? [{
|
|
799
798
|
files: filesTypeAware,
|
|
800
799
|
ignores: ignoresTypeAware,
|
|
801
|
-
name: "
|
|
800
|
+
name: "coderwyd/react/type-aware-rules",
|
|
802
801
|
rules: { ...typeAwareRules }
|
|
803
802
|
}] : []
|
|
804
803
|
];
|
|
@@ -1168,10 +1167,9 @@ async function svelte(options = {}) {
|
|
|
1168
1167
|
async function tailwindcss(options = {}) {
|
|
1169
1168
|
const { overrides } = options;
|
|
1170
1169
|
await ensurePackages(["eslint-plugin-tailwindcss"]);
|
|
1171
|
-
const pluginTailwindcss = await interopDefault(import("eslint-plugin-tailwindcss"));
|
|
1172
1170
|
return [{
|
|
1173
1171
|
name: "coderwyd/tailwindcss/rules",
|
|
1174
|
-
plugins: { tailwindcss:
|
|
1172
|
+
plugins: { tailwindcss: await interopDefault(import("eslint-plugin-tailwindcss")) },
|
|
1175
1173
|
rules: {
|
|
1176
1174
|
"tailwindcss/classnames-order": "warn",
|
|
1177
1175
|
"tailwindcss/enforces-negative-arbitrary-values": "warn",
|
|
@@ -1457,10 +1455,9 @@ function unicorn(options = {}) {
|
|
|
1457
1455
|
async function unocss(options = {}) {
|
|
1458
1456
|
const { attributify = true, strict = false } = options;
|
|
1459
1457
|
await ensurePackages(["@unocss/eslint-plugin"]);
|
|
1460
|
-
const pluginUnoCSS = await interopDefault(import("@unocss/eslint-plugin"));
|
|
1461
1458
|
return [{
|
|
1462
1459
|
name: "coderwyd/unocss/rules",
|
|
1463
|
-
plugins: { unocss:
|
|
1460
|
+
plugins: { unocss: await interopDefault(import("@unocss/eslint-plugin")) },
|
|
1464
1461
|
rules: {
|
|
1465
1462
|
"unocss/order": "warn",
|
|
1466
1463
|
...attributify ? { "unocss/order-attributify": "warn" } : {},
|
|
@@ -1475,7 +1472,7 @@ async function vue(options = {}) {
|
|
|
1475
1472
|
const { files = [GLOB_VUE], overrides = {} } = options;
|
|
1476
1473
|
const [pluginVue, parserVue] = await Promise.all([interopDefault(import("eslint-plugin-vue")), interopDefault(import("vue-eslint-parser"))]);
|
|
1477
1474
|
const isVue3 = getVueVersion() === 3;
|
|
1478
|
-
const
|
|
1475
|
+
const vueRules = (isVue3 ? [
|
|
1479
1476
|
"essential",
|
|
1480
1477
|
"strongly-recommended",
|
|
1481
1478
|
"recommended"
|
|
@@ -1483,8 +1480,7 @@ async function vue(options = {}) {
|
|
|
1483
1480
|
"vue2-essential",
|
|
1484
1481
|
"vue2-strongly-recommended",
|
|
1485
1482
|
"vue2-recommended"
|
|
1486
|
-
]
|
|
1487
|
-
const vueRules = configKeys.reduce((preRules, key) => {
|
|
1483
|
+
]).reduce((preRules, key) => {
|
|
1488
1484
|
const config = pluginVue.configs[key];
|
|
1489
1485
|
return {
|
|
1490
1486
|
...preRules,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderwyd/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.7.0",
|
|
5
5
|
"description": "Donny's ESLint config",
|
|
6
6
|
"author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -71,60 +71,61 @@
|
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@antfu/install-pkg": "^1.1.0",
|
|
73
73
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
75
|
-
"@typescript-eslint/parser": "^8.
|
|
76
|
-
"@vitest/eslint-plugin": "^1.3.
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
|
75
|
+
"@typescript-eslint/parser": "^8.45.0",
|
|
76
|
+
"@vitest/eslint-plugin": "^1.3.13",
|
|
77
77
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
78
78
|
"eslint-config-prettier": "^10.1.8",
|
|
79
79
|
"eslint-plugin-antfu": "^3.1.1",
|
|
80
80
|
"eslint-plugin-command": "^3.3.1",
|
|
81
|
-
"eslint-plugin-de-morgan": "^
|
|
82
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
81
|
+
"eslint-plugin-de-morgan": "^2.0.0",
|
|
83
82
|
"eslint-plugin-import-lite": "^0.3.0",
|
|
84
|
-
"eslint-plugin-jsdoc": "^
|
|
83
|
+
"eslint-plugin-jsdoc": "^60.5.0",
|
|
85
84
|
"eslint-plugin-jsonc": "^2.20.1",
|
|
86
|
-
"eslint-plugin-n": "^17.
|
|
85
|
+
"eslint-plugin-n": "^17.23.1",
|
|
87
86
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
88
87
|
"eslint-plugin-perfectionist": "^4.15.0",
|
|
89
88
|
"eslint-plugin-regexp": "^2.10.0",
|
|
90
|
-
"eslint-plugin-unicorn": "^
|
|
89
|
+
"eslint-plugin-unicorn": "^61.0.2",
|
|
91
90
|
"eslint-plugin-unused-imports": "^4.2.0",
|
|
92
|
-
"eslint-plugin-vue": "^10.
|
|
91
|
+
"eslint-plugin-vue": "^10.5.0",
|
|
93
92
|
"eslint-plugin-yml": "^1.18.0",
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"jsonc-eslint-parser": "^2.4.0",
|
|
93
|
+
"globals": "^16.4.0",
|
|
94
|
+
"jsonc-eslint-parser": "^2.4.1",
|
|
97
95
|
"local-pkg": "^1.1.2",
|
|
98
96
|
"parse-gitignore": "^2.0.0",
|
|
99
97
|
"picocolors": "^1.1.1",
|
|
100
|
-
"prettier": "^3.6.2",
|
|
101
98
|
"prompts": "^2.4.2",
|
|
102
99
|
"vue-eslint-parser": "^10.2.0",
|
|
103
100
|
"yaml-eslint-parser": "^1.3.0",
|
|
104
101
|
"yargs": "^18.0.0"
|
|
105
102
|
},
|
|
106
103
|
"devDependencies": {
|
|
107
|
-
"@antfu/ni": "^
|
|
108
|
-
"@eslint-react/eslint-plugin": "^
|
|
109
|
-
"@eslint/config-inspector": "^1.
|
|
104
|
+
"@antfu/ni": "^26.1.0",
|
|
105
|
+
"@eslint-react/eslint-plugin": "^2.0.3",
|
|
106
|
+
"@eslint/config-inspector": "^1.3.0",
|
|
110
107
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
111
|
-
"@types/node": "^24.
|
|
108
|
+
"@types/node": "^24.6.0",
|
|
112
109
|
"@types/prompts": "^2.4.9",
|
|
113
110
|
"@types/yargs": "^17.0.33",
|
|
114
|
-
"@unocss/eslint-plugin": "^66.5.
|
|
111
|
+
"@unocss/eslint-plugin": "^66.5.2",
|
|
115
112
|
"bumpp": "^10.2.3",
|
|
116
|
-
"eslint": "^9.
|
|
113
|
+
"eslint": "^9.36.0",
|
|
117
114
|
"eslint-plugin-react-hooks": "6.0.0-rc1",
|
|
118
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
119
|
-
"eslint-plugin-svelte": "^3.12.
|
|
115
|
+
"eslint-plugin-react-refresh": "^0.4.22",
|
|
116
|
+
"eslint-plugin-svelte": "^3.12.4",
|
|
120
117
|
"eslint-plugin-tailwindcss": "^3.18.2",
|
|
121
|
-
"
|
|
118
|
+
"eslint-typegen": "^2.3.0",
|
|
119
|
+
"jiti": "^2.6.0",
|
|
122
120
|
"nano-staged": "^0.8.0",
|
|
121
|
+
"prettier": "^3.6.2",
|
|
122
|
+
"publint": "^0.3.13",
|
|
123
123
|
"simple-git-hooks": "^2.13.1",
|
|
124
|
-
"svelte": "^5.
|
|
125
|
-
"svelte-eslint-parser": "^1.3.
|
|
126
|
-
"tsdown": "^0.
|
|
127
|
-
"typescript": "^5.9.2"
|
|
124
|
+
"svelte": "^5.39.6",
|
|
125
|
+
"svelte-eslint-parser": "^1.3.3",
|
|
126
|
+
"tsdown": "^0.15.5",
|
|
127
|
+
"typescript": "^5.9.2",
|
|
128
|
+
"unplugin-unused": "^0.5.3"
|
|
128
129
|
},
|
|
129
130
|
"simple-git-hooks": {
|
|
130
131
|
"pre-commit": "pnpm exec nano-staged"
|