@antfu/eslint-config 2.16.4 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cli.cjs +28 -20
- package/dist/cli.js +28 -20
- package/dist/index.cjs +98 -34
- package/dist/index.d.cts +602 -4
- package/dist/index.d.ts +602 -4
- package/dist/index.js +96 -34
- package/package.json +26 -19
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
- Opinionated, but [very customizable](#customization)
|
|
9
9
|
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
|
|
10
10
|
- Optional [React](#react), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro), [Solid](#solid) support
|
|
11
|
-
- Optional [formatters](#formatters) support for formatting CSS, HTML, etc.
|
|
11
|
+
- Optional [formatters](#formatters) support for formatting CSS, HTML, XML, etc.
|
|
12
12
|
- **Style principle**: Minimal for reading, stable for diff, consistent
|
|
13
13
|
- Sorted imports, dangling commas
|
|
14
14
|
- Single quotes, no semi
|
|
@@ -143,6 +143,7 @@ Add the following settings to your `.vscode/settings.json`:
|
|
|
143
143
|
"jsonc",
|
|
144
144
|
"yaml",
|
|
145
145
|
"toml",
|
|
146
|
+
"xml",
|
|
146
147
|
"gql",
|
|
147
148
|
"graphql",
|
|
148
149
|
"astro"
|
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.
|
|
52
|
-
packageManager: "pnpm@9.1.
|
|
51
|
+
version: "2.18.0",
|
|
52
|
+
packageManager: "pnpm@9.1.1",
|
|
53
53
|
description: "Anthony's ESLint config",
|
|
54
54
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
55
55
|
license: "MIT",
|
|
@@ -87,6 +87,7 @@ var package_default = {
|
|
|
87
87
|
},
|
|
88
88
|
peerDependencies: {
|
|
89
89
|
"@eslint-react/eslint-plugin": "^1.5.8",
|
|
90
|
+
"@prettier/plugin-xml": "^3.4.1",
|
|
90
91
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
91
92
|
"astro-eslint-parser": "^0.16.3",
|
|
92
93
|
eslint: ">=8.40.0",
|
|
@@ -104,6 +105,9 @@ var package_default = {
|
|
|
104
105
|
"@eslint-react/eslint-plugin": {
|
|
105
106
|
optional: true
|
|
106
107
|
},
|
|
108
|
+
"@prettier/plugin-xml": {
|
|
109
|
+
optional: true
|
|
110
|
+
},
|
|
107
111
|
"@unocss/eslint-plugin": {
|
|
108
112
|
optional: true
|
|
109
113
|
},
|
|
@@ -141,9 +145,9 @@ var package_default = {
|
|
|
141
145
|
dependencies: {
|
|
142
146
|
"@antfu/install-pkg": "^0.3.3",
|
|
143
147
|
"@clack/prompts": "^0.7.0",
|
|
144
|
-
"@stylistic/eslint-plugin": "^1.
|
|
145
|
-
"@typescript-eslint/eslint-plugin": "
|
|
146
|
-
"@typescript-eslint/parser": "
|
|
148
|
+
"@stylistic/eslint-plugin": "^2.1.0",
|
|
149
|
+
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
|
150
|
+
"@typescript-eslint/parser": "^7.9.0",
|
|
147
151
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
148
152
|
"eslint-flat-config-utils": "^0.2.4",
|
|
149
153
|
"eslint-merge-processors": "^0.1.0",
|
|
@@ -151,20 +155,21 @@ var package_default = {
|
|
|
151
155
|
"eslint-plugin-command": "^0.2.0",
|
|
152
156
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
153
157
|
"eslint-plugin-import-x": "^0.5.0",
|
|
154
|
-
"eslint-plugin-jsdoc": "^48.2.
|
|
158
|
+
"eslint-plugin-jsdoc": "^48.2.4",
|
|
155
159
|
"eslint-plugin-jsonc": "^2.15.1",
|
|
156
160
|
"eslint-plugin-markdown": "^5.0.0",
|
|
157
|
-
"eslint-plugin-n": "^17.
|
|
161
|
+
"eslint-plugin-n": "^17.6.0",
|
|
158
162
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
159
163
|
"eslint-plugin-perfectionist": "^2.10.0",
|
|
164
|
+
"eslint-plugin-regexp": "^2.5.0",
|
|
160
165
|
"eslint-plugin-toml": "^0.11.0",
|
|
161
166
|
"eslint-plugin-unicorn": "^52.0.0",
|
|
162
167
|
"eslint-plugin-unused-imports": "^3.2.0",
|
|
163
168
|
"eslint-plugin-vitest": "^0.5.4",
|
|
164
|
-
"eslint-plugin-vue": "^9.
|
|
169
|
+
"eslint-plugin-vue": "^9.26.0",
|
|
165
170
|
"eslint-plugin-yml": "^1.14.0",
|
|
166
171
|
"eslint-processor-vue-blocks": "^0.1.2",
|
|
167
|
-
globals: "^15.
|
|
172
|
+
globals: "^15.2.0",
|
|
168
173
|
"jsonc-eslint-parser": "^2.4.0",
|
|
169
174
|
"local-pkg": "^0.5.0",
|
|
170
175
|
"parse-gitignore": "^2.0.0",
|
|
@@ -176,40 +181,42 @@ var package_default = {
|
|
|
176
181
|
},
|
|
177
182
|
devDependencies: {
|
|
178
183
|
"@antfu/eslint-config": "workspace:*",
|
|
179
|
-
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
180
184
|
"@antfu/ni": "^0.21.12",
|
|
181
185
|
"@eslint-react/eslint-plugin": "^1.5.11",
|
|
182
186
|
"@eslint/config-inspector": "^0.4.8",
|
|
183
|
-
"@
|
|
187
|
+
"@prettier/plugin-xml": "^3.4.1",
|
|
188
|
+
"@stylistic/eslint-plugin-migrate": "^2.1.0",
|
|
184
189
|
"@types/eslint": "^8.56.10",
|
|
185
190
|
"@types/fs-extra": "^11.0.4",
|
|
186
191
|
"@types/node": "^20.12.11",
|
|
187
192
|
"@types/prompts": "^2.4.9",
|
|
188
193
|
"@types/yargs": "^17.0.32",
|
|
189
|
-
"@unocss/eslint-plugin": "^0.
|
|
194
|
+
"@unocss/eslint-plugin": "^0.60.2",
|
|
190
195
|
"astro-eslint-parser": "^1.0.2",
|
|
191
196
|
bumpp: "^9.4.1",
|
|
192
197
|
"bundle-require": "^4.1.0",
|
|
193
|
-
eslint: "
|
|
194
|
-
"eslint-plugin-astro": "^1.
|
|
198
|
+
eslint: "npm:eslint-ts-patch@9.2.0-6",
|
|
199
|
+
"eslint-plugin-astro": "^1.2.0",
|
|
195
200
|
"eslint-plugin-format": "^0.1.1",
|
|
196
201
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
197
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
202
|
+
"eslint-plugin-react-refresh": "^0.4.7",
|
|
198
203
|
"eslint-plugin-solid": "^0.14.0",
|
|
199
|
-
"eslint-plugin-svelte": "2.
|
|
204
|
+
"eslint-plugin-svelte": "^2.39.0",
|
|
205
|
+
"eslint-ts-patch": "9.2.0-6",
|
|
200
206
|
"eslint-typegen": "^0.2.4",
|
|
201
207
|
esno: "^4.7.0",
|
|
202
|
-
execa: "^
|
|
208
|
+
execa: "^9.1.0",
|
|
203
209
|
"fast-glob": "^3.3.2",
|
|
204
210
|
"fs-extra": "^11.2.0",
|
|
205
211
|
"lint-staged": "^15.2.2",
|
|
206
212
|
"prettier-plugin-astro": "^0.13.0",
|
|
207
213
|
"prettier-plugin-slidev": "^1.0.5",
|
|
208
|
-
rimraf: "^5.0.
|
|
214
|
+
rimraf: "^5.0.7",
|
|
209
215
|
"simple-git-hooks": "^2.11.1",
|
|
210
216
|
svelte: "^4.2.16",
|
|
211
|
-
"svelte-eslint-parser": "^0.
|
|
217
|
+
"svelte-eslint-parser": "^0.36.0",
|
|
212
218
|
tsup: "^8.0.2",
|
|
219
|
+
tsx: "^4.10.2",
|
|
213
220
|
typescript: "^5.4.5",
|
|
214
221
|
vitest: "^1.6.0",
|
|
215
222
|
vue: "^3.4.27"
|
|
@@ -265,6 +272,7 @@ var vscodeSettingsString = `
|
|
|
265
272
|
"jsonc",
|
|
266
273
|
"yaml",
|
|
267
274
|
"toml",
|
|
275
|
+
"xml",
|
|
268
276
|
"gql",
|
|
269
277
|
"graphql",
|
|
270
278
|
"astro"
|
|
@@ -484,7 +492,7 @@ async function updateVscodeSettings(result) {
|
|
|
484
492
|
p3.log.success(import_picocolors4.default.green(`Created .vscode/settings.json`));
|
|
485
493
|
} else {
|
|
486
494
|
let settingsContent = await import_promises3.default.readFile(settingsPath, "utf8");
|
|
487
|
-
settingsContent = settingsContent.trim().replace(/\s
|
|
495
|
+
settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
|
|
488
496
|
settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
|
|
489
497
|
settingsContent += `${vscodeSettingsString}}
|
|
490
498
|
`;
|
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
|
-
packageManager: "pnpm@9.1.
|
|
22
|
+
version: "2.18.0",
|
|
23
|
+
packageManager: "pnpm@9.1.1",
|
|
24
24
|
description: "Anthony's ESLint config",
|
|
25
25
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
26
26
|
license: "MIT",
|
|
@@ -58,6 +58,7 @@ var package_default = {
|
|
|
58
58
|
},
|
|
59
59
|
peerDependencies: {
|
|
60
60
|
"@eslint-react/eslint-plugin": "^1.5.8",
|
|
61
|
+
"@prettier/plugin-xml": "^3.4.1",
|
|
61
62
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
62
63
|
"astro-eslint-parser": "^0.16.3",
|
|
63
64
|
eslint: ">=8.40.0",
|
|
@@ -75,6 +76,9 @@ var package_default = {
|
|
|
75
76
|
"@eslint-react/eslint-plugin": {
|
|
76
77
|
optional: true
|
|
77
78
|
},
|
|
79
|
+
"@prettier/plugin-xml": {
|
|
80
|
+
optional: true
|
|
81
|
+
},
|
|
78
82
|
"@unocss/eslint-plugin": {
|
|
79
83
|
optional: true
|
|
80
84
|
},
|
|
@@ -112,9 +116,9 @@ var package_default = {
|
|
|
112
116
|
dependencies: {
|
|
113
117
|
"@antfu/install-pkg": "^0.3.3",
|
|
114
118
|
"@clack/prompts": "^0.7.0",
|
|
115
|
-
"@stylistic/eslint-plugin": "^1.
|
|
116
|
-
"@typescript-eslint/eslint-plugin": "
|
|
117
|
-
"@typescript-eslint/parser": "
|
|
119
|
+
"@stylistic/eslint-plugin": "^2.1.0",
|
|
120
|
+
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
|
121
|
+
"@typescript-eslint/parser": "^7.9.0",
|
|
118
122
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
119
123
|
"eslint-flat-config-utils": "^0.2.4",
|
|
120
124
|
"eslint-merge-processors": "^0.1.0",
|
|
@@ -122,20 +126,21 @@ var package_default = {
|
|
|
122
126
|
"eslint-plugin-command": "^0.2.0",
|
|
123
127
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
124
128
|
"eslint-plugin-import-x": "^0.5.0",
|
|
125
|
-
"eslint-plugin-jsdoc": "^48.2.
|
|
129
|
+
"eslint-plugin-jsdoc": "^48.2.4",
|
|
126
130
|
"eslint-plugin-jsonc": "^2.15.1",
|
|
127
131
|
"eslint-plugin-markdown": "^5.0.0",
|
|
128
|
-
"eslint-plugin-n": "^17.
|
|
132
|
+
"eslint-plugin-n": "^17.6.0",
|
|
129
133
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
130
134
|
"eslint-plugin-perfectionist": "^2.10.0",
|
|
135
|
+
"eslint-plugin-regexp": "^2.5.0",
|
|
131
136
|
"eslint-plugin-toml": "^0.11.0",
|
|
132
137
|
"eslint-plugin-unicorn": "^52.0.0",
|
|
133
138
|
"eslint-plugin-unused-imports": "^3.2.0",
|
|
134
139
|
"eslint-plugin-vitest": "^0.5.4",
|
|
135
|
-
"eslint-plugin-vue": "^9.
|
|
140
|
+
"eslint-plugin-vue": "^9.26.0",
|
|
136
141
|
"eslint-plugin-yml": "^1.14.0",
|
|
137
142
|
"eslint-processor-vue-blocks": "^0.1.2",
|
|
138
|
-
globals: "^15.
|
|
143
|
+
globals: "^15.2.0",
|
|
139
144
|
"jsonc-eslint-parser": "^2.4.0",
|
|
140
145
|
"local-pkg": "^0.5.0",
|
|
141
146
|
"parse-gitignore": "^2.0.0",
|
|
@@ -147,40 +152,42 @@ var package_default = {
|
|
|
147
152
|
},
|
|
148
153
|
devDependencies: {
|
|
149
154
|
"@antfu/eslint-config": "workspace:*",
|
|
150
|
-
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
151
155
|
"@antfu/ni": "^0.21.12",
|
|
152
156
|
"@eslint-react/eslint-plugin": "^1.5.11",
|
|
153
157
|
"@eslint/config-inspector": "^0.4.8",
|
|
154
|
-
"@
|
|
158
|
+
"@prettier/plugin-xml": "^3.4.1",
|
|
159
|
+
"@stylistic/eslint-plugin-migrate": "^2.1.0",
|
|
155
160
|
"@types/eslint": "^8.56.10",
|
|
156
161
|
"@types/fs-extra": "^11.0.4",
|
|
157
162
|
"@types/node": "^20.12.11",
|
|
158
163
|
"@types/prompts": "^2.4.9",
|
|
159
164
|
"@types/yargs": "^17.0.32",
|
|
160
|
-
"@unocss/eslint-plugin": "^0.
|
|
165
|
+
"@unocss/eslint-plugin": "^0.60.2",
|
|
161
166
|
"astro-eslint-parser": "^1.0.2",
|
|
162
167
|
bumpp: "^9.4.1",
|
|
163
168
|
"bundle-require": "^4.1.0",
|
|
164
|
-
eslint: "
|
|
165
|
-
"eslint-plugin-astro": "^1.
|
|
169
|
+
eslint: "npm:eslint-ts-patch@9.2.0-6",
|
|
170
|
+
"eslint-plugin-astro": "^1.2.0",
|
|
166
171
|
"eslint-plugin-format": "^0.1.1",
|
|
167
172
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
168
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
173
|
+
"eslint-plugin-react-refresh": "^0.4.7",
|
|
169
174
|
"eslint-plugin-solid": "^0.14.0",
|
|
170
|
-
"eslint-plugin-svelte": "2.
|
|
175
|
+
"eslint-plugin-svelte": "^2.39.0",
|
|
176
|
+
"eslint-ts-patch": "9.2.0-6",
|
|
171
177
|
"eslint-typegen": "^0.2.4",
|
|
172
178
|
esno: "^4.7.0",
|
|
173
|
-
execa: "^
|
|
179
|
+
execa: "^9.1.0",
|
|
174
180
|
"fast-glob": "^3.3.2",
|
|
175
181
|
"fs-extra": "^11.2.0",
|
|
176
182
|
"lint-staged": "^15.2.2",
|
|
177
183
|
"prettier-plugin-astro": "^0.13.0",
|
|
178
184
|
"prettier-plugin-slidev": "^1.0.5",
|
|
179
|
-
rimraf: "^5.0.
|
|
185
|
+
rimraf: "^5.0.7",
|
|
180
186
|
"simple-git-hooks": "^2.11.1",
|
|
181
187
|
svelte: "^4.2.16",
|
|
182
|
-
"svelte-eslint-parser": "^0.
|
|
188
|
+
"svelte-eslint-parser": "^0.36.0",
|
|
183
189
|
tsup: "^8.0.2",
|
|
190
|
+
tsx: "^4.10.2",
|
|
184
191
|
typescript: "^5.4.5",
|
|
185
192
|
vitest: "^1.6.0",
|
|
186
193
|
vue: "^3.4.27"
|
|
@@ -236,6 +243,7 @@ var vscodeSettingsString = `
|
|
|
236
243
|
"jsonc",
|
|
237
244
|
"yaml",
|
|
238
245
|
"toml",
|
|
246
|
+
"xml",
|
|
239
247
|
"gql",
|
|
240
248
|
"graphql",
|
|
241
249
|
"astro"
|
|
@@ -455,7 +463,7 @@ async function updateVscodeSettings(result) {
|
|
|
455
463
|
p3.log.success(c4.green(`Created .vscode/settings.json`));
|
|
456
464
|
} else {
|
|
457
465
|
let settingsContent = await fsp3.readFile(settingsPath, "utf8");
|
|
458
|
-
settingsContent = settingsContent.trim().replace(/\s
|
|
466
|
+
settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
|
|
459
467
|
settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
|
|
460
468
|
settingsContent += `${vscodeSettingsString}}
|
|
461
469
|
`;
|
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ __export(src_exports, {
|
|
|
56
56
|
GLOB_TS: () => GLOB_TS,
|
|
57
57
|
GLOB_TSX: () => GLOB_TSX,
|
|
58
58
|
GLOB_VUE: () => GLOB_VUE,
|
|
59
|
+
GLOB_XML: () => GLOB_XML,
|
|
59
60
|
GLOB_YAML: () => GLOB_YAML,
|
|
60
61
|
StylisticConfigDefaults: () => StylisticConfigDefaults,
|
|
61
62
|
antfu: () => antfu,
|
|
@@ -79,6 +80,7 @@ __export(src_exports, {
|
|
|
79
80
|
parserPlain: () => parserPlain,
|
|
80
81
|
perfectionist: () => perfectionist,
|
|
81
82
|
react: () => react,
|
|
83
|
+
regexp: () => regexp,
|
|
82
84
|
renamePluginInConfigs: () => renamePluginInConfigs,
|
|
83
85
|
renameRules: () => renameRules,
|
|
84
86
|
resolveSubOptions: () => resolveSubOptions,
|
|
@@ -125,6 +127,7 @@ var GLOB_SVELTE = "**/*.svelte";
|
|
|
125
127
|
var GLOB_VUE = "**/*.vue";
|
|
126
128
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
127
129
|
var GLOB_TOML = "**/*.toml";
|
|
130
|
+
var GLOB_XML = "**/*.xml";
|
|
128
131
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
129
132
|
var GLOB_ASTRO = "**/*.astro";
|
|
130
133
|
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
@@ -145,6 +148,7 @@ var GLOB_ALL_SRC = [
|
|
|
145
148
|
GLOB_SVELTE,
|
|
146
149
|
GLOB_VUE,
|
|
147
150
|
GLOB_YAML,
|
|
151
|
+
GLOB_XML,
|
|
148
152
|
GLOB_HTML
|
|
149
153
|
];
|
|
150
154
|
var GLOB_EXCLUDE = [
|
|
@@ -202,8 +206,8 @@ var parserPlain = {
|
|
|
202
206
|
}
|
|
203
207
|
})
|
|
204
208
|
};
|
|
205
|
-
async function combine(...
|
|
206
|
-
const resolved = await Promise.all(
|
|
209
|
+
async function combine(...configs2) {
|
|
210
|
+
const resolved = await Promise.all(configs2);
|
|
207
211
|
return resolved.flat();
|
|
208
212
|
}
|
|
209
213
|
function renameRules(rules, map) {
|
|
@@ -217,8 +221,8 @@ function renameRules(rules, map) {
|
|
|
217
221
|
})
|
|
218
222
|
);
|
|
219
223
|
}
|
|
220
|
-
function renamePluginInConfigs(
|
|
221
|
-
return
|
|
224
|
+
function renamePluginInConfigs(configs2, map) {
|
|
225
|
+
return configs2.map((i) => {
|
|
222
226
|
const clone = { ...i };
|
|
223
227
|
if (clone.rules)
|
|
224
228
|
clone.rules = renameRules(clone.rules, map);
|
|
@@ -405,13 +409,15 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
405
409
|
graphql: true,
|
|
406
410
|
html: true,
|
|
407
411
|
markdown: true,
|
|
408
|
-
slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli")
|
|
412
|
+
slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli"),
|
|
413
|
+
xml: (0, import_local_pkg2.isPackageExists)("@prettier/plugin-xml")
|
|
409
414
|
};
|
|
410
415
|
}
|
|
411
416
|
await ensurePackages([
|
|
412
417
|
"eslint-plugin-format",
|
|
413
418
|
options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0,
|
|
414
|
-
options.astro ? "prettier-plugin-astro" : void 0
|
|
419
|
+
options.astro ? "prettier-plugin-astro" : void 0,
|
|
420
|
+
options.xml ? "@prettier/plugin-xml" : void 0
|
|
415
421
|
]);
|
|
416
422
|
if (options.slidev && options.markdown !== true && options.markdown !== "prettier")
|
|
417
423
|
throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
@@ -434,6 +440,12 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
434
440
|
},
|
|
435
441
|
options.prettierOptions || {}
|
|
436
442
|
);
|
|
443
|
+
const prettierXmlOptions = {
|
|
444
|
+
xmlQuoteAttributes: "double",
|
|
445
|
+
xmlSelfClosingSpace: true,
|
|
446
|
+
xmlSortAttributesByKey: false,
|
|
447
|
+
xmlWhitespaceSensitivity: "ignore"
|
|
448
|
+
};
|
|
437
449
|
const dprintOptions = Object.assign(
|
|
438
450
|
{
|
|
439
451
|
indentWidth: typeof indent === "number" ? indent : 2,
|
|
@@ -443,7 +455,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
443
455
|
options.dprintOptions || {}
|
|
444
456
|
);
|
|
445
457
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
446
|
-
const
|
|
458
|
+
const configs2 = [
|
|
447
459
|
{
|
|
448
460
|
name: "antfu/formatter/setup",
|
|
449
461
|
plugins: {
|
|
@@ -452,7 +464,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
452
464
|
}
|
|
453
465
|
];
|
|
454
466
|
if (options.css) {
|
|
455
|
-
|
|
467
|
+
configs2.push(
|
|
456
468
|
{
|
|
457
469
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
458
470
|
languageOptions: {
|
|
@@ -504,7 +516,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
504
516
|
);
|
|
505
517
|
}
|
|
506
518
|
if (options.html) {
|
|
507
|
-
|
|
519
|
+
configs2.push({
|
|
508
520
|
files: [GLOB_HTML],
|
|
509
521
|
languageOptions: {
|
|
510
522
|
parser: parserPlain
|
|
@@ -521,10 +533,32 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
521
533
|
}
|
|
522
534
|
});
|
|
523
535
|
}
|
|
536
|
+
if (options.xml) {
|
|
537
|
+
configs2.push({
|
|
538
|
+
files: [GLOB_XML],
|
|
539
|
+
languageOptions: {
|
|
540
|
+
parser: parserPlain
|
|
541
|
+
},
|
|
542
|
+
name: "antfu/formatter/xml",
|
|
543
|
+
rules: {
|
|
544
|
+
"format/prettier": [
|
|
545
|
+
"error",
|
|
546
|
+
{
|
|
547
|
+
...prettierXmlOptions,
|
|
548
|
+
...prettierOptions,
|
|
549
|
+
parser: "xml",
|
|
550
|
+
plugins: [
|
|
551
|
+
"@prettier/plugin-xml"
|
|
552
|
+
]
|
|
553
|
+
}
|
|
554
|
+
]
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
}
|
|
524
558
|
if (options.markdown) {
|
|
525
559
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
526
560
|
const GLOB_SLIDEV = !options.slidev ? [] : options.slidev === true ? ["**/slides.md"] : options.slidev.files;
|
|
527
|
-
|
|
561
|
+
configs2.push({
|
|
528
562
|
files: [GLOB_MARKDOWN],
|
|
529
563
|
ignores: GLOB_SLIDEV,
|
|
530
564
|
languageOptions: {
|
|
@@ -547,7 +581,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
547
581
|
}
|
|
548
582
|
});
|
|
549
583
|
if (options.slidev) {
|
|
550
|
-
|
|
584
|
+
configs2.push({
|
|
551
585
|
files: GLOB_SLIDEV,
|
|
552
586
|
languageOptions: {
|
|
553
587
|
parser: parserPlain
|
|
@@ -571,7 +605,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
571
605
|
}
|
|
572
606
|
}
|
|
573
607
|
if (options.astro) {
|
|
574
|
-
|
|
608
|
+
configs2.push({
|
|
575
609
|
files: [GLOB_ASTRO],
|
|
576
610
|
languageOptions: {
|
|
577
611
|
parser: parserPlain
|
|
@@ -592,7 +626,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
592
626
|
});
|
|
593
627
|
}
|
|
594
628
|
if (options.graphql) {
|
|
595
|
-
|
|
629
|
+
configs2.push({
|
|
596
630
|
files: [GLOB_GRAPHQL],
|
|
597
631
|
languageOptions: {
|
|
598
632
|
parser: parserPlain
|
|
@@ -609,7 +643,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
609
643
|
}
|
|
610
644
|
});
|
|
611
645
|
}
|
|
612
|
-
return
|
|
646
|
+
return configs2;
|
|
613
647
|
}
|
|
614
648
|
|
|
615
649
|
// src/configs/ignores.ts
|
|
@@ -2238,6 +2272,31 @@ async function yaml(options = {}) {
|
|
|
2238
2272
|
];
|
|
2239
2273
|
}
|
|
2240
2274
|
|
|
2275
|
+
// src/configs/regexp.ts
|
|
2276
|
+
var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
2277
|
+
async function regexp(options = {}) {
|
|
2278
|
+
const config = import_eslint_plugin_regexp.configs["flat/recommended"];
|
|
2279
|
+
const rules = {
|
|
2280
|
+
...config.rules
|
|
2281
|
+
};
|
|
2282
|
+
if (options.level === "warn") {
|
|
2283
|
+
for (const key in rules) {
|
|
2284
|
+
if (rules[key] === "error")
|
|
2285
|
+
rules[key] = "warn";
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
return [
|
|
2289
|
+
{
|
|
2290
|
+
...config,
|
|
2291
|
+
name: "antfu/regexp/rules",
|
|
2292
|
+
rules: {
|
|
2293
|
+
...rules,
|
|
2294
|
+
...options.overrides
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
];
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2241
2300
|
// src/factory.ts
|
|
2242
2301
|
var flatConfigProps = [
|
|
2243
2302
|
"name",
|
|
@@ -2276,6 +2335,7 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2276
2335
|
gitignore: enableGitignore = true,
|
|
2277
2336
|
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.VSCODE_CWD || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
|
|
2278
2337
|
react: enableReact = false,
|
|
2338
|
+
regexp: enableRegexp = true,
|
|
2279
2339
|
solid: enableSolid = false,
|
|
2280
2340
|
svelte: enableSvelte = false,
|
|
2281
2341
|
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
@@ -2285,16 +2345,16 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2285
2345
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2286
2346
|
if (stylisticOptions && !("jsx" in stylisticOptions))
|
|
2287
2347
|
stylisticOptions.jsx = options.jsx ?? true;
|
|
2288
|
-
const
|
|
2348
|
+
const configs2 = [];
|
|
2289
2349
|
if (enableGitignore) {
|
|
2290
2350
|
if (typeof enableGitignore !== "boolean") {
|
|
2291
|
-
|
|
2351
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
2292
2352
|
} else {
|
|
2293
2353
|
if (import_node_fs.default.existsSync(".gitignore"))
|
|
2294
|
-
|
|
2354
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
2295
2355
|
}
|
|
2296
2356
|
}
|
|
2297
|
-
|
|
2357
|
+
configs2.push(
|
|
2298
2358
|
ignores(),
|
|
2299
2359
|
javascript({
|
|
2300
2360
|
isInEditor,
|
|
@@ -2316,27 +2376,29 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2316
2376
|
if (enableVue)
|
|
2317
2377
|
componentExts.push("vue");
|
|
2318
2378
|
if (enableTypeScript) {
|
|
2319
|
-
|
|
2379
|
+
configs2.push(typescript({
|
|
2320
2380
|
...resolveSubOptions(options, "typescript"),
|
|
2321
2381
|
componentExts,
|
|
2322
2382
|
overrides: getOverrides(options, "typescript")
|
|
2323
2383
|
}));
|
|
2324
2384
|
}
|
|
2325
2385
|
if (stylisticOptions) {
|
|
2326
|
-
|
|
2386
|
+
configs2.push(stylistic({
|
|
2327
2387
|
...stylisticOptions,
|
|
2328
2388
|
lessOpinionated: options.lessOpinionated,
|
|
2329
2389
|
overrides: getOverrides(options, "stylistic")
|
|
2330
2390
|
}));
|
|
2331
2391
|
}
|
|
2392
|
+
if (enableRegexp)
|
|
2393
|
+
configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
|
|
2332
2394
|
if (options.test ?? true) {
|
|
2333
|
-
|
|
2395
|
+
configs2.push(test({
|
|
2334
2396
|
isInEditor,
|
|
2335
2397
|
overrides: getOverrides(options, "test")
|
|
2336
2398
|
}));
|
|
2337
2399
|
}
|
|
2338
2400
|
if (enableVue) {
|
|
2339
|
-
|
|
2401
|
+
configs2.push(vue({
|
|
2340
2402
|
...resolveSubOptions(options, "vue"),
|
|
2341
2403
|
overrides: getOverrides(options, "vue"),
|
|
2342
2404
|
stylistic: stylisticOptions,
|
|
@@ -2344,39 +2406,39 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2344
2406
|
}));
|
|
2345
2407
|
}
|
|
2346
2408
|
if (enableReact) {
|
|
2347
|
-
|
|
2409
|
+
configs2.push(react({
|
|
2348
2410
|
overrides: getOverrides(options, "react"),
|
|
2349
2411
|
tsconfigPath: getOverrides(options, "typescript").tsconfigPath
|
|
2350
2412
|
}));
|
|
2351
2413
|
}
|
|
2352
2414
|
if (enableSolid) {
|
|
2353
|
-
|
|
2415
|
+
configs2.push(solid({
|
|
2354
2416
|
overrides: getOverrides(options, "solid"),
|
|
2355
2417
|
tsconfigPath: getOverrides(options, "typescript").tsconfigPath,
|
|
2356
2418
|
typescript: !!enableTypeScript
|
|
2357
2419
|
}));
|
|
2358
2420
|
}
|
|
2359
2421
|
if (enableSvelte) {
|
|
2360
|
-
|
|
2422
|
+
configs2.push(svelte({
|
|
2361
2423
|
overrides: getOverrides(options, "svelte"),
|
|
2362
2424
|
stylistic: stylisticOptions,
|
|
2363
2425
|
typescript: !!enableTypeScript
|
|
2364
2426
|
}));
|
|
2365
2427
|
}
|
|
2366
2428
|
if (enableUnoCSS) {
|
|
2367
|
-
|
|
2429
|
+
configs2.push(unocss({
|
|
2368
2430
|
...resolveSubOptions(options, "unocss"),
|
|
2369
2431
|
overrides: getOverrides(options, "unocss")
|
|
2370
2432
|
}));
|
|
2371
2433
|
}
|
|
2372
2434
|
if (enableAstro) {
|
|
2373
|
-
|
|
2435
|
+
configs2.push(astro({
|
|
2374
2436
|
overrides: getOverrides(options, "astro"),
|
|
2375
2437
|
stylistic: stylisticOptions
|
|
2376
2438
|
}));
|
|
2377
2439
|
}
|
|
2378
2440
|
if (options.jsonc ?? true) {
|
|
2379
|
-
|
|
2441
|
+
configs2.push(
|
|
2380
2442
|
jsonc({
|
|
2381
2443
|
overrides: getOverrides(options, "jsonc"),
|
|
2382
2444
|
stylistic: stylisticOptions
|
|
@@ -2386,19 +2448,19 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2386
2448
|
);
|
|
2387
2449
|
}
|
|
2388
2450
|
if (options.yaml ?? true) {
|
|
2389
|
-
|
|
2451
|
+
configs2.push(yaml({
|
|
2390
2452
|
overrides: getOverrides(options, "yaml"),
|
|
2391
2453
|
stylistic: stylisticOptions
|
|
2392
2454
|
}));
|
|
2393
2455
|
}
|
|
2394
2456
|
if (options.toml ?? true) {
|
|
2395
|
-
|
|
2457
|
+
configs2.push(toml({
|
|
2396
2458
|
overrides: getOverrides(options, "toml"),
|
|
2397
2459
|
stylistic: stylisticOptions
|
|
2398
2460
|
}));
|
|
2399
2461
|
}
|
|
2400
2462
|
if (options.markdown ?? true) {
|
|
2401
|
-
|
|
2463
|
+
configs2.push(
|
|
2402
2464
|
markdown(
|
|
2403
2465
|
{
|
|
2404
2466
|
componentExts,
|
|
@@ -2408,7 +2470,7 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2408
2470
|
);
|
|
2409
2471
|
}
|
|
2410
2472
|
if (options.formatters) {
|
|
2411
|
-
|
|
2473
|
+
configs2.push(formatters(
|
|
2412
2474
|
options.formatters,
|
|
2413
2475
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2414
2476
|
));
|
|
@@ -2419,10 +2481,10 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2419
2481
|
return acc;
|
|
2420
2482
|
}, {});
|
|
2421
2483
|
if (Object.keys(fusedConfig).length)
|
|
2422
|
-
|
|
2484
|
+
configs2.push([fusedConfig]);
|
|
2423
2485
|
let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
|
|
2424
2486
|
composer = composer.append(
|
|
2425
|
-
...
|
|
2487
|
+
...configs2,
|
|
2426
2488
|
...userConfigs
|
|
2427
2489
|
);
|
|
2428
2490
|
if (autoRenamePlugins) {
|
|
@@ -2471,6 +2533,7 @@ var src_default = antfu;
|
|
|
2471
2533
|
GLOB_TS,
|
|
2472
2534
|
GLOB_TSX,
|
|
2473
2535
|
GLOB_VUE,
|
|
2536
|
+
GLOB_XML,
|
|
2474
2537
|
GLOB_YAML,
|
|
2475
2538
|
StylisticConfigDefaults,
|
|
2476
2539
|
antfu,
|
|
@@ -2493,6 +2556,7 @@ var src_default = antfu;
|
|
|
2493
2556
|
parserPlain,
|
|
2494
2557
|
perfectionist,
|
|
2495
2558
|
react,
|
|
2559
|
+
regexp,
|
|
2496
2560
|
renamePluginInConfigs,
|
|
2497
2561
|
renameRules,
|
|
2498
2562
|
resolveSubOptions,
|