@dhzh/eslint-config 0.2.3 → 0.3.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.cjs +24 -24
- package/dist/cli.js +24 -24
- package/dist/index.cjs +74 -40
- package/dist/index.d.cts +203 -826
- package/dist/index.d.ts +203 -826
- package/dist/index.js +74 -40
- package/package.json +12 -13
package/dist/cli.cjs
CHANGED
|
@@ -48,8 +48,8 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
48
48
|
var package_default = {
|
|
49
49
|
name: "@dhzh/eslint-config",
|
|
50
50
|
type: "module",
|
|
51
|
-
version: "0.
|
|
52
|
-
packageManager: "pnpm@
|
|
51
|
+
version: "0.3.0",
|
|
52
|
+
packageManager: "pnpm@9.0.2",
|
|
53
53
|
description: "Easton's ESLint config",
|
|
54
54
|
author: "Easton Zheng <dhzhme@gmail.com>",
|
|
55
55
|
license: "MIT",
|
|
@@ -129,9 +129,10 @@ var package_default = {
|
|
|
129
129
|
dependencies: {
|
|
130
130
|
"@antfu/install-pkg": "^0.3.2",
|
|
131
131
|
"@clack/prompts": "^0.7.0",
|
|
132
|
-
"@
|
|
133
|
-
"@
|
|
134
|
-
"@typescript-eslint/
|
|
132
|
+
"@eslint-react/eslint-plugin": "^1.5.8",
|
|
133
|
+
"@stylistic/eslint-plugin": "^1.7.2",
|
|
134
|
+
"@typescript-eslint/eslint-plugin": "^7.7.0",
|
|
135
|
+
"@typescript-eslint/parser": "^7.7.0",
|
|
135
136
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
136
137
|
"eslint-flat-config-utils": "^0.2.3",
|
|
137
138
|
"eslint-merge-processors": "^0.1.0",
|
|
@@ -144,7 +145,6 @@ var package_default = {
|
|
|
144
145
|
"eslint-plugin-n": "^17.2.1",
|
|
145
146
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
146
147
|
"eslint-plugin-perfectionist": "^2.9.0",
|
|
147
|
-
"eslint-plugin-react": "^7.34.1",
|
|
148
148
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
149
149
|
"eslint-plugin-react-refresh": "^0.4.6",
|
|
150
150
|
"eslint-plugin-toml": "^0.11.0",
|
|
@@ -153,7 +153,7 @@ var package_default = {
|
|
|
153
153
|
"eslint-plugin-vitest": "^0.5.3",
|
|
154
154
|
"eslint-plugin-vue": "^9.25.0",
|
|
155
155
|
"eslint-plugin-yml": "^1.14.0",
|
|
156
|
-
"eslint-processor-vue-blocks": "^0.1.
|
|
156
|
+
"eslint-processor-vue-blocks": "^0.1.2",
|
|
157
157
|
globals: "^15.0.0",
|
|
158
158
|
"jsonc-eslint-parser": "^2.4.0",
|
|
159
159
|
"local-pkg": "^0.5.0",
|
|
@@ -169,19 +169,19 @@ var package_default = {
|
|
|
169
169
|
"@antfu/ni": "^0.21.12",
|
|
170
170
|
"@dhzh/eslint-config": "workspace:*",
|
|
171
171
|
"@eslint/config-inspector": "^0.4.6",
|
|
172
|
-
"@stylistic/eslint-plugin-migrate": "^1.7.
|
|
172
|
+
"@stylistic/eslint-plugin-migrate": "^1.7.2",
|
|
173
173
|
"@types/eslint": "^8.56.9",
|
|
174
174
|
"@types/fs-extra": "^11.0.4",
|
|
175
175
|
"@types/node": "^20.12.7",
|
|
176
176
|
"@types/prompts": "^2.4.9",
|
|
177
177
|
"@types/yargs": "^17.0.32",
|
|
178
|
-
"@unocss/eslint-plugin": "^0.59.
|
|
178
|
+
"@unocss/eslint-plugin": "^0.59.3",
|
|
179
179
|
"astro-eslint-parser": "^0.17.0",
|
|
180
180
|
bumpp: "^9.4.0",
|
|
181
181
|
"bundle-require": "^4.0.2",
|
|
182
182
|
eslint: "^9.0.0",
|
|
183
183
|
"eslint-plugin-astro": "^0.34.0",
|
|
184
|
-
"eslint-plugin-format": "^0.1.
|
|
184
|
+
"eslint-plugin-format": "^0.1.1",
|
|
185
185
|
"eslint-plugin-solid": "^0.13.2",
|
|
186
186
|
"eslint-plugin-svelte": "2.36.0-next.13",
|
|
187
187
|
"eslint-typegen": "^0.2.3",
|
|
@@ -194,12 +194,12 @@ var package_default = {
|
|
|
194
194
|
"prettier-plugin-slidev": "^1.0.5",
|
|
195
195
|
rimraf: "^5.0.5",
|
|
196
196
|
"simple-git-hooks": "^2.11.1",
|
|
197
|
-
svelte: "^4.2.
|
|
197
|
+
svelte: "^4.2.15",
|
|
198
198
|
"svelte-eslint-parser": "^0.34.1",
|
|
199
199
|
tsup: "^8.0.2",
|
|
200
200
|
typescript: "^5.4.5",
|
|
201
201
|
vitest: "^1.5.0",
|
|
202
|
-
vue: "^3.4.
|
|
202
|
+
vue: "^3.4.23"
|
|
203
203
|
},
|
|
204
204
|
"simple-git-hooks": {
|
|
205
205
|
"pre-commit": "pnpm lint-staged"
|
|
@@ -230,18 +230,18 @@ var vscodeSettingsString = `
|
|
|
230
230
|
},
|
|
231
231
|
|
|
232
232
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
233
|
-
"eslint.rules.customizations": [
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
],
|
|
233
|
+
// "eslint.rules.customizations": [
|
|
234
|
+
// { "rule": "style/*", "severity": "off" },
|
|
235
|
+
// { "rule": "format/*", "severity": "off" },
|
|
236
|
+
// { "rule": "*-indent", "severity": "off" },
|
|
237
|
+
// { "rule": "*-spacing", "severity": "off" },
|
|
238
|
+
// { "rule": "*-spaces", "severity": "off" },
|
|
239
|
+
// { "rule": "*-order", "severity": "off" },
|
|
240
|
+
// { "rule": "*-dangle", "severity": "off" },
|
|
241
|
+
// { "rule": "*-newline", "severity": "off" },
|
|
242
|
+
// { "rule": "*quotes", "severity": "off" },
|
|
243
|
+
// { "rule": "*semi", "severity": "off" }
|
|
244
|
+
// ],
|
|
245
245
|
|
|
246
246
|
// Enable eslint for all supported languages
|
|
247
247
|
"eslint.validate": [
|
package/dist/cli.js
CHANGED
|
@@ -19,8 +19,8 @@ import c from "picocolors";
|
|
|
19
19
|
var package_default = {
|
|
20
20
|
name: "@dhzh/eslint-config",
|
|
21
21
|
type: "module",
|
|
22
|
-
version: "0.
|
|
23
|
-
packageManager: "pnpm@
|
|
22
|
+
version: "0.3.0",
|
|
23
|
+
packageManager: "pnpm@9.0.2",
|
|
24
24
|
description: "Easton's ESLint config",
|
|
25
25
|
author: "Easton Zheng <dhzhme@gmail.com>",
|
|
26
26
|
license: "MIT",
|
|
@@ -100,9 +100,10 @@ var package_default = {
|
|
|
100
100
|
dependencies: {
|
|
101
101
|
"@antfu/install-pkg": "^0.3.2",
|
|
102
102
|
"@clack/prompts": "^0.7.0",
|
|
103
|
-
"@
|
|
104
|
-
"@
|
|
105
|
-
"@typescript-eslint/
|
|
103
|
+
"@eslint-react/eslint-plugin": "^1.5.8",
|
|
104
|
+
"@stylistic/eslint-plugin": "^1.7.2",
|
|
105
|
+
"@typescript-eslint/eslint-plugin": "^7.7.0",
|
|
106
|
+
"@typescript-eslint/parser": "^7.7.0",
|
|
106
107
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
107
108
|
"eslint-flat-config-utils": "^0.2.3",
|
|
108
109
|
"eslint-merge-processors": "^0.1.0",
|
|
@@ -115,7 +116,6 @@ var package_default = {
|
|
|
115
116
|
"eslint-plugin-n": "^17.2.1",
|
|
116
117
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
117
118
|
"eslint-plugin-perfectionist": "^2.9.0",
|
|
118
|
-
"eslint-plugin-react": "^7.34.1",
|
|
119
119
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
120
120
|
"eslint-plugin-react-refresh": "^0.4.6",
|
|
121
121
|
"eslint-plugin-toml": "^0.11.0",
|
|
@@ -124,7 +124,7 @@ var package_default = {
|
|
|
124
124
|
"eslint-plugin-vitest": "^0.5.3",
|
|
125
125
|
"eslint-plugin-vue": "^9.25.0",
|
|
126
126
|
"eslint-plugin-yml": "^1.14.0",
|
|
127
|
-
"eslint-processor-vue-blocks": "^0.1.
|
|
127
|
+
"eslint-processor-vue-blocks": "^0.1.2",
|
|
128
128
|
globals: "^15.0.0",
|
|
129
129
|
"jsonc-eslint-parser": "^2.4.0",
|
|
130
130
|
"local-pkg": "^0.5.0",
|
|
@@ -140,19 +140,19 @@ var package_default = {
|
|
|
140
140
|
"@antfu/ni": "^0.21.12",
|
|
141
141
|
"@dhzh/eslint-config": "workspace:*",
|
|
142
142
|
"@eslint/config-inspector": "^0.4.6",
|
|
143
|
-
"@stylistic/eslint-plugin-migrate": "^1.7.
|
|
143
|
+
"@stylistic/eslint-plugin-migrate": "^1.7.2",
|
|
144
144
|
"@types/eslint": "^8.56.9",
|
|
145
145
|
"@types/fs-extra": "^11.0.4",
|
|
146
146
|
"@types/node": "^20.12.7",
|
|
147
147
|
"@types/prompts": "^2.4.9",
|
|
148
148
|
"@types/yargs": "^17.0.32",
|
|
149
|
-
"@unocss/eslint-plugin": "^0.59.
|
|
149
|
+
"@unocss/eslint-plugin": "^0.59.3",
|
|
150
150
|
"astro-eslint-parser": "^0.17.0",
|
|
151
151
|
bumpp: "^9.4.0",
|
|
152
152
|
"bundle-require": "^4.0.2",
|
|
153
153
|
eslint: "^9.0.0",
|
|
154
154
|
"eslint-plugin-astro": "^0.34.0",
|
|
155
|
-
"eslint-plugin-format": "^0.1.
|
|
155
|
+
"eslint-plugin-format": "^0.1.1",
|
|
156
156
|
"eslint-plugin-solid": "^0.13.2",
|
|
157
157
|
"eslint-plugin-svelte": "2.36.0-next.13",
|
|
158
158
|
"eslint-typegen": "^0.2.3",
|
|
@@ -165,12 +165,12 @@ var package_default = {
|
|
|
165
165
|
"prettier-plugin-slidev": "^1.0.5",
|
|
166
166
|
rimraf: "^5.0.5",
|
|
167
167
|
"simple-git-hooks": "^2.11.1",
|
|
168
|
-
svelte: "^4.2.
|
|
168
|
+
svelte: "^4.2.15",
|
|
169
169
|
"svelte-eslint-parser": "^0.34.1",
|
|
170
170
|
tsup: "^8.0.2",
|
|
171
171
|
typescript: "^5.4.5",
|
|
172
172
|
vitest: "^1.5.0",
|
|
173
|
-
vue: "^3.4.
|
|
173
|
+
vue: "^3.4.23"
|
|
174
174
|
},
|
|
175
175
|
"simple-git-hooks": {
|
|
176
176
|
"pre-commit": "pnpm lint-staged"
|
|
@@ -201,18 +201,18 @@ var vscodeSettingsString = `
|
|
|
201
201
|
},
|
|
202
202
|
|
|
203
203
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
204
|
-
"eslint.rules.customizations": [
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
],
|
|
204
|
+
// "eslint.rules.customizations": [
|
|
205
|
+
// { "rule": "style/*", "severity": "off" },
|
|
206
|
+
// { "rule": "format/*", "severity": "off" },
|
|
207
|
+
// { "rule": "*-indent", "severity": "off" },
|
|
208
|
+
// { "rule": "*-spacing", "severity": "off" },
|
|
209
|
+
// { "rule": "*-spaces", "severity": "off" },
|
|
210
|
+
// { "rule": "*-order", "severity": "off" },
|
|
211
|
+
// { "rule": "*-dangle", "severity": "off" },
|
|
212
|
+
// { "rule": "*-newline", "severity": "off" },
|
|
213
|
+
// { "rule": "*quotes", "severity": "off" },
|
|
214
|
+
// { "rule": "*semi", "severity": "off" }
|
|
215
|
+
// ],
|
|
216
216
|
|
|
217
217
|
// Enable eslint for all supported languages
|
|
218
218
|
"eslint.validate": [
|
package/dist/index.cjs
CHANGED
|
@@ -1081,52 +1081,69 @@ var ReactRefreshAllowConstantExportPackages = [
|
|
|
1081
1081
|
];
|
|
1082
1082
|
async function react(options = {}) {
|
|
1083
1083
|
const {
|
|
1084
|
-
files = [
|
|
1085
|
-
overrides = {}
|
|
1086
|
-
typescript: typescript2 = true
|
|
1084
|
+
files = [GLOB_TS, GLOB_TSX],
|
|
1085
|
+
overrides = {}
|
|
1087
1086
|
} = options;
|
|
1088
1087
|
await ensurePackages([
|
|
1089
|
-
"eslint-plugin
|
|
1088
|
+
"@eslint-react/eslint-plugin",
|
|
1090
1089
|
"eslint-plugin-react-hooks",
|
|
1091
1090
|
"eslint-plugin-react-refresh"
|
|
1092
1091
|
]);
|
|
1092
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1093
|
+
const isTypeAware = !!tsconfigPath;
|
|
1093
1094
|
const [
|
|
1094
1095
|
pluginReact,
|
|
1095
1096
|
pluginReactHooks,
|
|
1096
|
-
pluginReactRefresh
|
|
1097
|
+
pluginReactRefresh,
|
|
1098
|
+
parserTs
|
|
1097
1099
|
] = await Promise.all([
|
|
1098
|
-
interopDefault(import("eslint-plugin
|
|
1100
|
+
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1099
1101
|
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1100
|
-
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1102
|
+
interopDefault(import("eslint-plugin-react-refresh")),
|
|
1103
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
1101
1104
|
]);
|
|
1102
1105
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1103
1106
|
(i) => (0, import_local_pkg3.isPackageExists)(i)
|
|
1104
1107
|
);
|
|
1108
|
+
const plugins = pluginReact.configs.all.plugins;
|
|
1105
1109
|
return [
|
|
1106
1110
|
{
|
|
1107
1111
|
name: "antfu/react/setup",
|
|
1108
1112
|
plugins: {
|
|
1109
|
-
"react":
|
|
1113
|
+
"react": plugins["@eslint-react"],
|
|
1114
|
+
"react-dom": plugins["@eslint-react/dom"],
|
|
1110
1115
|
"react-hooks": pluginReactHooks,
|
|
1116
|
+
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1117
|
+
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1111
1118
|
"react-refresh": pluginReactRefresh
|
|
1112
|
-
},
|
|
1113
|
-
settings: {
|
|
1114
|
-
react: {
|
|
1115
|
-
version: "detect"
|
|
1116
|
-
}
|
|
1117
1119
|
}
|
|
1118
1120
|
},
|
|
1119
1121
|
{
|
|
1120
1122
|
files,
|
|
1121
1123
|
languageOptions: {
|
|
1124
|
+
parser: parserTs,
|
|
1122
1125
|
parserOptions: {
|
|
1123
1126
|
ecmaFeatures: {
|
|
1124
1127
|
jsx: true
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1128
|
+
},
|
|
1129
|
+
...isTypeAware ? { project: tsconfigPath } : {}
|
|
1130
|
+
},
|
|
1131
|
+
sourceType: "module"
|
|
1127
1132
|
},
|
|
1128
1133
|
name: "antfu/react/rules",
|
|
1129
1134
|
rules: {
|
|
1135
|
+
// recommended rules from @eslint-react/dom
|
|
1136
|
+
"react-dom/no-children-in-void-dom-elements": "warn",
|
|
1137
|
+
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
1138
|
+
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
1139
|
+
"react-dom/no-find-dom-node": "error",
|
|
1140
|
+
"react-dom/no-missing-button-type": "warn",
|
|
1141
|
+
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
1142
|
+
"react-dom/no-namespace": "error",
|
|
1143
|
+
"react-dom/no-render-return-value": "error",
|
|
1144
|
+
"react-dom/no-script-url": "warn",
|
|
1145
|
+
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
1146
|
+
"react-dom/no-unsafe-target-blank": "warn",
|
|
1130
1147
|
// recommended rules react-hooks
|
|
1131
1148
|
"react-hooks/exhaustive-deps": "warn",
|
|
1132
1149
|
"react-hooks/rules-of-hooks": "error",
|
|
@@ -1135,32 +1152,45 @@ async function react(options = {}) {
|
|
|
1135
1152
|
"warn",
|
|
1136
1153
|
{ allowConstantExport: isAllowConstantExport }
|
|
1137
1154
|
],
|
|
1138
|
-
// recommended rules react
|
|
1139
|
-
"react/
|
|
1140
|
-
"react/
|
|
1141
|
-
"react/
|
|
1142
|
-
"react/
|
|
1143
|
-
"react/
|
|
1144
|
-
"react/
|
|
1145
|
-
"react/
|
|
1146
|
-
"react/
|
|
1147
|
-
"react/no-children-
|
|
1148
|
-
"react/no-
|
|
1149
|
-
"react/no-
|
|
1155
|
+
// recommended rules from @eslint-react
|
|
1156
|
+
"react/ensure-forward-ref-using-ref": "warn",
|
|
1157
|
+
"react/no-access-state-in-setstate": "error",
|
|
1158
|
+
"react/no-array-index-key": "warn",
|
|
1159
|
+
"react/no-children-count": "warn",
|
|
1160
|
+
"react/no-children-for-each": "warn",
|
|
1161
|
+
"react/no-children-map": "warn",
|
|
1162
|
+
"react/no-children-only": "warn",
|
|
1163
|
+
"react/no-children-prop": "warn",
|
|
1164
|
+
"react/no-children-to-array": "warn",
|
|
1165
|
+
"react/no-clone-element": "warn",
|
|
1166
|
+
"react/no-comment-textnodes": "warn",
|
|
1167
|
+
"react/no-component-will-mount": "error",
|
|
1168
|
+
"react/no-component-will-receive-props": "error",
|
|
1169
|
+
"react/no-component-will-update": "error",
|
|
1170
|
+
"react/no-create-ref": "error",
|
|
1150
1171
|
"react/no-direct-mutation-state": "error",
|
|
1151
|
-
"react/no-
|
|
1152
|
-
"react/no-
|
|
1153
|
-
"react/no-
|
|
1172
|
+
"react/no-duplicate-key": "error",
|
|
1173
|
+
"react/no-implicit-key": "error",
|
|
1174
|
+
"react/no-missing-key": "error",
|
|
1175
|
+
"react/no-nested-components": "warn",
|
|
1176
|
+
"react/no-redundant-should-component-update": "error",
|
|
1177
|
+
"react/no-set-state-in-component-did-mount": "warn",
|
|
1178
|
+
"react/no-set-state-in-component-did-update": "warn",
|
|
1179
|
+
"react/no-set-state-in-component-will-update": "warn",
|
|
1154
1180
|
"react/no-string-refs": "error",
|
|
1155
|
-
"react/no-
|
|
1156
|
-
"react/no-
|
|
1157
|
-
"react/no-unsafe": "
|
|
1158
|
-
"react/
|
|
1159
|
-
"react/
|
|
1160
|
-
"react/
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1181
|
+
"react/no-unsafe-component-will-mount": "warn",
|
|
1182
|
+
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1183
|
+
"react/no-unsafe-component-will-update": "warn",
|
|
1184
|
+
"react/no-unstable-context-value": "error",
|
|
1185
|
+
"react/no-unstable-default-props": "error",
|
|
1186
|
+
"react/no-unused-class-component-members": "warn",
|
|
1187
|
+
"react/no-unused-state": "warn",
|
|
1188
|
+
"react/no-useless-fragment": "warn",
|
|
1189
|
+
"react/prefer-destructuring-assignment": "warn",
|
|
1190
|
+
"react/prefer-shorthand-boolean": "warn",
|
|
1191
|
+
"react/prefer-shorthand-fragment": "warn",
|
|
1192
|
+
...isTypeAware ? {
|
|
1193
|
+
"react/no-leaked-conditional-rendering": "warn"
|
|
1164
1194
|
} : {},
|
|
1165
1195
|
// overrides
|
|
1166
1196
|
...overrides
|
|
@@ -2196,6 +2226,10 @@ var VuePackages = [
|
|
|
2196
2226
|
"@slidev/cli"
|
|
2197
2227
|
];
|
|
2198
2228
|
var defaultPluginRenaming = {
|
|
2229
|
+
"@eslint-react": "react",
|
|
2230
|
+
"@eslint-react/dom": "react-dom",
|
|
2231
|
+
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
2232
|
+
"@eslint-react/naming-convention": "react-naming-convention",
|
|
2199
2233
|
"@stylistic": "style",
|
|
2200
2234
|
"@typescript-eslint": "ts",
|
|
2201
2235
|
"import-x": "import",
|
|
@@ -2283,7 +2317,7 @@ function dhzh(options = {}, ...userConfigs) {
|
|
|
2283
2317
|
if (enableReact) {
|
|
2284
2318
|
configs.push(react({
|
|
2285
2319
|
overrides: getOverrides(options, "react"),
|
|
2286
|
-
|
|
2320
|
+
tsconfigPath: getOverrides(options, "typescript").tsconfigPath
|
|
2287
2321
|
}));
|
|
2288
2322
|
}
|
|
2289
2323
|
if (enableSolid) {
|