@antfu/eslint-config 2.23.0 → 2.23.2
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/README.md +10 -10
- package/dist/cli.cjs +22 -22
- package/dist/cli.js +22 -22
- package/dist/index.cjs +7 -5
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +6 -5
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -114,16 +114,16 @@ Add the following settings to your `.vscode/settings.json`:
|
|
|
114
114
|
|
|
115
115
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
116
116
|
"eslint.rules.customizations": [
|
|
117
|
-
{ "rule": "style/*", "severity": "off" },
|
|
118
|
-
{ "rule": "format/*", "severity": "off" },
|
|
119
|
-
{ "rule": "*-indent", "severity": "off" },
|
|
120
|
-
{ "rule": "*-spacing", "severity": "off" },
|
|
121
|
-
{ "rule": "*-spaces", "severity": "off" },
|
|
122
|
-
{ "rule": "*-order", "severity": "off" },
|
|
123
|
-
{ "rule": "*-dangle", "severity": "off" },
|
|
124
|
-
{ "rule": "*-newline", "severity": "off" },
|
|
125
|
-
{ "rule": "*quotes", "severity": "off" },
|
|
126
|
-
{ "rule": "*semi", "severity": "off" }
|
|
117
|
+
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
118
|
+
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
119
|
+
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
120
|
+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
121
|
+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
122
|
+
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
123
|
+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
124
|
+
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
125
|
+
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
126
|
+
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
127
127
|
],
|
|
128
128
|
|
|
129
129
|
// Enable eslint for all supported languages
|
package/dist/cli.cjs
CHANGED
|
@@ -48,8 +48,8 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
48
48
|
var package_default = {
|
|
49
49
|
name: "@antfu/eslint-config",
|
|
50
50
|
type: "module",
|
|
51
|
-
version: "2.23.
|
|
52
|
-
packageManager: "pnpm@9.
|
|
51
|
+
version: "2.23.2",
|
|
52
|
+
packageManager: "pnpm@9.6.0",
|
|
53
53
|
description: "Anthony's ESLint config",
|
|
54
54
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
55
55
|
license: "MIT",
|
|
@@ -143,7 +143,6 @@ var package_default = {
|
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
dependencies: {
|
|
146
|
-
"@antfu/eslint-plugin-unused-imports": "^4.0.0",
|
|
147
146
|
"@antfu/install-pkg": "^0.3.3",
|
|
148
147
|
"@clack/prompts": "^0.7.0",
|
|
149
148
|
"@stylistic/eslint-plugin": "^2.6.0-beta.0",
|
|
@@ -156,7 +155,7 @@ var package_default = {
|
|
|
156
155
|
"eslint-plugin-command": "^0.2.3",
|
|
157
156
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
158
157
|
"eslint-plugin-import-x": "^3.0.1",
|
|
159
|
-
"eslint-plugin-jsdoc": "^48.
|
|
158
|
+
"eslint-plugin-jsdoc": "^48.8.3",
|
|
160
159
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
161
160
|
"eslint-plugin-markdown": "^5.1.0",
|
|
162
161
|
"eslint-plugin-n": "^17.9.0",
|
|
@@ -165,6 +164,7 @@ var package_default = {
|
|
|
165
164
|
"eslint-plugin-regexp": "^2.6.0",
|
|
166
165
|
"eslint-plugin-toml": "^0.11.1",
|
|
167
166
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
167
|
+
"eslint-plugin-unused-imports": "^4.0.1",
|
|
168
168
|
"eslint-plugin-vitest": "^0.5.4",
|
|
169
169
|
"eslint-plugin-vue": "^9.27.0",
|
|
170
170
|
"eslint-plugin-yml": "^1.14.0",
|
|
@@ -182,8 +182,8 @@ var package_default = {
|
|
|
182
182
|
devDependencies: {
|
|
183
183
|
"@antfu/eslint-config": "workspace:*",
|
|
184
184
|
"@antfu/ni": "^0.22.0",
|
|
185
|
-
"@eslint-react/eslint-plugin": "^1.5.
|
|
186
|
-
"@eslint/config-inspector": "^0.5.
|
|
185
|
+
"@eslint-react/eslint-plugin": "^1.5.30",
|
|
186
|
+
"@eslint/config-inspector": "^0.5.2",
|
|
187
187
|
"@prettier/plugin-xml": "^3.4.1",
|
|
188
188
|
"@stylistic/eslint-plugin-migrate": "^2.3.0",
|
|
189
189
|
"@types/eslint": "^8.56.10",
|
|
@@ -198,9 +198,9 @@ var package_default = {
|
|
|
198
198
|
"eslint-plugin-astro": "^1.2.3",
|
|
199
199
|
"eslint-plugin-format": "^0.1.2",
|
|
200
200
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
201
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
201
|
+
"eslint-plugin-react-refresh": "^0.4.9",
|
|
202
202
|
"eslint-plugin-solid": "^0.14.1",
|
|
203
|
-
"eslint-plugin-svelte": "^2.
|
|
203
|
+
"eslint-plugin-svelte": "^2.43.0",
|
|
204
204
|
"eslint-ts-patch": "9.5.0-0",
|
|
205
205
|
"eslint-typegen": "^0.2.4",
|
|
206
206
|
esno: "^4.7.0",
|
|
@@ -213,12 +213,12 @@ var package_default = {
|
|
|
213
213
|
rimraf: "^6.0.1",
|
|
214
214
|
"simple-git-hooks": "^2.11.1",
|
|
215
215
|
svelte: "^4.2.18",
|
|
216
|
-
"svelte-eslint-parser": "^0.
|
|
217
|
-
tsup: "^8.
|
|
216
|
+
"svelte-eslint-parser": "^0.41.0",
|
|
217
|
+
tsup: "^8.2.2",
|
|
218
218
|
tsx: "^4.16.2",
|
|
219
219
|
typescript: "^5.5.3",
|
|
220
|
-
vitest: "^2.0.
|
|
221
|
-
vue: "^3.4.
|
|
220
|
+
vitest: "^2.0.4",
|
|
221
|
+
vue: "^3.4.33"
|
|
222
222
|
},
|
|
223
223
|
resolutions: {
|
|
224
224
|
tsx: "~4.16.2"
|
|
@@ -245,16 +245,16 @@ var vscodeSettingsString = `
|
|
|
245
245
|
|
|
246
246
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
247
247
|
"eslint.rules.customizations": [
|
|
248
|
-
{ "rule": "style/*", "severity": "off" },
|
|
249
|
-
{ "rule": "format/*", "severity": "off" },
|
|
250
|
-
{ "rule": "*-indent", "severity": "off" },
|
|
251
|
-
{ "rule": "*-spacing", "severity": "off" },
|
|
252
|
-
{ "rule": "*-spaces", "severity": "off" },
|
|
253
|
-
{ "rule": "*-order", "severity": "off" },
|
|
254
|
-
{ "rule": "*-dangle", "severity": "off" },
|
|
255
|
-
{ "rule": "*-newline", "severity": "off" },
|
|
256
|
-
{ "rule": "*quotes", "severity": "off" },
|
|
257
|
-
{ "rule": "*semi", "severity": "off" }
|
|
248
|
+
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
249
|
+
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
250
|
+
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
251
|
+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
252
|
+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
253
|
+
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
254
|
+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
255
|
+
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
256
|
+
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
257
|
+
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
258
258
|
],
|
|
259
259
|
|
|
260
260
|
// Enable eslint for all supported languages
|
package/dist/cli.js
CHANGED
|
@@ -19,8 +19,8 @@ import c from "picocolors";
|
|
|
19
19
|
var package_default = {
|
|
20
20
|
name: "@antfu/eslint-config",
|
|
21
21
|
type: "module",
|
|
22
|
-
version: "2.23.
|
|
23
|
-
packageManager: "pnpm@9.
|
|
22
|
+
version: "2.23.2",
|
|
23
|
+
packageManager: "pnpm@9.6.0",
|
|
24
24
|
description: "Anthony's ESLint config",
|
|
25
25
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
26
26
|
license: "MIT",
|
|
@@ -114,7 +114,6 @@ var package_default = {
|
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
dependencies: {
|
|
117
|
-
"@antfu/eslint-plugin-unused-imports": "^4.0.0",
|
|
118
117
|
"@antfu/install-pkg": "^0.3.3",
|
|
119
118
|
"@clack/prompts": "^0.7.0",
|
|
120
119
|
"@stylistic/eslint-plugin": "^2.6.0-beta.0",
|
|
@@ -127,7 +126,7 @@ var package_default = {
|
|
|
127
126
|
"eslint-plugin-command": "^0.2.3",
|
|
128
127
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
129
128
|
"eslint-plugin-import-x": "^3.0.1",
|
|
130
|
-
"eslint-plugin-jsdoc": "^48.
|
|
129
|
+
"eslint-plugin-jsdoc": "^48.8.3",
|
|
131
130
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
132
131
|
"eslint-plugin-markdown": "^5.1.0",
|
|
133
132
|
"eslint-plugin-n": "^17.9.0",
|
|
@@ -136,6 +135,7 @@ var package_default = {
|
|
|
136
135
|
"eslint-plugin-regexp": "^2.6.0",
|
|
137
136
|
"eslint-plugin-toml": "^0.11.1",
|
|
138
137
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
138
|
+
"eslint-plugin-unused-imports": "^4.0.1",
|
|
139
139
|
"eslint-plugin-vitest": "^0.5.4",
|
|
140
140
|
"eslint-plugin-vue": "^9.27.0",
|
|
141
141
|
"eslint-plugin-yml": "^1.14.0",
|
|
@@ -153,8 +153,8 @@ var package_default = {
|
|
|
153
153
|
devDependencies: {
|
|
154
154
|
"@antfu/eslint-config": "workspace:*",
|
|
155
155
|
"@antfu/ni": "^0.22.0",
|
|
156
|
-
"@eslint-react/eslint-plugin": "^1.5.
|
|
157
|
-
"@eslint/config-inspector": "^0.5.
|
|
156
|
+
"@eslint-react/eslint-plugin": "^1.5.30",
|
|
157
|
+
"@eslint/config-inspector": "^0.5.2",
|
|
158
158
|
"@prettier/plugin-xml": "^3.4.1",
|
|
159
159
|
"@stylistic/eslint-plugin-migrate": "^2.3.0",
|
|
160
160
|
"@types/eslint": "^8.56.10",
|
|
@@ -169,9 +169,9 @@ var package_default = {
|
|
|
169
169
|
"eslint-plugin-astro": "^1.2.3",
|
|
170
170
|
"eslint-plugin-format": "^0.1.2",
|
|
171
171
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
172
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
172
|
+
"eslint-plugin-react-refresh": "^0.4.9",
|
|
173
173
|
"eslint-plugin-solid": "^0.14.1",
|
|
174
|
-
"eslint-plugin-svelte": "^2.
|
|
174
|
+
"eslint-plugin-svelte": "^2.43.0",
|
|
175
175
|
"eslint-ts-patch": "9.5.0-0",
|
|
176
176
|
"eslint-typegen": "^0.2.4",
|
|
177
177
|
esno: "^4.7.0",
|
|
@@ -184,12 +184,12 @@ var package_default = {
|
|
|
184
184
|
rimraf: "^6.0.1",
|
|
185
185
|
"simple-git-hooks": "^2.11.1",
|
|
186
186
|
svelte: "^4.2.18",
|
|
187
|
-
"svelte-eslint-parser": "^0.
|
|
188
|
-
tsup: "^8.
|
|
187
|
+
"svelte-eslint-parser": "^0.41.0",
|
|
188
|
+
tsup: "^8.2.2",
|
|
189
189
|
tsx: "^4.16.2",
|
|
190
190
|
typescript: "^5.5.3",
|
|
191
|
-
vitest: "^2.0.
|
|
192
|
-
vue: "^3.4.
|
|
191
|
+
vitest: "^2.0.4",
|
|
192
|
+
vue: "^3.4.33"
|
|
193
193
|
},
|
|
194
194
|
resolutions: {
|
|
195
195
|
tsx: "~4.16.2"
|
|
@@ -216,16 +216,16 @@ var vscodeSettingsString = `
|
|
|
216
216
|
|
|
217
217
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
218
218
|
"eslint.rules.customizations": [
|
|
219
|
-
{ "rule": "style/*", "severity": "off" },
|
|
220
|
-
{ "rule": "format/*", "severity": "off" },
|
|
221
|
-
{ "rule": "*-indent", "severity": "off" },
|
|
222
|
-
{ "rule": "*-spacing", "severity": "off" },
|
|
223
|
-
{ "rule": "*-spaces", "severity": "off" },
|
|
224
|
-
{ "rule": "*-order", "severity": "off" },
|
|
225
|
-
{ "rule": "*-dangle", "severity": "off" },
|
|
226
|
-
{ "rule": "*-newline", "severity": "off" },
|
|
227
|
-
{ "rule": "*quotes", "severity": "off" },
|
|
228
|
-
{ "rule": "*semi", "severity": "off" }
|
|
219
|
+
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
220
|
+
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
221
|
+
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
222
|
+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
223
|
+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
224
|
+
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
225
|
+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
226
|
+
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
227
|
+
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
228
|
+
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
229
229
|
],
|
|
230
230
|
|
|
231
231
|
// Enable eslint for all supported languages
|
package/dist/index.cjs
CHANGED
|
@@ -73,6 +73,7 @@ __export(src_exports, {
|
|
|
73
73
|
ignores: () => ignores,
|
|
74
74
|
imports: () => imports,
|
|
75
75
|
interopDefault: () => interopDefault,
|
|
76
|
+
isInEditorEnv: () => isInEditorEnv,
|
|
76
77
|
javascript: () => javascript,
|
|
77
78
|
jsdoc: () => jsdoc,
|
|
78
79
|
jsonc: () => jsonc,
|
|
@@ -103,7 +104,6 @@ __export(src_exports, {
|
|
|
103
104
|
module.exports = __toCommonJS(src_exports);
|
|
104
105
|
|
|
105
106
|
// src/factory.ts
|
|
106
|
-
var import_node_process3 = __toESM(require("process"), 1);
|
|
107
107
|
var import_local_pkg4 = require("local-pkg");
|
|
108
108
|
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
109
109
|
|
|
@@ -262,6 +262,9 @@ async function ensurePackages(packages) {
|
|
|
262
262
|
if (result)
|
|
263
263
|
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
264
264
|
}
|
|
265
|
+
function isInEditorEnv() {
|
|
266
|
+
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) && !import_node_process.default.env.CI);
|
|
267
|
+
}
|
|
265
268
|
|
|
266
269
|
// src/configs/astro.ts
|
|
267
270
|
async function astro(options = {}) {
|
|
@@ -341,7 +344,7 @@ var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint
|
|
|
341
344
|
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
342
345
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
343
346
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
344
|
-
var import_eslint_plugin_unused_imports = __toESM(require("
|
|
347
|
+
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
345
348
|
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
346
349
|
|
|
347
350
|
// src/configs/comments.ts
|
|
@@ -1717,7 +1720,6 @@ async function svelte(options = {}) {
|
|
|
1717
1720
|
"svelte/no-useless-mustaches": "error",
|
|
1718
1721
|
"svelte/require-store-callbacks-use-set-param": "error",
|
|
1719
1722
|
"svelte/system": "error",
|
|
1720
|
-
"svelte/valid-compile": "error",
|
|
1721
1723
|
"svelte/valid-each-key": "error",
|
|
1722
1724
|
"unused-imports/no-unused-vars": [
|
|
1723
1725
|
"error",
|
|
@@ -1985,7 +1987,6 @@ async function typescript(options = {}) {
|
|
|
1985
1987
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1986
1988
|
"ts/no-useless-constructor": "off",
|
|
1987
1989
|
"ts/no-wrapper-object-types": "error",
|
|
1988
|
-
"ts/prefer-ts-expect-error": "error",
|
|
1989
1990
|
"ts/triple-slash-reference": "off",
|
|
1990
1991
|
"ts/unified-signatures": "off",
|
|
1991
1992
|
...type === "lib" ? {
|
|
@@ -2392,7 +2393,7 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2392
2393
|
autoRenamePlugins = true,
|
|
2393
2394
|
componentExts = [],
|
|
2394
2395
|
gitignore: enableGitignore = true,
|
|
2395
|
-
isInEditor =
|
|
2396
|
+
isInEditor = isInEditorEnv(),
|
|
2396
2397
|
jsx: enableJsx = true,
|
|
2397
2398
|
react: enableReact = false,
|
|
2398
2399
|
regexp: enableRegexp = true,
|
|
@@ -2616,6 +2617,7 @@ var src_default = antfu;
|
|
|
2616
2617
|
ignores,
|
|
2617
2618
|
imports,
|
|
2618
2619
|
interopDefault,
|
|
2620
|
+
isInEditorEnv,
|
|
2619
2621
|
javascript,
|
|
2620
2622
|
jsdoc,
|
|
2621
2623
|
jsonc,
|
package/dist/index.d.cts
CHANGED
|
@@ -1042,6 +1042,11 @@ interface RuleOptions {
|
|
|
1042
1042
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-tag-names.md#repos-sticky-header
|
|
1043
1043
|
*/
|
|
1044
1044
|
'jsdoc/check-tag-names'?: Linter.RuleEntry<JsdocCheckTagNames>
|
|
1045
|
+
/**
|
|
1046
|
+
* Checks that any `@template` names are actually used in the connected `@typedef` or type alias.
|
|
1047
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header
|
|
1048
|
+
*/
|
|
1049
|
+
'jsdoc/check-template-names'?: Linter.RuleEntry<[]>
|
|
1045
1050
|
/**
|
|
1046
1051
|
* Reports invalid types.
|
|
1047
1052
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-types.md#repos-sticky-header
|
|
@@ -3082,6 +3087,11 @@ interface RuleOptions {
|
|
|
3082
3087
|
* @see https://eslint-react.xyz/docs/rules/no-create-ref
|
|
3083
3088
|
*/
|
|
3084
3089
|
'react/no-create-ref'?: Linter.RuleEntry<[]>
|
|
3090
|
+
/**
|
|
3091
|
+
* disallow the use of 'defaultProps' property in components
|
|
3092
|
+
* @see https://eslint-react.xyz/docs/rules/no-default-props
|
|
3093
|
+
*/
|
|
3094
|
+
'react/no-default-props'?: Linter.RuleEntry<[]>
|
|
3085
3095
|
/**
|
|
3086
3096
|
* disallow direct mutation of state
|
|
3087
3097
|
* @see https://eslint-react.xyz/docs/rules/no-direct-mutation-state
|
|
@@ -3118,6 +3128,11 @@ interface RuleOptions {
|
|
|
3118
3128
|
* @see https://eslint-react.xyz/docs/rules/no-nested-components
|
|
3119
3129
|
*/
|
|
3120
3130
|
'react/no-nested-components'?: Linter.RuleEntry<[]>
|
|
3131
|
+
/**
|
|
3132
|
+
* disallow the use of 'propTypes' property in components
|
|
3133
|
+
* @see https://eslint-react.xyz/docs/rules/no-prop-types
|
|
3134
|
+
*/
|
|
3135
|
+
'react/no-prop-types'?: Linter.RuleEntry<[]>
|
|
3121
3136
|
/**
|
|
3122
3137
|
* disallow usage of 'shouldComponentUpdate' in class component extends 'React.PureComponent'
|
|
3123
3138
|
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
@@ -15300,5 +15315,6 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
|
15300
15315
|
default: infer U;
|
|
15301
15316
|
} ? U : T>;
|
|
15302
15317
|
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
15318
|
+
declare function isInEditorEnv(): boolean;
|
|
15303
15319
|
|
|
15304
|
-
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, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, 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 };
|
|
15320
|
+
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, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1042,6 +1042,11 @@ interface RuleOptions {
|
|
|
1042
1042
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-tag-names.md#repos-sticky-header
|
|
1043
1043
|
*/
|
|
1044
1044
|
'jsdoc/check-tag-names'?: Linter.RuleEntry<JsdocCheckTagNames>
|
|
1045
|
+
/**
|
|
1046
|
+
* Checks that any `@template` names are actually used in the connected `@typedef` or type alias.
|
|
1047
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header
|
|
1048
|
+
*/
|
|
1049
|
+
'jsdoc/check-template-names'?: Linter.RuleEntry<[]>
|
|
1045
1050
|
/**
|
|
1046
1051
|
* Reports invalid types.
|
|
1047
1052
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-types.md#repos-sticky-header
|
|
@@ -3082,6 +3087,11 @@ interface RuleOptions {
|
|
|
3082
3087
|
* @see https://eslint-react.xyz/docs/rules/no-create-ref
|
|
3083
3088
|
*/
|
|
3084
3089
|
'react/no-create-ref'?: Linter.RuleEntry<[]>
|
|
3090
|
+
/**
|
|
3091
|
+
* disallow the use of 'defaultProps' property in components
|
|
3092
|
+
* @see https://eslint-react.xyz/docs/rules/no-default-props
|
|
3093
|
+
*/
|
|
3094
|
+
'react/no-default-props'?: Linter.RuleEntry<[]>
|
|
3085
3095
|
/**
|
|
3086
3096
|
* disallow direct mutation of state
|
|
3087
3097
|
* @see https://eslint-react.xyz/docs/rules/no-direct-mutation-state
|
|
@@ -3118,6 +3128,11 @@ interface RuleOptions {
|
|
|
3118
3128
|
* @see https://eslint-react.xyz/docs/rules/no-nested-components
|
|
3119
3129
|
*/
|
|
3120
3130
|
'react/no-nested-components'?: Linter.RuleEntry<[]>
|
|
3131
|
+
/**
|
|
3132
|
+
* disallow the use of 'propTypes' property in components
|
|
3133
|
+
* @see https://eslint-react.xyz/docs/rules/no-prop-types
|
|
3134
|
+
*/
|
|
3135
|
+
'react/no-prop-types'?: Linter.RuleEntry<[]>
|
|
3121
3136
|
/**
|
|
3122
3137
|
* disallow usage of 'shouldComponentUpdate' in class component extends 'React.PureComponent'
|
|
3123
3138
|
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
@@ -15300,5 +15315,6 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
|
15300
15315
|
default: infer U;
|
|
15301
15316
|
} ? U : T>;
|
|
15302
15317
|
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
15318
|
+
declare function isInEditorEnv(): boolean;
|
|
15303
15319
|
|
|
15304
|
-
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, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, 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 };
|
|
15320
|
+
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, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// src/factory.ts
|
|
2
|
-
import process3 from "node:process";
|
|
3
2
|
import { isPackageExists as isPackageExists4 } from "local-pkg";
|
|
4
3
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
5
4
|
|
|
@@ -158,6 +157,9 @@ async function ensurePackages(packages) {
|
|
|
158
157
|
if (result)
|
|
159
158
|
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
160
159
|
}
|
|
160
|
+
function isInEditorEnv() {
|
|
161
|
+
return !!((process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM) && !process.env.CI);
|
|
162
|
+
}
|
|
161
163
|
|
|
162
164
|
// src/configs/astro.ts
|
|
163
165
|
async function astro(options = {}) {
|
|
@@ -237,7 +239,7 @@ import { default as default3 } from "eslint-plugin-eslint-comments";
|
|
|
237
239
|
import * as pluginImport from "eslint-plugin-import-x";
|
|
238
240
|
import { default as default4 } from "eslint-plugin-n";
|
|
239
241
|
import { default as default5 } from "eslint-plugin-unicorn";
|
|
240
|
-
import { default as default6 } from "
|
|
242
|
+
import { default as default6 } from "eslint-plugin-unused-imports";
|
|
241
243
|
import { default as default7 } from "eslint-plugin-perfectionist";
|
|
242
244
|
|
|
243
245
|
// src/configs/comments.ts
|
|
@@ -1613,7 +1615,6 @@ async function svelte(options = {}) {
|
|
|
1613
1615
|
"svelte/no-useless-mustaches": "error",
|
|
1614
1616
|
"svelte/require-store-callbacks-use-set-param": "error",
|
|
1615
1617
|
"svelte/system": "error",
|
|
1616
|
-
"svelte/valid-compile": "error",
|
|
1617
1618
|
"svelte/valid-each-key": "error",
|
|
1618
1619
|
"unused-imports/no-unused-vars": [
|
|
1619
1620
|
"error",
|
|
@@ -1881,7 +1882,6 @@ async function typescript(options = {}) {
|
|
|
1881
1882
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1882
1883
|
"ts/no-useless-constructor": "off",
|
|
1883
1884
|
"ts/no-wrapper-object-types": "error",
|
|
1884
|
-
"ts/prefer-ts-expect-error": "error",
|
|
1885
1885
|
"ts/triple-slash-reference": "off",
|
|
1886
1886
|
"ts/unified-signatures": "off",
|
|
1887
1887
|
...type === "lib" ? {
|
|
@@ -2288,7 +2288,7 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2288
2288
|
autoRenamePlugins = true,
|
|
2289
2289
|
componentExts = [],
|
|
2290
2290
|
gitignore: enableGitignore = true,
|
|
2291
|
-
isInEditor =
|
|
2291
|
+
isInEditor = isInEditorEnv(),
|
|
2292
2292
|
jsx: enableJsx = true,
|
|
2293
2293
|
react: enableReact = false,
|
|
2294
2294
|
regexp: enableRegexp = true,
|
|
@@ -2512,6 +2512,7 @@ export {
|
|
|
2512
2512
|
ignores,
|
|
2513
2513
|
imports,
|
|
2514
2514
|
interopDefault,
|
|
2515
|
+
isInEditorEnv,
|
|
2515
2516
|
javascript,
|
|
2516
2517
|
jsdoc,
|
|
2517
2518
|
jsonc,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antfu/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.23.
|
|
4
|
+
"version": "2.23.2",
|
|
5
5
|
"description": "Anthony's ESLint config",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@antfu/eslint-plugin-unused-imports": "^4.0.0",
|
|
85
84
|
"@antfu/install-pkg": "^0.3.3",
|
|
86
85
|
"@clack/prompts": "^0.7.0",
|
|
87
86
|
"@stylistic/eslint-plugin": "^2.6.0-beta.0",
|
|
@@ -94,7 +93,7 @@
|
|
|
94
93
|
"eslint-plugin-command": "^0.2.3",
|
|
95
94
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
96
95
|
"eslint-plugin-import-x": "^3.0.1",
|
|
97
|
-
"eslint-plugin-jsdoc": "^48.
|
|
96
|
+
"eslint-plugin-jsdoc": "^48.8.3",
|
|
98
97
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
99
98
|
"eslint-plugin-markdown": "^5.1.0",
|
|
100
99
|
"eslint-plugin-n": "^17.9.0",
|
|
@@ -103,6 +102,7 @@
|
|
|
103
102
|
"eslint-plugin-regexp": "^2.6.0",
|
|
104
103
|
"eslint-plugin-toml": "^0.11.1",
|
|
105
104
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
105
|
+
"eslint-plugin-unused-imports": "^4.0.1",
|
|
106
106
|
"eslint-plugin-vitest": "^0.5.4",
|
|
107
107
|
"eslint-plugin-vue": "^9.27.0",
|
|
108
108
|
"eslint-plugin-yml": "^1.14.0",
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
},
|
|
120
120
|
"devDependencies": {
|
|
121
121
|
"@antfu/ni": "^0.22.0",
|
|
122
|
-
"@eslint-react/eslint-plugin": "^1.5.
|
|
123
|
-
"@eslint/config-inspector": "^0.5.
|
|
122
|
+
"@eslint-react/eslint-plugin": "^1.5.30",
|
|
123
|
+
"@eslint/config-inspector": "^0.5.2",
|
|
124
124
|
"@prettier/plugin-xml": "^3.4.1",
|
|
125
125
|
"@stylistic/eslint-plugin-migrate": "^2.3.0",
|
|
126
126
|
"@types/eslint": "^8.56.10",
|
|
@@ -135,9 +135,9 @@
|
|
|
135
135
|
"eslint-plugin-astro": "^1.2.3",
|
|
136
136
|
"eslint-plugin-format": "^0.1.2",
|
|
137
137
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
138
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
138
|
+
"eslint-plugin-react-refresh": "^0.4.9",
|
|
139
139
|
"eslint-plugin-solid": "^0.14.1",
|
|
140
|
-
"eslint-plugin-svelte": "^2.
|
|
140
|
+
"eslint-plugin-svelte": "^2.43.0",
|
|
141
141
|
"eslint-ts-patch": "9.5.0-0",
|
|
142
142
|
"eslint-typegen": "^0.2.4",
|
|
143
143
|
"esno": "^4.7.0",
|
|
@@ -150,13 +150,13 @@
|
|
|
150
150
|
"rimraf": "^6.0.1",
|
|
151
151
|
"simple-git-hooks": "^2.11.1",
|
|
152
152
|
"svelte": "^4.2.18",
|
|
153
|
-
"svelte-eslint-parser": "^0.
|
|
154
|
-
"tsup": "^8.
|
|
153
|
+
"svelte-eslint-parser": "^0.41.0",
|
|
154
|
+
"tsup": "^8.2.2",
|
|
155
155
|
"tsx": "^4.16.2",
|
|
156
156
|
"typescript": "^5.5.3",
|
|
157
|
-
"vitest": "^2.0.
|
|
158
|
-
"vue": "^3.4.
|
|
159
|
-
"@antfu/eslint-config": "2.23.
|
|
157
|
+
"vitest": "^2.0.4",
|
|
158
|
+
"vue": "^3.4.33",
|
|
159
|
+
"@antfu/eslint-config": "2.23.2"
|
|
160
160
|
},
|
|
161
161
|
"resolutions": {
|
|
162
162
|
"tsx": "~4.16.2"
|