@antfu/eslint-config 2.22.4 → 2.23.1
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 +14 -11
- package/dist/cli.cjs +22 -22
- package/dist/cli.js +22 -22
- package/dist/index.cjs +24 -11
- package/dist/index.d.cts +19 -7
- package/dist/index.d.ts +19 -7
- package/dist/index.js +23 -11
- package/package.json +13 -13
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
|
|
@@ -172,6 +172,9 @@ And that's it! Or you can configure each integration individually, for example:
|
|
|
172
172
|
import antfu from '@antfu/eslint-config'
|
|
173
173
|
|
|
174
174
|
export default antfu({
|
|
175
|
+
// Type of the project. 'lib' for libraries, the default is 'app'
|
|
176
|
+
type: 'lib',
|
|
177
|
+
|
|
175
178
|
// Enable stylistic formatting rules
|
|
176
179
|
// stylistic: true,
|
|
177
180
|
|
|
@@ -181,7 +184,7 @@ export default antfu({
|
|
|
181
184
|
quotes: 'single', // or 'double'
|
|
182
185
|
},
|
|
183
186
|
|
|
184
|
-
// TypeScript and Vue are
|
|
187
|
+
// TypeScript and Vue are autoetected, you can also explicitly enable them:
|
|
185
188
|
typescript: true,
|
|
186
189
|
vue: true,
|
|
187
190
|
|
package/dist/cli.cjs
CHANGED
|
@@ -48,7 +48,7 @@ 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.
|
|
51
|
+
version: "2.23.1",
|
|
52
52
|
packageManager: "pnpm@9.5.0",
|
|
53
53
|
description: "Anthony's ESLint config",
|
|
54
54
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
@@ -143,6 +143,7 @@ var package_default = {
|
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
dependencies: {
|
|
146
|
+
"@antfu/eslint-plugin-unused-imports": "^4.0.0",
|
|
146
147
|
"@antfu/install-pkg": "^0.3.3",
|
|
147
148
|
"@clack/prompts": "^0.7.0",
|
|
148
149
|
"@stylistic/eslint-plugin": "^2.6.0-beta.0",
|
|
@@ -155,7 +156,7 @@ var package_default = {
|
|
|
155
156
|
"eslint-plugin-command": "^0.2.3",
|
|
156
157
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
157
158
|
"eslint-plugin-import-x": "^3.0.1",
|
|
158
|
-
"eslint-plugin-jsdoc": "^48.
|
|
159
|
+
"eslint-plugin-jsdoc": "^48.8.3",
|
|
159
160
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
160
161
|
"eslint-plugin-markdown": "^5.1.0",
|
|
161
162
|
"eslint-plugin-n": "^17.9.0",
|
|
@@ -164,7 +165,6 @@ var package_default = {
|
|
|
164
165
|
"eslint-plugin-regexp": "^2.6.0",
|
|
165
166
|
"eslint-plugin-toml": "^0.11.1",
|
|
166
167
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
167
|
-
"eslint-plugin-unused-imports": "^4.0.0",
|
|
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,16 +182,16 @@ 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.28",
|
|
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",
|
|
190
190
|
"@types/fs-extra": "^11.0.4",
|
|
191
|
-
"@types/node": "^20.14.
|
|
191
|
+
"@types/node": "^20.14.11",
|
|
192
192
|
"@types/prompts": "^2.4.9",
|
|
193
193
|
"@types/yargs": "^17.0.32",
|
|
194
|
-
"@unocss/eslint-plugin": "^0.61.
|
|
194
|
+
"@unocss/eslint-plugin": "^0.61.5",
|
|
195
195
|
"astro-eslint-parser": "^1.0.2",
|
|
196
196
|
bumpp: "^9.4.1",
|
|
197
197
|
eslint: "npm:eslint-ts-patch@9.5.0-0",
|
|
@@ -200,7 +200,7 @@ var package_default = {
|
|
|
200
200
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
201
201
|
"eslint-plugin-react-refresh": "^0.4.8",
|
|
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",
|
|
@@ -208,17 +208,17 @@ var package_default = {
|
|
|
208
208
|
"fast-glob": "^3.3.2",
|
|
209
209
|
"fs-extra": "^11.2.0",
|
|
210
210
|
"lint-staged": "^15.2.7",
|
|
211
|
-
"prettier-plugin-astro": "^0.14.
|
|
211
|
+
"prettier-plugin-astro": "^0.14.1",
|
|
212
212
|
"prettier-plugin-slidev": "^1.0.5",
|
|
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.0",
|
|
218
218
|
tsx: "^4.16.2",
|
|
219
219
|
typescript: "^5.5.3",
|
|
220
220
|
vitest: "^2.0.3",
|
|
221
|
-
vue: "^3.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,7 +19,7 @@ import c from "picocolors";
|
|
|
19
19
|
var package_default = {
|
|
20
20
|
name: "@antfu/eslint-config",
|
|
21
21
|
type: "module",
|
|
22
|
-
version: "2.
|
|
22
|
+
version: "2.23.1",
|
|
23
23
|
packageManager: "pnpm@9.5.0",
|
|
24
24
|
description: "Anthony's ESLint config",
|
|
25
25
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
@@ -114,6 +114,7 @@ var package_default = {
|
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
dependencies: {
|
|
117
|
+
"@antfu/eslint-plugin-unused-imports": "^4.0.0",
|
|
117
118
|
"@antfu/install-pkg": "^0.3.3",
|
|
118
119
|
"@clack/prompts": "^0.7.0",
|
|
119
120
|
"@stylistic/eslint-plugin": "^2.6.0-beta.0",
|
|
@@ -126,7 +127,7 @@ var package_default = {
|
|
|
126
127
|
"eslint-plugin-command": "^0.2.3",
|
|
127
128
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
128
129
|
"eslint-plugin-import-x": "^3.0.1",
|
|
129
|
-
"eslint-plugin-jsdoc": "^48.
|
|
130
|
+
"eslint-plugin-jsdoc": "^48.8.3",
|
|
130
131
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
131
132
|
"eslint-plugin-markdown": "^5.1.0",
|
|
132
133
|
"eslint-plugin-n": "^17.9.0",
|
|
@@ -135,7 +136,6 @@ var package_default = {
|
|
|
135
136
|
"eslint-plugin-regexp": "^2.6.0",
|
|
136
137
|
"eslint-plugin-toml": "^0.11.1",
|
|
137
138
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
138
|
-
"eslint-plugin-unused-imports": "^4.0.0",
|
|
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,16 +153,16 @@ 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.28",
|
|
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",
|
|
161
161
|
"@types/fs-extra": "^11.0.4",
|
|
162
|
-
"@types/node": "^20.14.
|
|
162
|
+
"@types/node": "^20.14.11",
|
|
163
163
|
"@types/prompts": "^2.4.9",
|
|
164
164
|
"@types/yargs": "^17.0.32",
|
|
165
|
-
"@unocss/eslint-plugin": "^0.61.
|
|
165
|
+
"@unocss/eslint-plugin": "^0.61.5",
|
|
166
166
|
"astro-eslint-parser": "^1.0.2",
|
|
167
167
|
bumpp: "^9.4.1",
|
|
168
168
|
eslint: "npm:eslint-ts-patch@9.5.0-0",
|
|
@@ -171,7 +171,7 @@ var package_default = {
|
|
|
171
171
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
172
172
|
"eslint-plugin-react-refresh": "^0.4.8",
|
|
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",
|
|
@@ -179,17 +179,17 @@ var package_default = {
|
|
|
179
179
|
"fast-glob": "^3.3.2",
|
|
180
180
|
"fs-extra": "^11.2.0",
|
|
181
181
|
"lint-staged": "^15.2.7",
|
|
182
|
-
"prettier-plugin-astro": "^0.14.
|
|
182
|
+
"prettier-plugin-astro": "^0.14.1",
|
|
183
183
|
"prettier-plugin-slidev": "^1.0.5",
|
|
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.0",
|
|
189
189
|
tsx: "^4.16.2",
|
|
190
190
|
typescript: "^5.5.3",
|
|
191
191
|
vitest: "^2.0.3",
|
|
192
|
-
vue: "^3.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,8 +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
|
-
var import_node_fs = __toESM(require("fs"), 1);
|
|
108
107
|
var import_local_pkg4 = require("local-pkg");
|
|
109
108
|
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
110
109
|
|
|
@@ -263,6 +262,9 @@ async function ensurePackages(packages) {
|
|
|
263
262
|
if (result)
|
|
264
263
|
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
265
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
|
+
}
|
|
266
268
|
|
|
267
269
|
// src/configs/astro.ts
|
|
268
270
|
async function astro(options = {}) {
|
|
@@ -342,7 +344,7 @@ var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint
|
|
|
342
344
|
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
343
345
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
344
346
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
345
|
-
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
347
|
+
var import_eslint_plugin_unused_imports = __toESM(require("@antfu/eslint-plugin-unused-imports"), 1);
|
|
346
348
|
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
347
349
|
|
|
348
350
|
// src/configs/comments.ts
|
|
@@ -1718,7 +1720,6 @@ async function svelte(options = {}) {
|
|
|
1718
1720
|
"svelte/no-useless-mustaches": "error",
|
|
1719
1721
|
"svelte/require-store-callbacks-use-set-param": "error",
|
|
1720
1722
|
"svelte/system": "error",
|
|
1721
|
-
"svelte/valid-compile": "error",
|
|
1722
1723
|
"svelte/valid-each-key": "error",
|
|
1723
1724
|
"unused-imports/no-unused-vars": [
|
|
1724
1725
|
"error",
|
|
@@ -1791,6 +1792,7 @@ async function test(options = {}) {
|
|
|
1791
1792
|
"test/no-only-tests": isInEditor ? "off" : "error",
|
|
1792
1793
|
"test/prefer-hooks-in-order": "error",
|
|
1793
1794
|
"test/prefer-lowercase-title": "error",
|
|
1795
|
+
"ts/explicit-function-return-type": "off",
|
|
1794
1796
|
...overrides
|
|
1795
1797
|
}
|
|
1796
1798
|
}
|
|
@@ -1862,7 +1864,8 @@ async function typescript(options = {}) {
|
|
|
1862
1864
|
const {
|
|
1863
1865
|
componentExts = [],
|
|
1864
1866
|
overrides = {},
|
|
1865
|
-
parserOptions = {}
|
|
1867
|
+
parserOptions = {},
|
|
1868
|
+
type = "app"
|
|
1866
1869
|
} = options;
|
|
1867
1870
|
const files = options.files ?? [
|
|
1868
1871
|
GLOB_TS,
|
|
@@ -1963,7 +1966,10 @@ async function typescript(options = {}) {
|
|
|
1963
1966
|
"no-useless-constructor": "off",
|
|
1964
1967
|
"ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
1965
1968
|
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1966
|
-
"ts/consistent-type-imports": ["error", {
|
|
1969
|
+
"ts/consistent-type-imports": ["error", {
|
|
1970
|
+
disallowTypeAnnotations: false,
|
|
1971
|
+
prefer: "type-imports"
|
|
1972
|
+
}],
|
|
1967
1973
|
"ts/method-signature-style": ["error", "property"],
|
|
1968
1974
|
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
1969
1975
|
"ts/no-dupe-class-members": "error",
|
|
@@ -1981,9 +1987,15 @@ async function typescript(options = {}) {
|
|
|
1981
1987
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1982
1988
|
"ts/no-useless-constructor": "off",
|
|
1983
1989
|
"ts/no-wrapper-object-types": "error",
|
|
1984
|
-
"ts/prefer-ts-expect-error": "error",
|
|
1985
1990
|
"ts/triple-slash-reference": "off",
|
|
1986
1991
|
"ts/unified-signatures": "off",
|
|
1992
|
+
...type === "lib" ? {
|
|
1993
|
+
"ts/explicit-function-return-type": ["error", {
|
|
1994
|
+
allowExpressions: true,
|
|
1995
|
+
allowHigherOrderFunctions: true,
|
|
1996
|
+
allowIIFEs: true
|
|
1997
|
+
}]
|
|
1998
|
+
} : {},
|
|
1987
1999
|
...overrides
|
|
1988
2000
|
}
|
|
1989
2001
|
},
|
|
@@ -2381,7 +2393,7 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2381
2393
|
autoRenamePlugins = true,
|
|
2382
2394
|
componentExts = [],
|
|
2383
2395
|
gitignore: enableGitignore = true,
|
|
2384
|
-
isInEditor =
|
|
2396
|
+
isInEditor = isInEditorEnv(),
|
|
2385
2397
|
jsx: enableJsx = true,
|
|
2386
2398
|
react: enableReact = false,
|
|
2387
2399
|
regexp: enableRegexp = true,
|
|
@@ -2399,8 +2411,7 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2399
2411
|
if (typeof enableGitignore !== "boolean") {
|
|
2400
2412
|
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
2401
2413
|
} else {
|
|
2402
|
-
|
|
2403
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
2414
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({ strict: false })]));
|
|
2404
2415
|
}
|
|
2405
2416
|
}
|
|
2406
2417
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
@@ -2434,7 +2445,8 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2434
2445
|
configs2.push(typescript({
|
|
2435
2446
|
...typescriptOptions,
|
|
2436
2447
|
componentExts,
|
|
2437
|
-
overrides: getOverrides(options, "typescript")
|
|
2448
|
+
overrides: getOverrides(options, "typescript"),
|
|
2449
|
+
type: options.type
|
|
2438
2450
|
}));
|
|
2439
2451
|
}
|
|
2440
2452
|
if (stylisticOptions) {
|
|
@@ -2605,6 +2617,7 @@ var src_default = antfu;
|
|
|
2605
2617
|
ignores,
|
|
2606
2618
|
imports,
|
|
2607
2619
|
interopDefault,
|
|
2620
|
+
isInEditorEnv,
|
|
2608
2621
|
javascript,
|
|
2609
2622
|
jsdoc,
|
|
2610
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
|
|
@@ -14890,6 +14895,14 @@ interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'qu
|
|
|
14890
14895
|
interface OptionsOverrides {
|
|
14891
14896
|
overrides?: TypedFlatConfigItem['rules'];
|
|
14892
14897
|
}
|
|
14898
|
+
interface OptionsProjectType {
|
|
14899
|
+
/**
|
|
14900
|
+
* Type of the project. `lib` will enable more strict rules for libraries.
|
|
14901
|
+
*
|
|
14902
|
+
* @default 'app'
|
|
14903
|
+
*/
|
|
14904
|
+
type?: 'app' | 'lib';
|
|
14905
|
+
}
|
|
14893
14906
|
interface OptionsRegExp {
|
|
14894
14907
|
/**
|
|
14895
14908
|
* Override rulelevels
|
|
@@ -14911,7 +14924,7 @@ interface OptionsUnoCSS extends OptionsOverrides {
|
|
|
14911
14924
|
*/
|
|
14912
14925
|
strict?: boolean;
|
|
14913
14926
|
}
|
|
14914
|
-
interface OptionsConfig extends OptionsComponentExts {
|
|
14927
|
+
interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
14915
14928
|
/**
|
|
14916
14929
|
* Enable gitignore support.
|
|
14917
14930
|
*
|
|
@@ -15120,7 +15133,7 @@ declare const defaultPluginRenaming: {
|
|
|
15120
15133
|
declare function antfu(options?: OptionsConfig & TypedFlatConfigItem, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.FlatConfig[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
15121
15134
|
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
15122
15135
|
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
15123
|
-
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K):
|
|
15136
|
+
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): Partial<Linter.RulesRecord & RuleOptions>;
|
|
15124
15137
|
|
|
15125
15138
|
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
15126
15139
|
|
|
@@ -15182,7 +15195,7 @@ declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverri
|
|
|
15182
15195
|
|
|
15183
15196
|
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
15184
15197
|
|
|
15185
|
-
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<TypedFlatConfigItem[]>;
|
|
15198
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsProjectType): Promise<TypedFlatConfigItem[]>;
|
|
15186
15199
|
|
|
15187
15200
|
declare function unicorn(): Promise<TypedFlatConfigItem[]>;
|
|
15188
15201
|
|
|
@@ -15271,9 +15284,7 @@ declare function combine(...configs: Awaitable<TypedFlatConfigItem | TypedFlatCo
|
|
|
15271
15284
|
* }]
|
|
15272
15285
|
* ```
|
|
15273
15286
|
*/
|
|
15274
|
-
declare function renameRules(rules: Record<string, any>, map: Record<string, string>):
|
|
15275
|
-
[k: string]: any;
|
|
15276
|
-
};
|
|
15287
|
+
declare function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
|
|
15277
15288
|
/**
|
|
15278
15289
|
* Rename plugin names a flat configs array
|
|
15279
15290
|
*
|
|
@@ -15294,5 +15305,6 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
|
15294
15305
|
default: infer U;
|
|
15295
15306
|
} ? U : T>;
|
|
15296
15307
|
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
15308
|
+
declare function isInEditorEnv(): boolean;
|
|
15297
15309
|
|
|
15298
|
-
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 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 };
|
|
15310
|
+
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
|
|
@@ -14890,6 +14895,14 @@ interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'qu
|
|
|
14890
14895
|
interface OptionsOverrides {
|
|
14891
14896
|
overrides?: TypedFlatConfigItem['rules'];
|
|
14892
14897
|
}
|
|
14898
|
+
interface OptionsProjectType {
|
|
14899
|
+
/**
|
|
14900
|
+
* Type of the project. `lib` will enable more strict rules for libraries.
|
|
14901
|
+
*
|
|
14902
|
+
* @default 'app'
|
|
14903
|
+
*/
|
|
14904
|
+
type?: 'app' | 'lib';
|
|
14905
|
+
}
|
|
14893
14906
|
interface OptionsRegExp {
|
|
14894
14907
|
/**
|
|
14895
14908
|
* Override rulelevels
|
|
@@ -14911,7 +14924,7 @@ interface OptionsUnoCSS extends OptionsOverrides {
|
|
|
14911
14924
|
*/
|
|
14912
14925
|
strict?: boolean;
|
|
14913
14926
|
}
|
|
14914
|
-
interface OptionsConfig extends OptionsComponentExts {
|
|
14927
|
+
interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
14915
14928
|
/**
|
|
14916
14929
|
* Enable gitignore support.
|
|
14917
14930
|
*
|
|
@@ -15120,7 +15133,7 @@ declare const defaultPluginRenaming: {
|
|
|
15120
15133
|
declare function antfu(options?: OptionsConfig & TypedFlatConfigItem, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.FlatConfig[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
15121
15134
|
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
15122
15135
|
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
15123
|
-
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K):
|
|
15136
|
+
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): Partial<Linter.RulesRecord & RuleOptions>;
|
|
15124
15137
|
|
|
15125
15138
|
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
15126
15139
|
|
|
@@ -15182,7 +15195,7 @@ declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverri
|
|
|
15182
15195
|
|
|
15183
15196
|
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
15184
15197
|
|
|
15185
|
-
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<TypedFlatConfigItem[]>;
|
|
15198
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsProjectType): Promise<TypedFlatConfigItem[]>;
|
|
15186
15199
|
|
|
15187
15200
|
declare function unicorn(): Promise<TypedFlatConfigItem[]>;
|
|
15188
15201
|
|
|
@@ -15271,9 +15284,7 @@ declare function combine(...configs: Awaitable<TypedFlatConfigItem | TypedFlatCo
|
|
|
15271
15284
|
* }]
|
|
15272
15285
|
* ```
|
|
15273
15286
|
*/
|
|
15274
|
-
declare function renameRules(rules: Record<string, any>, map: Record<string, string>):
|
|
15275
|
-
[k: string]: any;
|
|
15276
|
-
};
|
|
15287
|
+
declare function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
|
|
15277
15288
|
/**
|
|
15278
15289
|
* Rename plugin names a flat configs array
|
|
15279
15290
|
*
|
|
@@ -15294,5 +15305,6 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
|
15294
15305
|
default: infer U;
|
|
15295
15306
|
} ? U : T>;
|
|
15296
15307
|
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
15308
|
+
declare function isInEditorEnv(): boolean;
|
|
15297
15309
|
|
|
15298
|
-
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 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 };
|
|
15310
|
+
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,6 +1,4 @@
|
|
|
1
1
|
// src/factory.ts
|
|
2
|
-
import process3 from "node:process";
|
|
3
|
-
import fs from "node:fs";
|
|
4
2
|
import { isPackageExists as isPackageExists4 } from "local-pkg";
|
|
5
3
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
6
4
|
|
|
@@ -159,6 +157,9 @@ async function ensurePackages(packages) {
|
|
|
159
157
|
if (result)
|
|
160
158
|
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
161
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
|
+
}
|
|
162
163
|
|
|
163
164
|
// src/configs/astro.ts
|
|
164
165
|
async function astro(options = {}) {
|
|
@@ -238,7 +239,7 @@ import { default as default3 } from "eslint-plugin-eslint-comments";
|
|
|
238
239
|
import * as pluginImport from "eslint-plugin-import-x";
|
|
239
240
|
import { default as default4 } from "eslint-plugin-n";
|
|
240
241
|
import { default as default5 } from "eslint-plugin-unicorn";
|
|
241
|
-
import { default as default6 } from "eslint-plugin-unused-imports";
|
|
242
|
+
import { default as default6 } from "@antfu/eslint-plugin-unused-imports";
|
|
242
243
|
import { default as default7 } from "eslint-plugin-perfectionist";
|
|
243
244
|
|
|
244
245
|
// src/configs/comments.ts
|
|
@@ -1614,7 +1615,6 @@ async function svelte(options = {}) {
|
|
|
1614
1615
|
"svelte/no-useless-mustaches": "error",
|
|
1615
1616
|
"svelte/require-store-callbacks-use-set-param": "error",
|
|
1616
1617
|
"svelte/system": "error",
|
|
1617
|
-
"svelte/valid-compile": "error",
|
|
1618
1618
|
"svelte/valid-each-key": "error",
|
|
1619
1619
|
"unused-imports/no-unused-vars": [
|
|
1620
1620
|
"error",
|
|
@@ -1687,6 +1687,7 @@ async function test(options = {}) {
|
|
|
1687
1687
|
"test/no-only-tests": isInEditor ? "off" : "error",
|
|
1688
1688
|
"test/prefer-hooks-in-order": "error",
|
|
1689
1689
|
"test/prefer-lowercase-title": "error",
|
|
1690
|
+
"ts/explicit-function-return-type": "off",
|
|
1690
1691
|
...overrides
|
|
1691
1692
|
}
|
|
1692
1693
|
}
|
|
@@ -1758,7 +1759,8 @@ async function typescript(options = {}) {
|
|
|
1758
1759
|
const {
|
|
1759
1760
|
componentExts = [],
|
|
1760
1761
|
overrides = {},
|
|
1761
|
-
parserOptions = {}
|
|
1762
|
+
parserOptions = {},
|
|
1763
|
+
type = "app"
|
|
1762
1764
|
} = options;
|
|
1763
1765
|
const files = options.files ?? [
|
|
1764
1766
|
GLOB_TS,
|
|
@@ -1859,7 +1861,10 @@ async function typescript(options = {}) {
|
|
|
1859
1861
|
"no-useless-constructor": "off",
|
|
1860
1862
|
"ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
1861
1863
|
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1862
|
-
"ts/consistent-type-imports": ["error", {
|
|
1864
|
+
"ts/consistent-type-imports": ["error", {
|
|
1865
|
+
disallowTypeAnnotations: false,
|
|
1866
|
+
prefer: "type-imports"
|
|
1867
|
+
}],
|
|
1863
1868
|
"ts/method-signature-style": ["error", "property"],
|
|
1864
1869
|
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
1865
1870
|
"ts/no-dupe-class-members": "error",
|
|
@@ -1877,9 +1882,15 @@ async function typescript(options = {}) {
|
|
|
1877
1882
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1878
1883
|
"ts/no-useless-constructor": "off",
|
|
1879
1884
|
"ts/no-wrapper-object-types": "error",
|
|
1880
|
-
"ts/prefer-ts-expect-error": "error",
|
|
1881
1885
|
"ts/triple-slash-reference": "off",
|
|
1882
1886
|
"ts/unified-signatures": "off",
|
|
1887
|
+
...type === "lib" ? {
|
|
1888
|
+
"ts/explicit-function-return-type": ["error", {
|
|
1889
|
+
allowExpressions: true,
|
|
1890
|
+
allowHigherOrderFunctions: true,
|
|
1891
|
+
allowIIFEs: true
|
|
1892
|
+
}]
|
|
1893
|
+
} : {},
|
|
1883
1894
|
...overrides
|
|
1884
1895
|
}
|
|
1885
1896
|
},
|
|
@@ -2277,7 +2288,7 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2277
2288
|
autoRenamePlugins = true,
|
|
2278
2289
|
componentExts = [],
|
|
2279
2290
|
gitignore: enableGitignore = true,
|
|
2280
|
-
isInEditor =
|
|
2291
|
+
isInEditor = isInEditorEnv(),
|
|
2281
2292
|
jsx: enableJsx = true,
|
|
2282
2293
|
react: enableReact = false,
|
|
2283
2294
|
regexp: enableRegexp = true,
|
|
@@ -2295,8 +2306,7 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2295
2306
|
if (typeof enableGitignore !== "boolean") {
|
|
2296
2307
|
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
2297
2308
|
} else {
|
|
2298
|
-
|
|
2299
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
2309
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({ strict: false })]));
|
|
2300
2310
|
}
|
|
2301
2311
|
}
|
|
2302
2312
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
@@ -2330,7 +2340,8 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2330
2340
|
configs2.push(typescript({
|
|
2331
2341
|
...typescriptOptions,
|
|
2332
2342
|
componentExts,
|
|
2333
|
-
overrides: getOverrides(options, "typescript")
|
|
2343
|
+
overrides: getOverrides(options, "typescript"),
|
|
2344
|
+
type: options.type
|
|
2334
2345
|
}));
|
|
2335
2346
|
}
|
|
2336
2347
|
if (stylisticOptions) {
|
|
@@ -2501,6 +2512,7 @@ export {
|
|
|
2501
2512
|
ignores,
|
|
2502
2513
|
imports,
|
|
2503
2514
|
interopDefault,
|
|
2515
|
+
isInEditorEnv,
|
|
2504
2516
|
javascript,
|
|
2505
2517
|
jsdoc,
|
|
2506
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.
|
|
4
|
+
"version": "2.23.1",
|
|
5
5
|
"description": "Anthony's ESLint config",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
+
"@antfu/eslint-plugin-unused-imports": "^4.0.0",
|
|
84
85
|
"@antfu/install-pkg": "^0.3.3",
|
|
85
86
|
"@clack/prompts": "^0.7.0",
|
|
86
87
|
"@stylistic/eslint-plugin": "^2.6.0-beta.0",
|
|
@@ -93,7 +94,7 @@
|
|
|
93
94
|
"eslint-plugin-command": "^0.2.3",
|
|
94
95
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
95
96
|
"eslint-plugin-import-x": "^3.0.1",
|
|
96
|
-
"eslint-plugin-jsdoc": "^48.
|
|
97
|
+
"eslint-plugin-jsdoc": "^48.8.3",
|
|
97
98
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
98
99
|
"eslint-plugin-markdown": "^5.1.0",
|
|
99
100
|
"eslint-plugin-n": "^17.9.0",
|
|
@@ -102,7 +103,6 @@
|
|
|
102
103
|
"eslint-plugin-regexp": "^2.6.0",
|
|
103
104
|
"eslint-plugin-toml": "^0.11.1",
|
|
104
105
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
105
|
-
"eslint-plugin-unused-imports": "^4.0.0",
|
|
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,16 +119,16 @@
|
|
|
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.28",
|
|
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",
|
|
127
127
|
"@types/fs-extra": "^11.0.4",
|
|
128
|
-
"@types/node": "^20.14.
|
|
128
|
+
"@types/node": "^20.14.11",
|
|
129
129
|
"@types/prompts": "^2.4.9",
|
|
130
130
|
"@types/yargs": "^17.0.32",
|
|
131
|
-
"@unocss/eslint-plugin": "^0.61.
|
|
131
|
+
"@unocss/eslint-plugin": "^0.61.5",
|
|
132
132
|
"astro-eslint-parser": "^1.0.2",
|
|
133
133
|
"bumpp": "^9.4.1",
|
|
134
134
|
"eslint": "npm:eslint-ts-patch@9.5.0-0",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
138
138
|
"eslint-plugin-react-refresh": "^0.4.8",
|
|
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",
|
|
@@ -145,18 +145,18 @@
|
|
|
145
145
|
"fast-glob": "^3.3.2",
|
|
146
146
|
"fs-extra": "^11.2.0",
|
|
147
147
|
"lint-staged": "^15.2.7",
|
|
148
|
-
"prettier-plugin-astro": "^0.14.
|
|
148
|
+
"prettier-plugin-astro": "^0.14.1",
|
|
149
149
|
"prettier-plugin-slidev": "^1.0.5",
|
|
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.0",
|
|
155
155
|
"tsx": "^4.16.2",
|
|
156
156
|
"typescript": "^5.5.3",
|
|
157
157
|
"vitest": "^2.0.3",
|
|
158
|
-
"vue": "^3.4.
|
|
159
|
-
"@antfu/eslint-config": "2.
|
|
158
|
+
"vue": "^3.4.33",
|
|
159
|
+
"@antfu/eslint-config": "2.23.1"
|
|
160
160
|
},
|
|
161
161
|
"resolutions": {
|
|
162
162
|
"tsx": "~4.16.2"
|