@dhzh/eslint-config 0.12.2 → 0.12.4
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 +32 -31
- package/dist/cli.js +32 -31
- package/dist/index.cjs +43 -10
- package/dist/index.d.cts +43 -33
- package/dist/index.d.ts +43 -33
- package/dist/index.js +37 -10
- package/package.json +31 -30
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.12.
|
|
52
|
-
packageManager: "pnpm@9.
|
|
51
|
+
version: "0.12.4",
|
|
52
|
+
packageManager: "pnpm@9.8.0",
|
|
53
53
|
description: "Easton's ESLint config",
|
|
54
54
|
author: "Easton Zheng <dhzhme@gmail.com>",
|
|
55
55
|
license: "MIT",
|
|
@@ -77,7 +77,7 @@ var package_default = {
|
|
|
77
77
|
dev: "npx @eslint/config-inspector --config eslint.config.ts",
|
|
78
78
|
"build:inspector": "pnpm build && npx @eslint/config-inspector build",
|
|
79
79
|
watch: "tsup --format esm,cjs --watch",
|
|
80
|
-
lint: "eslint .",
|
|
80
|
+
lint: "eslint --flag unstable_ts_config .",
|
|
81
81
|
typegen: "esno scripts/typegen.ts",
|
|
82
82
|
prepack: "nr build",
|
|
83
83
|
release: "bumpp && pnpm publish --access=public",
|
|
@@ -130,28 +130,28 @@ var package_default = {
|
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
dependencies: {
|
|
133
|
-
"@antfu/install-pkg": "^0.
|
|
133
|
+
"@antfu/install-pkg": "^0.4.0",
|
|
134
134
|
"@clack/prompts": "^0.7.0",
|
|
135
|
-
"@eslint-
|
|
136
|
-
"@
|
|
137
|
-
"@
|
|
138
|
-
"@typescript-eslint/
|
|
139
|
-
"@
|
|
135
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
136
|
+
"@eslint-react/eslint-plugin": "^1.12.1",
|
|
137
|
+
"@stylistic/eslint-plugin": "^2.6.4",
|
|
138
|
+
"@typescript-eslint/eslint-plugin": "^8.2.0",
|
|
139
|
+
"@typescript-eslint/parser": "^8.2.0",
|
|
140
|
+
"@vitest/eslint-plugin": "^1.0.3",
|
|
140
141
|
"eslint-config-flat-gitignore": "^0.1.8",
|
|
141
|
-
"eslint-flat-config-utils": "^0.3.
|
|
142
|
+
"eslint-flat-config-utils": "^0.3.1",
|
|
142
143
|
"eslint-merge-processors": "^0.1.0",
|
|
143
|
-
"eslint-plugin-antfu": "^2.3.
|
|
144
|
+
"eslint-plugin-antfu": "^2.3.6",
|
|
144
145
|
"eslint-plugin-command": "^0.2.3",
|
|
145
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
146
146
|
"eslint-plugin-import-x": "^3.1.0",
|
|
147
|
-
"eslint-plugin-jsdoc": "^50.
|
|
147
|
+
"eslint-plugin-jsdoc": "^50.2.2",
|
|
148
148
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
149
149
|
"eslint-plugin-markdown": "^5.1.0",
|
|
150
150
|
"eslint-plugin-n": "^17.10.2",
|
|
151
|
-
"eslint-plugin-no-only-tests": "^3.
|
|
152
|
-
"eslint-plugin-perfectionist": "^3.
|
|
151
|
+
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
152
|
+
"eslint-plugin-perfectionist": "^3.2.0",
|
|
153
153
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
154
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
154
|
+
"eslint-plugin-react-refresh": "^0.4.11",
|
|
155
155
|
"eslint-plugin-regexp": "^2.6.0",
|
|
156
156
|
"eslint-plugin-toml": "^0.11.1",
|
|
157
157
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
@@ -170,32 +170,31 @@ var package_default = {
|
|
|
170
170
|
yargs: "^17.7.2"
|
|
171
171
|
},
|
|
172
172
|
devDependencies: {
|
|
173
|
-
"@antfu/ni": "^0.22.
|
|
174
|
-
"@
|
|
175
|
-
"@eslint/config-inspector": "^0.5.2",
|
|
173
|
+
"@antfu/ni": "^0.22.4",
|
|
174
|
+
"@eslint/config-inspector": "^0.5.4",
|
|
176
175
|
"@prettier/plugin-xml": "^3.4.1",
|
|
177
|
-
"@stylistic/eslint-plugin-migrate": "^2.6.
|
|
176
|
+
"@stylistic/eslint-plugin-migrate": "^2.6.4",
|
|
178
177
|
"@types/eslint": "^9.6.0",
|
|
179
178
|
"@types/fs-extra": "^11.0.4",
|
|
180
|
-
"@types/node": "^22.
|
|
179
|
+
"@types/node": "^22.5.0",
|
|
181
180
|
"@types/prompts": "^2.4.9",
|
|
182
181
|
"@types/yargs": "^17.0.33",
|
|
183
|
-
"@unocss/eslint-plugin": "^0.
|
|
182
|
+
"@unocss/eslint-plugin": "^0.62.2",
|
|
184
183
|
"astro-eslint-parser": "^1.0.2",
|
|
185
|
-
bumpp: "^9.
|
|
184
|
+
bumpp: "^9.5.2",
|
|
186
185
|
"bundle-require": "^5.0.0",
|
|
187
|
-
eslint: "
|
|
186
|
+
eslint: "^9.9.0",
|
|
188
187
|
"eslint-plugin-astro": "^1.2.3",
|
|
189
188
|
"eslint-plugin-format": "^0.1.2",
|
|
190
|
-
"eslint-plugin-solid": "^0.14.
|
|
189
|
+
"eslint-plugin-solid": "^0.14.2",
|
|
191
190
|
"eslint-plugin-svelte": "^2.43.0",
|
|
192
|
-
"eslint-
|
|
193
|
-
"eslint-typegen": "^0.3.0",
|
|
191
|
+
"eslint-typegen": "^0.3.1",
|
|
194
192
|
esno: "^4.7.0",
|
|
195
|
-
execa: "^9.3.
|
|
193
|
+
execa: "^9.3.1",
|
|
196
194
|
"fast-glob": "^3.3.2",
|
|
197
195
|
"fs-extra": "^11.2.0",
|
|
198
|
-
|
|
196
|
+
jiti: "^1.21.6",
|
|
197
|
+
"lint-staged": "^15.2.9",
|
|
199
198
|
"prettier-plugin-astro": "^0.14.1",
|
|
200
199
|
"prettier-plugin-slidev": "^1.0.5",
|
|
201
200
|
rimraf: "^6.0.1",
|
|
@@ -206,16 +205,18 @@ var package_default = {
|
|
|
206
205
|
tsx: "^4.17.0",
|
|
207
206
|
typescript: "^5.5.4",
|
|
208
207
|
vitest: "^2.0.5",
|
|
209
|
-
vue: "^3.4.
|
|
208
|
+
vue: "^3.4.38"
|
|
210
209
|
},
|
|
211
210
|
resolutions: {
|
|
211
|
+
"@eslint-community/eslint-utils": "^4.4.0",
|
|
212
|
+
"@typescript-eslint/utils": "^8.2.0",
|
|
212
213
|
tsx: "~4.17.0"
|
|
213
214
|
},
|
|
214
215
|
"simple-git-hooks": {
|
|
215
216
|
"pre-commit": "npx lint-staged"
|
|
216
217
|
},
|
|
217
218
|
"lint-staged": {
|
|
218
|
-
"*": "eslint --fix"
|
|
219
|
+
"*": "eslint --flag unstable_ts_config --fix"
|
|
219
220
|
}
|
|
220
221
|
};
|
|
221
222
|
|
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.12.
|
|
23
|
-
packageManager: "pnpm@9.
|
|
22
|
+
version: "0.12.4",
|
|
23
|
+
packageManager: "pnpm@9.8.0",
|
|
24
24
|
description: "Easton's ESLint config",
|
|
25
25
|
author: "Easton Zheng <dhzhme@gmail.com>",
|
|
26
26
|
license: "MIT",
|
|
@@ -48,7 +48,7 @@ var package_default = {
|
|
|
48
48
|
dev: "npx @eslint/config-inspector --config eslint.config.ts",
|
|
49
49
|
"build:inspector": "pnpm build && npx @eslint/config-inspector build",
|
|
50
50
|
watch: "tsup --format esm,cjs --watch",
|
|
51
|
-
lint: "eslint .",
|
|
51
|
+
lint: "eslint --flag unstable_ts_config .",
|
|
52
52
|
typegen: "esno scripts/typegen.ts",
|
|
53
53
|
prepack: "nr build",
|
|
54
54
|
release: "bumpp && pnpm publish --access=public",
|
|
@@ -101,28 +101,28 @@ var package_default = {
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
dependencies: {
|
|
104
|
-
"@antfu/install-pkg": "^0.
|
|
104
|
+
"@antfu/install-pkg": "^0.4.0",
|
|
105
105
|
"@clack/prompts": "^0.7.0",
|
|
106
|
-
"@eslint-
|
|
107
|
-
"@
|
|
108
|
-
"@
|
|
109
|
-
"@typescript-eslint/
|
|
110
|
-
"@
|
|
106
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
107
|
+
"@eslint-react/eslint-plugin": "^1.12.1",
|
|
108
|
+
"@stylistic/eslint-plugin": "^2.6.4",
|
|
109
|
+
"@typescript-eslint/eslint-plugin": "^8.2.0",
|
|
110
|
+
"@typescript-eslint/parser": "^8.2.0",
|
|
111
|
+
"@vitest/eslint-plugin": "^1.0.3",
|
|
111
112
|
"eslint-config-flat-gitignore": "^0.1.8",
|
|
112
|
-
"eslint-flat-config-utils": "^0.3.
|
|
113
|
+
"eslint-flat-config-utils": "^0.3.1",
|
|
113
114
|
"eslint-merge-processors": "^0.1.0",
|
|
114
|
-
"eslint-plugin-antfu": "^2.3.
|
|
115
|
+
"eslint-plugin-antfu": "^2.3.6",
|
|
115
116
|
"eslint-plugin-command": "^0.2.3",
|
|
116
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
117
117
|
"eslint-plugin-import-x": "^3.1.0",
|
|
118
|
-
"eslint-plugin-jsdoc": "^50.
|
|
118
|
+
"eslint-plugin-jsdoc": "^50.2.2",
|
|
119
119
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
120
120
|
"eslint-plugin-markdown": "^5.1.0",
|
|
121
121
|
"eslint-plugin-n": "^17.10.2",
|
|
122
|
-
"eslint-plugin-no-only-tests": "^3.
|
|
123
|
-
"eslint-plugin-perfectionist": "^3.
|
|
122
|
+
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
123
|
+
"eslint-plugin-perfectionist": "^3.2.0",
|
|
124
124
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
125
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
125
|
+
"eslint-plugin-react-refresh": "^0.4.11",
|
|
126
126
|
"eslint-plugin-regexp": "^2.6.0",
|
|
127
127
|
"eslint-plugin-toml": "^0.11.1",
|
|
128
128
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
@@ -141,32 +141,31 @@ var package_default = {
|
|
|
141
141
|
yargs: "^17.7.2"
|
|
142
142
|
},
|
|
143
143
|
devDependencies: {
|
|
144
|
-
"@antfu/ni": "^0.22.
|
|
145
|
-
"@
|
|
146
|
-
"@eslint/config-inspector": "^0.5.2",
|
|
144
|
+
"@antfu/ni": "^0.22.4",
|
|
145
|
+
"@eslint/config-inspector": "^0.5.4",
|
|
147
146
|
"@prettier/plugin-xml": "^3.4.1",
|
|
148
|
-
"@stylistic/eslint-plugin-migrate": "^2.6.
|
|
147
|
+
"@stylistic/eslint-plugin-migrate": "^2.6.4",
|
|
149
148
|
"@types/eslint": "^9.6.0",
|
|
150
149
|
"@types/fs-extra": "^11.0.4",
|
|
151
|
-
"@types/node": "^22.
|
|
150
|
+
"@types/node": "^22.5.0",
|
|
152
151
|
"@types/prompts": "^2.4.9",
|
|
153
152
|
"@types/yargs": "^17.0.33",
|
|
154
|
-
"@unocss/eslint-plugin": "^0.
|
|
153
|
+
"@unocss/eslint-plugin": "^0.62.2",
|
|
155
154
|
"astro-eslint-parser": "^1.0.2",
|
|
156
|
-
bumpp: "^9.
|
|
155
|
+
bumpp: "^9.5.2",
|
|
157
156
|
"bundle-require": "^5.0.0",
|
|
158
|
-
eslint: "
|
|
157
|
+
eslint: "^9.9.0",
|
|
159
158
|
"eslint-plugin-astro": "^1.2.3",
|
|
160
159
|
"eslint-plugin-format": "^0.1.2",
|
|
161
|
-
"eslint-plugin-solid": "^0.14.
|
|
160
|
+
"eslint-plugin-solid": "^0.14.2",
|
|
162
161
|
"eslint-plugin-svelte": "^2.43.0",
|
|
163
|
-
"eslint-
|
|
164
|
-
"eslint-typegen": "^0.3.0",
|
|
162
|
+
"eslint-typegen": "^0.3.1",
|
|
165
163
|
esno: "^4.7.0",
|
|
166
|
-
execa: "^9.3.
|
|
164
|
+
execa: "^9.3.1",
|
|
167
165
|
"fast-glob": "^3.3.2",
|
|
168
166
|
"fs-extra": "^11.2.0",
|
|
169
|
-
|
|
167
|
+
jiti: "^1.21.6",
|
|
168
|
+
"lint-staged": "^15.2.9",
|
|
170
169
|
"prettier-plugin-astro": "^0.14.1",
|
|
171
170
|
"prettier-plugin-slidev": "^1.0.5",
|
|
172
171
|
rimraf: "^6.0.1",
|
|
@@ -177,16 +176,18 @@ var package_default = {
|
|
|
177
176
|
tsx: "^4.17.0",
|
|
178
177
|
typescript: "^5.5.4",
|
|
179
178
|
vitest: "^2.0.5",
|
|
180
|
-
vue: "^3.4.
|
|
179
|
+
vue: "^3.4.38"
|
|
181
180
|
},
|
|
182
181
|
resolutions: {
|
|
182
|
+
"@eslint-community/eslint-utils": "^4.4.0",
|
|
183
|
+
"@typescript-eslint/utils": "^8.2.0",
|
|
183
184
|
tsx: "~4.17.0"
|
|
184
185
|
},
|
|
185
186
|
"simple-git-hooks": {
|
|
186
187
|
"pre-commit": "npx lint-staged"
|
|
187
188
|
},
|
|
188
189
|
"lint-staged": {
|
|
189
|
-
"*": "eslint --fix"
|
|
190
|
+
"*": "eslint --flag unstable_ts_config --fix"
|
|
190
191
|
}
|
|
191
192
|
};
|
|
192
193
|
|
package/dist/index.cjs
CHANGED
|
@@ -74,6 +74,8 @@ __export(src_exports, {
|
|
|
74
74
|
imports: () => imports,
|
|
75
75
|
interopDefault: () => interopDefault,
|
|
76
76
|
isInEditorEnv: () => isInEditorEnv,
|
|
77
|
+
isInGitHooksOrLintStaged: () => isInGitHooksOrLintStaged,
|
|
78
|
+
isPackageInScope: () => isPackageInScope,
|
|
77
79
|
javascript: () => javascript,
|
|
78
80
|
jsdoc: () => jsdoc,
|
|
79
81
|
jsonc: () => jsonc,
|
|
@@ -103,6 +105,10 @@ __export(src_exports, {
|
|
|
103
105
|
});
|
|
104
106
|
module.exports = __toCommonJS(src_exports);
|
|
105
107
|
|
|
108
|
+
// node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.39_tsx@4.17.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
|
|
109
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
110
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
111
|
+
|
|
106
112
|
// src/factory.ts
|
|
107
113
|
var import_local_pkg4 = require("local-pkg");
|
|
108
114
|
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
@@ -189,7 +195,10 @@ var GLOB_EXCLUDE = [
|
|
|
189
195
|
|
|
190
196
|
// src/utils.ts
|
|
191
197
|
var import_node_process = __toESM(require("process"), 1);
|
|
198
|
+
var import_node_url = require("url");
|
|
192
199
|
var import_local_pkg = require("local-pkg");
|
|
200
|
+
var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
|
|
201
|
+
var isCwdInScope = (0, import_local_pkg.isPackageExists)("@antfu/eslint-config");
|
|
193
202
|
var parserPlain = {
|
|
194
203
|
meta: {
|
|
195
204
|
name: "parser-plain"
|
|
@@ -252,11 +261,14 @@ async function interopDefault(m) {
|
|
|
252
261
|
const resolved = await m;
|
|
253
262
|
return resolved.default || resolved;
|
|
254
263
|
}
|
|
264
|
+
function isPackageInScope(name) {
|
|
265
|
+
return (0, import_local_pkg.isPackageExists)(name, { paths: [scopeUrl] });
|
|
266
|
+
}
|
|
255
267
|
async function ensurePackages(packages) {
|
|
256
|
-
if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false) {
|
|
268
|
+
if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false || isCwdInScope === false) {
|
|
257
269
|
return;
|
|
258
270
|
}
|
|
259
|
-
const nonExistingPackages = packages.filter((i) => i && !(
|
|
271
|
+
const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
|
|
260
272
|
if (nonExistingPackages.length === 0) {
|
|
261
273
|
return;
|
|
262
274
|
}
|
|
@@ -268,8 +280,17 @@ async function ensurePackages(packages) {
|
|
|
268
280
|
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
269
281
|
}
|
|
270
282
|
}
|
|
283
|
+
function isInGitHooksOrLintStaged() {
|
|
284
|
+
return !!(import_node_process.default.env.GIT_PARAMS || import_node_process.default.env.VSCODE_GIT_COMMAND || import_node_process.default.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
285
|
+
}
|
|
271
286
|
function isInEditorEnv() {
|
|
272
|
-
|
|
287
|
+
if (import_node_process.default.env.CI) {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
if (isInGitHooksOrLintStaged()) {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
return !!(import_node_process.default.env.VSCODE_PID || import_node_process.default.env.VSCODE_CWD || import_node_process.default.env.JETBRAINS_IDE || import_node_process.default.env.VIM || import_node_process.default.env.NVIM);
|
|
273
294
|
}
|
|
274
295
|
|
|
275
296
|
// src/configs/astro.ts
|
|
@@ -346,7 +367,7 @@ async function command() {
|
|
|
346
367
|
|
|
347
368
|
// src/plugins.ts
|
|
348
369
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
349
|
-
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
370
|
+
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
350
371
|
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
351
372
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
352
373
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
@@ -432,13 +453,13 @@ async function stylistic(options = {}) {
|
|
|
432
453
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
433
454
|
if (options === true) {
|
|
434
455
|
options = {
|
|
435
|
-
astro: (
|
|
456
|
+
astro: isPackageInScope("prettier-plugin-astro"),
|
|
436
457
|
css: true,
|
|
437
458
|
graphql: true,
|
|
438
459
|
html: true,
|
|
439
460
|
markdown: true,
|
|
440
461
|
slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli"),
|
|
441
|
-
xml: (
|
|
462
|
+
xml: isPackageInScope("@prettier/plugin-xml")
|
|
442
463
|
};
|
|
443
464
|
}
|
|
444
465
|
await ensurePackages([
|
|
@@ -1873,6 +1894,7 @@ async function typescript(options = {}) {
|
|
|
1873
1894
|
const {
|
|
1874
1895
|
componentExts = [],
|
|
1875
1896
|
overrides = {},
|
|
1897
|
+
overridesTypeAware = {},
|
|
1876
1898
|
parserOptions = {},
|
|
1877
1899
|
type = "app"
|
|
1878
1900
|
} = options;
|
|
@@ -1951,8 +1973,8 @@ async function typescript(options = {}) {
|
|
|
1951
1973
|
},
|
|
1952
1974
|
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
|
1953
1975
|
...isTypeAware ? [
|
|
1954
|
-
makeParser(
|
|
1955
|
-
makeParser(
|
|
1976
|
+
makeParser(false, files),
|
|
1977
|
+
makeParser(true, filesTypeAware, ignoresTypeAware)
|
|
1956
1978
|
] : [makeParser(false, files)],
|
|
1957
1979
|
{
|
|
1958
1980
|
files,
|
|
@@ -2007,7 +2029,10 @@ async function typescript(options = {}) {
|
|
|
2007
2029
|
files: filesTypeAware,
|
|
2008
2030
|
ignores: ignoresTypeAware,
|
|
2009
2031
|
name: "antfu/typescript/rules-type-aware",
|
|
2010
|
-
rules:
|
|
2032
|
+
rules: {
|
|
2033
|
+
...typeAwareRules,
|
|
2034
|
+
...overridesTypeAware
|
|
2035
|
+
}
|
|
2011
2036
|
}] : [],
|
|
2012
2037
|
{
|
|
2013
2038
|
files: ["**/*.d.?([cm])ts"],
|
|
@@ -2398,7 +2423,6 @@ function dhzh(options = {}, ...userConfigs) {
|
|
|
2398
2423
|
autoRenamePlugins = true,
|
|
2399
2424
|
componentExts = [],
|
|
2400
2425
|
gitignore: enableGitignore = true,
|
|
2401
|
-
isInEditor = isInEditorEnv(),
|
|
2402
2426
|
jsx: enableJsx = true,
|
|
2403
2427
|
react: enableReact = false,
|
|
2404
2428
|
regexp: enableRegexp = true,
|
|
@@ -2408,6 +2432,13 @@ function dhzh(options = {}, ...userConfigs) {
|
|
|
2408
2432
|
unocss: enableUnoCSS = false,
|
|
2409
2433
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
2410
2434
|
} = options;
|
|
2435
|
+
let isInEditor = options.isInEditor;
|
|
2436
|
+
if (isInEditor == null) {
|
|
2437
|
+
isInEditor = isInEditorEnv();
|
|
2438
|
+
if (isInEditor) {
|
|
2439
|
+
console.log("[@antfu/eslint-config] Detected running in editor, some rules are disabled.");
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2411
2442
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2412
2443
|
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
2413
2444
|
stylisticOptions.jsx = enableJsx;
|
|
@@ -2626,6 +2657,8 @@ var src_default = dhzh;
|
|
|
2626
2657
|
imports,
|
|
2627
2658
|
interopDefault,
|
|
2628
2659
|
isInEditorEnv,
|
|
2660
|
+
isInGitHooksOrLintStaged,
|
|
2661
|
+
isPackageInScope,
|
|
2629
2662
|
javascript,
|
|
2630
2663
|
jsdoc,
|
|
2631
2664
|
jsonc,
|
package/dist/index.d.cts
CHANGED
|
@@ -605,47 +605,47 @@ interface RuleOptions {
|
|
|
605
605
|
'eqeqeq'?: Linter.RuleEntry<Eqeqeq>
|
|
606
606
|
/**
|
|
607
607
|
* require a `eslint-enable` comment for every `eslint-disable` comment
|
|
608
|
-
* @see https://
|
|
608
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair.html
|
|
609
609
|
*/
|
|
610
610
|
'eslint-comments/disable-enable-pair'?: Linter.RuleEntry<EslintCommentsDisableEnablePair>
|
|
611
611
|
/**
|
|
612
612
|
* disallow a `eslint-enable` comment for multiple `eslint-disable` comments
|
|
613
|
-
* @see https://
|
|
613
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-aggregating-enable.html
|
|
614
614
|
*/
|
|
615
615
|
'eslint-comments/no-aggregating-enable'?: Linter.RuleEntry<[]>
|
|
616
616
|
/**
|
|
617
617
|
* disallow duplicate `eslint-disable` comments
|
|
618
|
-
* @see https://
|
|
618
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-duplicate-disable.html
|
|
619
619
|
*/
|
|
620
620
|
'eslint-comments/no-duplicate-disable'?: Linter.RuleEntry<[]>
|
|
621
621
|
/**
|
|
622
622
|
* disallow `eslint-disable` comments about specific rules
|
|
623
|
-
* @see https://
|
|
623
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-restricted-disable.html
|
|
624
624
|
*/
|
|
625
625
|
'eslint-comments/no-restricted-disable'?: Linter.RuleEntry<EslintCommentsNoRestrictedDisable>
|
|
626
626
|
/**
|
|
627
627
|
* disallow `eslint-disable` comments without rule names
|
|
628
|
-
* @see https://
|
|
628
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unlimited-disable.html
|
|
629
629
|
*/
|
|
630
630
|
'eslint-comments/no-unlimited-disable'?: Linter.RuleEntry<[]>
|
|
631
631
|
/**
|
|
632
632
|
* disallow unused `eslint-disable` comments
|
|
633
|
-
* @see https://
|
|
633
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-disable.html
|
|
634
634
|
*/
|
|
635
635
|
'eslint-comments/no-unused-disable'?: Linter.RuleEntry<[]>
|
|
636
636
|
/**
|
|
637
637
|
* disallow unused `eslint-enable` comments
|
|
638
|
-
* @see https://
|
|
638
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-enable.html
|
|
639
639
|
*/
|
|
640
640
|
'eslint-comments/no-unused-enable'?: Linter.RuleEntry<[]>
|
|
641
641
|
/**
|
|
642
642
|
* disallow ESLint directive-comments
|
|
643
|
-
* @see https://
|
|
643
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-use.html
|
|
644
644
|
*/
|
|
645
645
|
'eslint-comments/no-use'?: Linter.RuleEntry<EslintCommentsNoUse>
|
|
646
646
|
/**
|
|
647
647
|
* require include descriptions in ESLint directive-comments
|
|
648
|
-
* @see https://
|
|
648
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/require-description.html
|
|
649
649
|
*/
|
|
650
650
|
'eslint-comments/require-description'?: Linter.RuleEntry<EslintCommentsRequireDescription>
|
|
651
651
|
/**
|
|
@@ -3007,12 +3007,12 @@ interface RuleOptions {
|
|
|
3007
3007
|
'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
|
|
3008
3008
|
'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>
|
|
3009
3009
|
/**
|
|
3010
|
-
*
|
|
3010
|
+
* disallow using shorthand boolean attributes
|
|
3011
3011
|
* @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
|
|
3012
3012
|
*/
|
|
3013
3013
|
'react/avoid-shorthand-boolean'?: Linter.RuleEntry<[]>
|
|
3014
3014
|
/**
|
|
3015
|
-
*
|
|
3015
|
+
* disallow using shorthand fragment syntax
|
|
3016
3016
|
* @see https://eslint-react.xyz/docs/rules/avoid-shorthand-fragment
|
|
3017
3017
|
*/
|
|
3018
3018
|
'react/avoid-shorthand-fragment'?: Linter.RuleEntry<[]>
|
|
@@ -5413,7 +5413,7 @@ interface RuleOptions {
|
|
|
5413
5413
|
*/
|
|
5414
5414
|
'ts/no-unnecessary-type-constraint'?: Linter.RuleEntry<[]>
|
|
5415
5415
|
/**
|
|
5416
|
-
* Disallow type parameters that
|
|
5416
|
+
* Disallow type parameters that aren't used multiple times
|
|
5417
5417
|
* @see https://typescript-eslint.io/rules/no-unnecessary-type-parameters
|
|
5418
5418
|
*/
|
|
5419
5419
|
'ts/no-unnecessary-type-parameters'?: Linter.RuleEntry<[]>
|
|
@@ -5676,7 +5676,7 @@ interface RuleOptions {
|
|
|
5676
5676
|
*/
|
|
5677
5677
|
'ts/unified-signatures'?: Linter.RuleEntry<TsUnifiedSignatures>
|
|
5678
5678
|
/**
|
|
5679
|
-
* Enforce typing arguments in
|
|
5679
|
+
* Enforce typing arguments in Promise rejection callbacks as `unknown`
|
|
5680
5680
|
* @see https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
|
|
5681
5681
|
*/
|
|
5682
5682
|
'ts/use-unknown-in-catch-callback-variable'?: Linter.RuleEntry<[]>
|
|
@@ -7801,24 +7801,25 @@ type AccessorPairs = []|[{
|
|
|
7801
7801
|
// ----- antfu/consistent-list-newline -----
|
|
7802
7802
|
type AntfuConsistentListNewline = []|[{
|
|
7803
7803
|
ArrayExpression?: boolean
|
|
7804
|
+
ArrayPattern?: boolean
|
|
7804
7805
|
ArrowFunctionExpression?: boolean
|
|
7805
7806
|
CallExpression?: boolean
|
|
7806
7807
|
ExportNamedDeclaration?: boolean
|
|
7807
7808
|
FunctionDeclaration?: boolean
|
|
7808
7809
|
FunctionExpression?: boolean
|
|
7809
7810
|
ImportDeclaration?: boolean
|
|
7811
|
+
JSONArrayExpression?: boolean
|
|
7812
|
+
JSONObjectExpression?: boolean
|
|
7813
|
+
JSXOpeningElement?: boolean
|
|
7810
7814
|
NewExpression?: boolean
|
|
7811
7815
|
ObjectExpression?: boolean
|
|
7816
|
+
ObjectPattern?: boolean
|
|
7817
|
+
TSFunctionType?: boolean
|
|
7812
7818
|
TSInterfaceDeclaration?: boolean
|
|
7813
7819
|
TSTupleType?: boolean
|
|
7814
7820
|
TSTypeLiteral?: boolean
|
|
7815
7821
|
TSTypeParameterDeclaration?: boolean
|
|
7816
7822
|
TSTypeParameterInstantiation?: boolean
|
|
7817
|
-
ObjectPattern?: boolean
|
|
7818
|
-
ArrayPattern?: boolean
|
|
7819
|
-
JSXOpeningElement?: boolean
|
|
7820
|
-
JSONArrayExpression?: boolean
|
|
7821
|
-
JSONObjectExpression?: boolean
|
|
7822
7823
|
}]
|
|
7823
7824
|
// ----- antfu/indent-unindent -----
|
|
7824
7825
|
type AntfuIndentUnindent = []|[{
|
|
@@ -9825,18 +9826,11 @@ type NoRestrictedImports = ((string | {
|
|
|
9825
9826
|
importNames?: string[]
|
|
9826
9827
|
allowImportNames?: string[]
|
|
9827
9828
|
})[]
|
|
9828
|
-
patterns?: (string[] | {
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
group: [string, ...(string)[]]
|
|
9835
|
-
importNamePattern?: string
|
|
9836
|
-
allowImportNamePattern?: string
|
|
9837
|
-
message?: string
|
|
9838
|
-
caseSensitive?: boolean
|
|
9839
|
-
}[])
|
|
9829
|
+
patterns?: (string[] | ({
|
|
9830
|
+
[k: string]: unknown | undefined
|
|
9831
|
+
} | {
|
|
9832
|
+
[k: string]: unknown | undefined
|
|
9833
|
+
})[])
|
|
9840
9834
|
}])
|
|
9841
9835
|
// ----- no-restricted-modules -----
|
|
9842
9836
|
type NoRestrictedModules = ((string | {
|
|
@@ -10373,6 +10367,10 @@ type PerfectionistSortEnums = []|[{
|
|
|
10373
10367
|
|
|
10374
10368
|
ignoreCase?: boolean
|
|
10375
10369
|
|
|
10370
|
+
sortByValue?: boolean
|
|
10371
|
+
|
|
10372
|
+
forceNumericSort?: boolean
|
|
10373
|
+
|
|
10376
10374
|
partitionByComment?: (string[] | boolean | string)
|
|
10377
10375
|
}]
|
|
10378
10376
|
// ----- perfectionist/sort-exports -----
|
|
@@ -10675,6 +10673,9 @@ type ReactHooksExhaustiveDeps = []|[{
|
|
|
10675
10673
|
}]
|
|
10676
10674
|
// ----- react-naming-convention/component-name -----
|
|
10677
10675
|
type ReactNamingConventionComponentName = []|[(("PascalCase" | "CONSTANT_CASE") | {
|
|
10676
|
+
allowAllCaps?: boolean
|
|
10677
|
+
allowLeadingUnderscore?: boolean
|
|
10678
|
+
allowNamespace?: boolean
|
|
10678
10679
|
excepts?: string[]
|
|
10679
10680
|
rule?: ("PascalCase" | "CONSTANT_CASE")
|
|
10680
10681
|
})]
|
|
@@ -11843,7 +11844,7 @@ type StylePaddedBlocks = []|[(("always" | "never") | {
|
|
|
11843
11844
|
}]
|
|
11844
11845
|
// ----- style/padding-line-between-statements -----
|
|
11845
11846
|
type _StylePaddingLineBetweenStatementsPaddingType = ("any" | "never" | "always")
|
|
11846
|
-
type _StylePaddingLineBetweenStatementsStatementType = (("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload") | [("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload"), ...(("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload"))[]])
|
|
11847
|
+
type _StylePaddingLineBetweenStatementsStatementType = (("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "ts-method" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload") | [("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "ts-method" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload"), ...(("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "ts-method" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload"))[]])
|
|
11847
11848
|
type StylePaddingLineBetweenStatements = {
|
|
11848
11849
|
blankLine: _StylePaddingLineBetweenStatementsPaddingType
|
|
11849
11850
|
prev: _StylePaddingLineBetweenStatementsStatementType
|
|
@@ -12156,6 +12157,7 @@ type TestNoLargeSnapshots = []|[{
|
|
|
12156
12157
|
type TestNoOnlyTests = []|[{
|
|
12157
12158
|
block?: string[]
|
|
12158
12159
|
focus?: string[]
|
|
12160
|
+
functions?: string[]
|
|
12159
12161
|
fix?: boolean
|
|
12160
12162
|
}]
|
|
12161
12163
|
// ----- test/no-restricted-matchers -----
|
|
@@ -12924,6 +12926,7 @@ type TsNoMisusedPromises = []|[{
|
|
|
12924
12926
|
checksVoidReturn?: (boolean | {
|
|
12925
12927
|
arguments?: boolean
|
|
12926
12928
|
attributes?: boolean
|
|
12929
|
+
inheritedMethods?: boolean
|
|
12927
12930
|
properties?: boolean
|
|
12928
12931
|
returns?: boolean
|
|
12929
12932
|
variables?: boolean
|
|
@@ -12972,7 +12975,8 @@ type TsNoRestrictedImports = ((string | {
|
|
|
12972
12975
|
|
|
12973
12976
|
allowImportNames?: [string, ...(string)[]]
|
|
12974
12977
|
|
|
12975
|
-
group
|
|
12978
|
+
group?: [string, ...(string)[]]
|
|
12979
|
+
regex?: string
|
|
12976
12980
|
importNamePattern?: string
|
|
12977
12981
|
allowImportNamePattern?: string
|
|
12978
12982
|
message?: string
|
|
@@ -15051,6 +15055,10 @@ interface OptionsTypeScriptWithTypes {
|
|
|
15051
15055
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
15052
15056
|
*/
|
|
15053
15057
|
tsconfigPath?: string;
|
|
15058
|
+
/**
|
|
15059
|
+
* Override type aware rules.
|
|
15060
|
+
*/
|
|
15061
|
+
overridesTypeAware?: TypedFlatConfigItem['rules'];
|
|
15054
15062
|
}
|
|
15055
15063
|
interface OptionsHasTypeScript {
|
|
15056
15064
|
typescript?: boolean;
|
|
@@ -15472,7 +15480,9 @@ declare function toArray<T>(value: T | T[]): T[];
|
|
|
15472
15480
|
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
15473
15481
|
default: infer U;
|
|
15474
15482
|
} ? U : T>;
|
|
15483
|
+
declare function isPackageInScope(name: string): boolean;
|
|
15475
15484
|
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
15485
|
+
declare function isInGitHooksOrLintStaged(): boolean;
|
|
15476
15486
|
declare function isInEditorEnv(): boolean;
|
|
15477
15487
|
|
|
15478
|
-
export { type Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsProjectType, type OptionsRegExp, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, astro, combine, command, comments, dhzh as default, defaultPluginRenaming, dhzh, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
15488
|
+
export { type Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsProjectType, type OptionsRegExp, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, astro, combine, command, comments, dhzh as default, defaultPluginRenaming, dhzh, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -605,47 +605,47 @@ interface RuleOptions {
|
|
|
605
605
|
'eqeqeq'?: Linter.RuleEntry<Eqeqeq>
|
|
606
606
|
/**
|
|
607
607
|
* require a `eslint-enable` comment for every `eslint-disable` comment
|
|
608
|
-
* @see https://
|
|
608
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair.html
|
|
609
609
|
*/
|
|
610
610
|
'eslint-comments/disable-enable-pair'?: Linter.RuleEntry<EslintCommentsDisableEnablePair>
|
|
611
611
|
/**
|
|
612
612
|
* disallow a `eslint-enable` comment for multiple `eslint-disable` comments
|
|
613
|
-
* @see https://
|
|
613
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-aggregating-enable.html
|
|
614
614
|
*/
|
|
615
615
|
'eslint-comments/no-aggregating-enable'?: Linter.RuleEntry<[]>
|
|
616
616
|
/**
|
|
617
617
|
* disallow duplicate `eslint-disable` comments
|
|
618
|
-
* @see https://
|
|
618
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-duplicate-disable.html
|
|
619
619
|
*/
|
|
620
620
|
'eslint-comments/no-duplicate-disable'?: Linter.RuleEntry<[]>
|
|
621
621
|
/**
|
|
622
622
|
* disallow `eslint-disable` comments about specific rules
|
|
623
|
-
* @see https://
|
|
623
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-restricted-disable.html
|
|
624
624
|
*/
|
|
625
625
|
'eslint-comments/no-restricted-disable'?: Linter.RuleEntry<EslintCommentsNoRestrictedDisable>
|
|
626
626
|
/**
|
|
627
627
|
* disallow `eslint-disable` comments without rule names
|
|
628
|
-
* @see https://
|
|
628
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unlimited-disable.html
|
|
629
629
|
*/
|
|
630
630
|
'eslint-comments/no-unlimited-disable'?: Linter.RuleEntry<[]>
|
|
631
631
|
/**
|
|
632
632
|
* disallow unused `eslint-disable` comments
|
|
633
|
-
* @see https://
|
|
633
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-disable.html
|
|
634
634
|
*/
|
|
635
635
|
'eslint-comments/no-unused-disable'?: Linter.RuleEntry<[]>
|
|
636
636
|
/**
|
|
637
637
|
* disallow unused `eslint-enable` comments
|
|
638
|
-
* @see https://
|
|
638
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-enable.html
|
|
639
639
|
*/
|
|
640
640
|
'eslint-comments/no-unused-enable'?: Linter.RuleEntry<[]>
|
|
641
641
|
/**
|
|
642
642
|
* disallow ESLint directive-comments
|
|
643
|
-
* @see https://
|
|
643
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-use.html
|
|
644
644
|
*/
|
|
645
645
|
'eslint-comments/no-use'?: Linter.RuleEntry<EslintCommentsNoUse>
|
|
646
646
|
/**
|
|
647
647
|
* require include descriptions in ESLint directive-comments
|
|
648
|
-
* @see https://
|
|
648
|
+
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/require-description.html
|
|
649
649
|
*/
|
|
650
650
|
'eslint-comments/require-description'?: Linter.RuleEntry<EslintCommentsRequireDescription>
|
|
651
651
|
/**
|
|
@@ -3007,12 +3007,12 @@ interface RuleOptions {
|
|
|
3007
3007
|
'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
|
|
3008
3008
|
'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>
|
|
3009
3009
|
/**
|
|
3010
|
-
*
|
|
3010
|
+
* disallow using shorthand boolean attributes
|
|
3011
3011
|
* @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
|
|
3012
3012
|
*/
|
|
3013
3013
|
'react/avoid-shorthand-boolean'?: Linter.RuleEntry<[]>
|
|
3014
3014
|
/**
|
|
3015
|
-
*
|
|
3015
|
+
* disallow using shorthand fragment syntax
|
|
3016
3016
|
* @see https://eslint-react.xyz/docs/rules/avoid-shorthand-fragment
|
|
3017
3017
|
*/
|
|
3018
3018
|
'react/avoid-shorthand-fragment'?: Linter.RuleEntry<[]>
|
|
@@ -5413,7 +5413,7 @@ interface RuleOptions {
|
|
|
5413
5413
|
*/
|
|
5414
5414
|
'ts/no-unnecessary-type-constraint'?: Linter.RuleEntry<[]>
|
|
5415
5415
|
/**
|
|
5416
|
-
* Disallow type parameters that
|
|
5416
|
+
* Disallow type parameters that aren't used multiple times
|
|
5417
5417
|
* @see https://typescript-eslint.io/rules/no-unnecessary-type-parameters
|
|
5418
5418
|
*/
|
|
5419
5419
|
'ts/no-unnecessary-type-parameters'?: Linter.RuleEntry<[]>
|
|
@@ -5676,7 +5676,7 @@ interface RuleOptions {
|
|
|
5676
5676
|
*/
|
|
5677
5677
|
'ts/unified-signatures'?: Linter.RuleEntry<TsUnifiedSignatures>
|
|
5678
5678
|
/**
|
|
5679
|
-
* Enforce typing arguments in
|
|
5679
|
+
* Enforce typing arguments in Promise rejection callbacks as `unknown`
|
|
5680
5680
|
* @see https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
|
|
5681
5681
|
*/
|
|
5682
5682
|
'ts/use-unknown-in-catch-callback-variable'?: Linter.RuleEntry<[]>
|
|
@@ -7801,24 +7801,25 @@ type AccessorPairs = []|[{
|
|
|
7801
7801
|
// ----- antfu/consistent-list-newline -----
|
|
7802
7802
|
type AntfuConsistentListNewline = []|[{
|
|
7803
7803
|
ArrayExpression?: boolean
|
|
7804
|
+
ArrayPattern?: boolean
|
|
7804
7805
|
ArrowFunctionExpression?: boolean
|
|
7805
7806
|
CallExpression?: boolean
|
|
7806
7807
|
ExportNamedDeclaration?: boolean
|
|
7807
7808
|
FunctionDeclaration?: boolean
|
|
7808
7809
|
FunctionExpression?: boolean
|
|
7809
7810
|
ImportDeclaration?: boolean
|
|
7811
|
+
JSONArrayExpression?: boolean
|
|
7812
|
+
JSONObjectExpression?: boolean
|
|
7813
|
+
JSXOpeningElement?: boolean
|
|
7810
7814
|
NewExpression?: boolean
|
|
7811
7815
|
ObjectExpression?: boolean
|
|
7816
|
+
ObjectPattern?: boolean
|
|
7817
|
+
TSFunctionType?: boolean
|
|
7812
7818
|
TSInterfaceDeclaration?: boolean
|
|
7813
7819
|
TSTupleType?: boolean
|
|
7814
7820
|
TSTypeLiteral?: boolean
|
|
7815
7821
|
TSTypeParameterDeclaration?: boolean
|
|
7816
7822
|
TSTypeParameterInstantiation?: boolean
|
|
7817
|
-
ObjectPattern?: boolean
|
|
7818
|
-
ArrayPattern?: boolean
|
|
7819
|
-
JSXOpeningElement?: boolean
|
|
7820
|
-
JSONArrayExpression?: boolean
|
|
7821
|
-
JSONObjectExpression?: boolean
|
|
7822
7823
|
}]
|
|
7823
7824
|
// ----- antfu/indent-unindent -----
|
|
7824
7825
|
type AntfuIndentUnindent = []|[{
|
|
@@ -9825,18 +9826,11 @@ type NoRestrictedImports = ((string | {
|
|
|
9825
9826
|
importNames?: string[]
|
|
9826
9827
|
allowImportNames?: string[]
|
|
9827
9828
|
})[]
|
|
9828
|
-
patterns?: (string[] | {
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
group: [string, ...(string)[]]
|
|
9835
|
-
importNamePattern?: string
|
|
9836
|
-
allowImportNamePattern?: string
|
|
9837
|
-
message?: string
|
|
9838
|
-
caseSensitive?: boolean
|
|
9839
|
-
}[])
|
|
9829
|
+
patterns?: (string[] | ({
|
|
9830
|
+
[k: string]: unknown | undefined
|
|
9831
|
+
} | {
|
|
9832
|
+
[k: string]: unknown | undefined
|
|
9833
|
+
})[])
|
|
9840
9834
|
}])
|
|
9841
9835
|
// ----- no-restricted-modules -----
|
|
9842
9836
|
type NoRestrictedModules = ((string | {
|
|
@@ -10373,6 +10367,10 @@ type PerfectionistSortEnums = []|[{
|
|
|
10373
10367
|
|
|
10374
10368
|
ignoreCase?: boolean
|
|
10375
10369
|
|
|
10370
|
+
sortByValue?: boolean
|
|
10371
|
+
|
|
10372
|
+
forceNumericSort?: boolean
|
|
10373
|
+
|
|
10376
10374
|
partitionByComment?: (string[] | boolean | string)
|
|
10377
10375
|
}]
|
|
10378
10376
|
// ----- perfectionist/sort-exports -----
|
|
@@ -10675,6 +10673,9 @@ type ReactHooksExhaustiveDeps = []|[{
|
|
|
10675
10673
|
}]
|
|
10676
10674
|
// ----- react-naming-convention/component-name -----
|
|
10677
10675
|
type ReactNamingConventionComponentName = []|[(("PascalCase" | "CONSTANT_CASE") | {
|
|
10676
|
+
allowAllCaps?: boolean
|
|
10677
|
+
allowLeadingUnderscore?: boolean
|
|
10678
|
+
allowNamespace?: boolean
|
|
10678
10679
|
excepts?: string[]
|
|
10679
10680
|
rule?: ("PascalCase" | "CONSTANT_CASE")
|
|
10680
10681
|
})]
|
|
@@ -11843,7 +11844,7 @@ type StylePaddedBlocks = []|[(("always" | "never") | {
|
|
|
11843
11844
|
}]
|
|
11844
11845
|
// ----- style/padding-line-between-statements -----
|
|
11845
11846
|
type _StylePaddingLineBetweenStatementsPaddingType = ("any" | "never" | "always")
|
|
11846
|
-
type _StylePaddingLineBetweenStatementsStatementType = (("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload") | [("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload"), ...(("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload"))[]])
|
|
11847
|
+
type _StylePaddingLineBetweenStatementsStatementType = (("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "ts-method" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload") | [("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "ts-method" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload"), ...(("*" | "block-like" | "exports" | "require" | "directive" | "expression" | "iife" | "multiline-block-like" | "multiline-expression" | "multiline-const" | "multiline-let" | "multiline-var" | "singleline-const" | "singleline-let" | "singleline-var" | "block" | "empty" | "function" | "ts-method" | "break" | "case" | "class" | "const" | "continue" | "debugger" | "default" | "do" | "export" | "for" | "if" | "import" | "let" | "return" | "switch" | "throw" | "try" | "var" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "type" | "function-overload"))[]])
|
|
11847
11848
|
type StylePaddingLineBetweenStatements = {
|
|
11848
11849
|
blankLine: _StylePaddingLineBetweenStatementsPaddingType
|
|
11849
11850
|
prev: _StylePaddingLineBetweenStatementsStatementType
|
|
@@ -12156,6 +12157,7 @@ type TestNoLargeSnapshots = []|[{
|
|
|
12156
12157
|
type TestNoOnlyTests = []|[{
|
|
12157
12158
|
block?: string[]
|
|
12158
12159
|
focus?: string[]
|
|
12160
|
+
functions?: string[]
|
|
12159
12161
|
fix?: boolean
|
|
12160
12162
|
}]
|
|
12161
12163
|
// ----- test/no-restricted-matchers -----
|
|
@@ -12924,6 +12926,7 @@ type TsNoMisusedPromises = []|[{
|
|
|
12924
12926
|
checksVoidReturn?: (boolean | {
|
|
12925
12927
|
arguments?: boolean
|
|
12926
12928
|
attributes?: boolean
|
|
12929
|
+
inheritedMethods?: boolean
|
|
12927
12930
|
properties?: boolean
|
|
12928
12931
|
returns?: boolean
|
|
12929
12932
|
variables?: boolean
|
|
@@ -12972,7 +12975,8 @@ type TsNoRestrictedImports = ((string | {
|
|
|
12972
12975
|
|
|
12973
12976
|
allowImportNames?: [string, ...(string)[]]
|
|
12974
12977
|
|
|
12975
|
-
group
|
|
12978
|
+
group?: [string, ...(string)[]]
|
|
12979
|
+
regex?: string
|
|
12976
12980
|
importNamePattern?: string
|
|
12977
12981
|
allowImportNamePattern?: string
|
|
12978
12982
|
message?: string
|
|
@@ -15051,6 +15055,10 @@ interface OptionsTypeScriptWithTypes {
|
|
|
15051
15055
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
15052
15056
|
*/
|
|
15053
15057
|
tsconfigPath?: string;
|
|
15058
|
+
/**
|
|
15059
|
+
* Override type aware rules.
|
|
15060
|
+
*/
|
|
15061
|
+
overridesTypeAware?: TypedFlatConfigItem['rules'];
|
|
15054
15062
|
}
|
|
15055
15063
|
interface OptionsHasTypeScript {
|
|
15056
15064
|
typescript?: boolean;
|
|
@@ -15472,7 +15480,9 @@ declare function toArray<T>(value: T | T[]): T[];
|
|
|
15472
15480
|
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
15473
15481
|
default: infer U;
|
|
15474
15482
|
} ? U : T>;
|
|
15483
|
+
declare function isPackageInScope(name: string): boolean;
|
|
15475
15484
|
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
15485
|
+
declare function isInGitHooksOrLintStaged(): boolean;
|
|
15476
15486
|
declare function isInEditorEnv(): boolean;
|
|
15477
15487
|
|
|
15478
|
-
export { type Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsProjectType, type OptionsRegExp, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, astro, combine, command, comments, dhzh as default, defaultPluginRenaming, dhzh, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
15488
|
+
export { type Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsProjectType, type OptionsRegExp, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, astro, combine, command, comments, dhzh as default, defaultPluginRenaming, dhzh, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.js
CHANGED
|
@@ -84,7 +84,10 @@ var GLOB_EXCLUDE = [
|
|
|
84
84
|
|
|
85
85
|
// src/utils.ts
|
|
86
86
|
import process from "node:process";
|
|
87
|
+
import { fileURLToPath } from "node:url";
|
|
87
88
|
import { isPackageExists } from "local-pkg";
|
|
89
|
+
var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
90
|
+
var isCwdInScope = isPackageExists("@antfu/eslint-config");
|
|
88
91
|
var parserPlain = {
|
|
89
92
|
meta: {
|
|
90
93
|
name: "parser-plain"
|
|
@@ -147,11 +150,14 @@ async function interopDefault(m) {
|
|
|
147
150
|
const resolved = await m;
|
|
148
151
|
return resolved.default || resolved;
|
|
149
152
|
}
|
|
153
|
+
function isPackageInScope(name) {
|
|
154
|
+
return isPackageExists(name, { paths: [scopeUrl] });
|
|
155
|
+
}
|
|
150
156
|
async function ensurePackages(packages) {
|
|
151
|
-
if (process.env.CI || process.stdout.isTTY === false) {
|
|
157
|
+
if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false) {
|
|
152
158
|
return;
|
|
153
159
|
}
|
|
154
|
-
const nonExistingPackages = packages.filter((i) => i && !
|
|
160
|
+
const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
|
|
155
161
|
if (nonExistingPackages.length === 0) {
|
|
156
162
|
return;
|
|
157
163
|
}
|
|
@@ -163,8 +169,17 @@ async function ensurePackages(packages) {
|
|
|
163
169
|
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
164
170
|
}
|
|
165
171
|
}
|
|
172
|
+
function isInGitHooksOrLintStaged() {
|
|
173
|
+
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
174
|
+
}
|
|
166
175
|
function isInEditorEnv() {
|
|
167
|
-
|
|
176
|
+
if (process.env.CI) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
if (isInGitHooksOrLintStaged()) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
|
|
168
183
|
}
|
|
169
184
|
|
|
170
185
|
// src/configs/astro.ts
|
|
@@ -241,7 +256,7 @@ async function command() {
|
|
|
241
256
|
|
|
242
257
|
// src/plugins.ts
|
|
243
258
|
import { default as default2 } from "eslint-plugin-antfu";
|
|
244
|
-
import { default as default3 } from "eslint-plugin-eslint-comments";
|
|
259
|
+
import { default as default3 } from "@eslint-community/eslint-plugin-eslint-comments";
|
|
245
260
|
import * as pluginImport from "eslint-plugin-import-x";
|
|
246
261
|
import { default as default4 } from "eslint-plugin-n";
|
|
247
262
|
import { default as default5 } from "eslint-plugin-unicorn";
|
|
@@ -327,13 +342,13 @@ async function stylistic(options = {}) {
|
|
|
327
342
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
328
343
|
if (options === true) {
|
|
329
344
|
options = {
|
|
330
|
-
astro:
|
|
345
|
+
astro: isPackageInScope("prettier-plugin-astro"),
|
|
331
346
|
css: true,
|
|
332
347
|
graphql: true,
|
|
333
348
|
html: true,
|
|
334
349
|
markdown: true,
|
|
335
350
|
slidev: isPackageExists2("@slidev/cli"),
|
|
336
|
-
xml:
|
|
351
|
+
xml: isPackageInScope("@prettier/plugin-xml")
|
|
337
352
|
};
|
|
338
353
|
}
|
|
339
354
|
await ensurePackages([
|
|
@@ -1768,6 +1783,7 @@ async function typescript(options = {}) {
|
|
|
1768
1783
|
const {
|
|
1769
1784
|
componentExts = [],
|
|
1770
1785
|
overrides = {},
|
|
1786
|
+
overridesTypeAware = {},
|
|
1771
1787
|
parserOptions = {},
|
|
1772
1788
|
type = "app"
|
|
1773
1789
|
} = options;
|
|
@@ -1846,8 +1862,8 @@ async function typescript(options = {}) {
|
|
|
1846
1862
|
},
|
|
1847
1863
|
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
|
1848
1864
|
...isTypeAware ? [
|
|
1849
|
-
makeParser(
|
|
1850
|
-
makeParser(
|
|
1865
|
+
makeParser(false, files),
|
|
1866
|
+
makeParser(true, filesTypeAware, ignoresTypeAware)
|
|
1851
1867
|
] : [makeParser(false, files)],
|
|
1852
1868
|
{
|
|
1853
1869
|
files,
|
|
@@ -1902,7 +1918,10 @@ async function typescript(options = {}) {
|
|
|
1902
1918
|
files: filesTypeAware,
|
|
1903
1919
|
ignores: ignoresTypeAware,
|
|
1904
1920
|
name: "antfu/typescript/rules-type-aware",
|
|
1905
|
-
rules:
|
|
1921
|
+
rules: {
|
|
1922
|
+
...typeAwareRules,
|
|
1923
|
+
...overridesTypeAware
|
|
1924
|
+
}
|
|
1906
1925
|
}] : [],
|
|
1907
1926
|
{
|
|
1908
1927
|
files: ["**/*.d.?([cm])ts"],
|
|
@@ -2293,7 +2312,6 @@ function dhzh(options = {}, ...userConfigs) {
|
|
|
2293
2312
|
autoRenamePlugins = true,
|
|
2294
2313
|
componentExts = [],
|
|
2295
2314
|
gitignore: enableGitignore = true,
|
|
2296
|
-
isInEditor = isInEditorEnv(),
|
|
2297
2315
|
jsx: enableJsx = true,
|
|
2298
2316
|
react: enableReact = false,
|
|
2299
2317
|
regexp: enableRegexp = true,
|
|
@@ -2303,6 +2321,13 @@ function dhzh(options = {}, ...userConfigs) {
|
|
|
2303
2321
|
unocss: enableUnoCSS = false,
|
|
2304
2322
|
vue: enableVue = VuePackages.some((i) => isPackageExists4(i))
|
|
2305
2323
|
} = options;
|
|
2324
|
+
let isInEditor = options.isInEditor;
|
|
2325
|
+
if (isInEditor == null) {
|
|
2326
|
+
isInEditor = isInEditorEnv();
|
|
2327
|
+
if (isInEditor) {
|
|
2328
|
+
console.log("[@antfu/eslint-config] Detected running in editor, some rules are disabled.");
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2306
2331
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2307
2332
|
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
2308
2333
|
stylisticOptions.jsx = enableJsx;
|
|
@@ -2521,6 +2546,8 @@ export {
|
|
|
2521
2546
|
imports,
|
|
2522
2547
|
interopDefault,
|
|
2523
2548
|
isInEditorEnv,
|
|
2549
|
+
isInGitHooksOrLintStaged,
|
|
2550
|
+
isPackageInScope,
|
|
2524
2551
|
javascript,
|
|
2525
2552
|
jsdoc,
|
|
2526
2553
|
jsonc,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhzh/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.4",
|
|
5
5
|
"description": "Easton's ESLint config",
|
|
6
6
|
"author": "Easton Zheng <dhzhme@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -69,28 +69,28 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@antfu/install-pkg": "^0.
|
|
72
|
+
"@antfu/install-pkg": "^0.4.0",
|
|
73
73
|
"@clack/prompts": "^0.7.0",
|
|
74
|
-
"@eslint-
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
77
|
-
"@typescript-eslint/
|
|
78
|
-
"@
|
|
74
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
75
|
+
"@eslint-react/eslint-plugin": "^1.12.1",
|
|
76
|
+
"@stylistic/eslint-plugin": "^2.6.4",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^8.2.0",
|
|
78
|
+
"@typescript-eslint/parser": "^8.2.0",
|
|
79
|
+
"@vitest/eslint-plugin": "^1.0.3",
|
|
79
80
|
"eslint-config-flat-gitignore": "^0.1.8",
|
|
80
|
-
"eslint-flat-config-utils": "^0.3.
|
|
81
|
+
"eslint-flat-config-utils": "^0.3.1",
|
|
81
82
|
"eslint-merge-processors": "^0.1.0",
|
|
82
|
-
"eslint-plugin-antfu": "^2.3.
|
|
83
|
+
"eslint-plugin-antfu": "^2.3.6",
|
|
83
84
|
"eslint-plugin-command": "^0.2.3",
|
|
84
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
85
85
|
"eslint-plugin-import-x": "^3.1.0",
|
|
86
|
-
"eslint-plugin-jsdoc": "^50.
|
|
86
|
+
"eslint-plugin-jsdoc": "^50.2.2",
|
|
87
87
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
88
88
|
"eslint-plugin-markdown": "^5.1.0",
|
|
89
89
|
"eslint-plugin-n": "^17.10.2",
|
|
90
|
-
"eslint-plugin-no-only-tests": "^3.
|
|
91
|
-
"eslint-plugin-perfectionist": "^3.
|
|
90
|
+
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
91
|
+
"eslint-plugin-perfectionist": "^3.2.0",
|
|
92
92
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
93
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
93
|
+
"eslint-plugin-react-refresh": "^0.4.11",
|
|
94
94
|
"eslint-plugin-regexp": "^2.6.0",
|
|
95
95
|
"eslint-plugin-toml": "^0.11.1",
|
|
96
96
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
@@ -109,31 +109,31 @@
|
|
|
109
109
|
"yargs": "^17.7.2"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
|
-
"@antfu/ni": "^0.22.
|
|
113
|
-
"@eslint/config-inspector": "^0.5.
|
|
112
|
+
"@antfu/ni": "^0.22.4",
|
|
113
|
+
"@eslint/config-inspector": "^0.5.4",
|
|
114
114
|
"@prettier/plugin-xml": "^3.4.1",
|
|
115
|
-
"@stylistic/eslint-plugin-migrate": "^2.6.
|
|
115
|
+
"@stylistic/eslint-plugin-migrate": "^2.6.4",
|
|
116
116
|
"@types/eslint": "^9.6.0",
|
|
117
117
|
"@types/fs-extra": "^11.0.4",
|
|
118
|
-
"@types/node": "^22.
|
|
118
|
+
"@types/node": "^22.5.0",
|
|
119
119
|
"@types/prompts": "^2.4.9",
|
|
120
120
|
"@types/yargs": "^17.0.33",
|
|
121
|
-
"@unocss/eslint-plugin": "^0.
|
|
121
|
+
"@unocss/eslint-plugin": "^0.62.2",
|
|
122
122
|
"astro-eslint-parser": "^1.0.2",
|
|
123
|
-
"bumpp": "^9.
|
|
123
|
+
"bumpp": "^9.5.2",
|
|
124
124
|
"bundle-require": "^5.0.0",
|
|
125
|
-
"eslint": "
|
|
125
|
+
"eslint": "^9.9.0",
|
|
126
126
|
"eslint-plugin-astro": "^1.2.3",
|
|
127
127
|
"eslint-plugin-format": "^0.1.2",
|
|
128
|
-
"eslint-plugin-solid": "^0.14.
|
|
128
|
+
"eslint-plugin-solid": "^0.14.2",
|
|
129
129
|
"eslint-plugin-svelte": "^2.43.0",
|
|
130
|
-
"eslint-
|
|
131
|
-
"eslint-typegen": "^0.3.0",
|
|
130
|
+
"eslint-typegen": "^0.3.1",
|
|
132
131
|
"esno": "^4.7.0",
|
|
133
|
-
"execa": "^9.3.
|
|
132
|
+
"execa": "^9.3.1",
|
|
134
133
|
"fast-glob": "^3.3.2",
|
|
135
134
|
"fs-extra": "^11.2.0",
|
|
136
|
-
"
|
|
135
|
+
"jiti": "^1.21.6",
|
|
136
|
+
"lint-staged": "^15.2.9",
|
|
137
137
|
"prettier-plugin-astro": "^0.14.1",
|
|
138
138
|
"prettier-plugin-slidev": "^1.0.5",
|
|
139
139
|
"rimraf": "^6.0.1",
|
|
@@ -144,17 +144,18 @@
|
|
|
144
144
|
"tsx": "^4.17.0",
|
|
145
145
|
"typescript": "^5.5.4",
|
|
146
146
|
"vitest": "^2.0.5",
|
|
147
|
-
"vue": "^3.4.
|
|
148
|
-
"@dhzh/eslint-config": "0.12.2"
|
|
147
|
+
"vue": "^3.4.38"
|
|
149
148
|
},
|
|
150
149
|
"resolutions": {
|
|
150
|
+
"@eslint-community/eslint-utils": "^4.4.0",
|
|
151
|
+
"@typescript-eslint/utils": "^8.2.0",
|
|
151
152
|
"tsx": "~4.17.0"
|
|
152
153
|
},
|
|
153
154
|
"simple-git-hooks": {
|
|
154
155
|
"pre-commit": "npx lint-staged"
|
|
155
156
|
},
|
|
156
157
|
"lint-staged": {
|
|
157
|
-
"*": "eslint --fix"
|
|
158
|
+
"*": "eslint --flag unstable_ts_config --fix"
|
|
158
159
|
},
|
|
159
160
|
"scripts": {
|
|
160
161
|
"build": "nr typegen && tsup --format esm,cjs --clean --dts",
|
|
@@ -162,7 +163,7 @@
|
|
|
162
163
|
"dev": "npx @eslint/config-inspector --config eslint.config.ts",
|
|
163
164
|
"build:inspector": "pnpm build && npx @eslint/config-inspector build",
|
|
164
165
|
"watch": "tsup --format esm,cjs --watch",
|
|
165
|
-
"lint": "eslint .",
|
|
166
|
+
"lint": "eslint --flag unstable_ts_config .",
|
|
166
167
|
"typegen": "esno scripts/typegen.ts",
|
|
167
168
|
"release": "bumpp && pnpm publish --access=public",
|
|
168
169
|
"typecheck": "tsc --noEmit"
|