@dhzh/eslint-config 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +33 -47
- package/dist/cli.js +49 -63
- package/dist/index.cjs +12 -6
- package/dist/index.d.cts +12005 -59
- package/dist/index.d.ts +12005 -59
- package/dist/index.js +15 -10
- package/package.json +26 -40
package/dist/cli.cjs
CHANGED
|
@@ -48,7 +48,7 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
48
48
|
var package_default = {
|
|
49
49
|
name: "@dhzh/eslint-config",
|
|
50
50
|
type: "module",
|
|
51
|
-
version: "0.1.
|
|
51
|
+
version: "0.1.3",
|
|
52
52
|
packageManager: "pnpm@8.15.4",
|
|
53
53
|
description: "Easton's ESLint config",
|
|
54
54
|
author: "Easton Zheng <dhzhme@gmail.com>",
|
|
@@ -71,11 +71,12 @@ var package_default = {
|
|
|
71
71
|
"dist"
|
|
72
72
|
],
|
|
73
73
|
scripts: {
|
|
74
|
-
build: "tsup --format esm,cjs --clean --dts",
|
|
74
|
+
build: "nr typegen && tsup --format esm,cjs --clean --dts",
|
|
75
75
|
stub: "tsup --format esm",
|
|
76
76
|
dev: "tsup --format esm,cjs --watch & eslint-flat-config-viewer",
|
|
77
77
|
watch: "tsup --format esm,cjs --watch",
|
|
78
78
|
lint: "eslint .",
|
|
79
|
+
typegen: "esno scripts/typegen.ts",
|
|
79
80
|
prepack: "nr build",
|
|
80
81
|
release: "bumpp && pnpm publish --access=public",
|
|
81
82
|
test: "vitest",
|
|
@@ -88,10 +89,7 @@ var package_default = {
|
|
|
88
89
|
eslint: ">=8.40.0",
|
|
89
90
|
"eslint-plugin-astro": "^0.31.4",
|
|
90
91
|
"eslint-plugin-format": ">=0.1.0",
|
|
91
|
-
"eslint-plugin-
|
|
92
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
93
|
-
"eslint-plugin-react-refresh": "^0.4.4",
|
|
94
|
-
"eslint-plugin-svelte": "^2.34.1",
|
|
92
|
+
"eslint-plugin-svelte": "^2.35.1",
|
|
95
93
|
"prettier-plugin-astro": "^0.13.0",
|
|
96
94
|
"prettier-plugin-slidev": "^1.0.5",
|
|
97
95
|
"svelte-eslint-parser": "^0.33.1"
|
|
@@ -109,15 +107,6 @@ var package_default = {
|
|
|
109
107
|
"eslint-plugin-format": {
|
|
110
108
|
optional: true
|
|
111
109
|
},
|
|
112
|
-
"eslint-plugin-react": {
|
|
113
|
-
optional: true
|
|
114
|
-
},
|
|
115
|
-
"eslint-plugin-react-hooks": {
|
|
116
|
-
optional: true
|
|
117
|
-
},
|
|
118
|
-
"eslint-plugin-react-refresh": {
|
|
119
|
-
optional: true
|
|
120
|
-
},
|
|
121
110
|
"eslint-plugin-svelte": {
|
|
122
111
|
optional: true
|
|
123
112
|
},
|
|
@@ -132,22 +121,19 @@ var package_default = {
|
|
|
132
121
|
}
|
|
133
122
|
},
|
|
134
123
|
dependencies: {
|
|
135
|
-
"@antfu/
|
|
136
|
-
"@antfu/install-pkg": "^0.3.1",
|
|
124
|
+
"@antfu/install-pkg": "^0.3.2",
|
|
137
125
|
"@clack/prompts": "^0.7.0",
|
|
138
|
-
"@eslint-types/jsdoc": "46.8.2-1",
|
|
139
|
-
"@eslint-types/typescript-eslint": "^7.0.2",
|
|
140
|
-
"@eslint-types/unicorn": "^51.0.1",
|
|
141
126
|
"@stylistic/eslint-plugin": "^1.7.0",
|
|
142
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
143
|
-
"@typescript-eslint/parser": "^7.
|
|
127
|
+
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
128
|
+
"@typescript-eslint/parser": "^7.4.0",
|
|
144
129
|
"eslint-config-flat-gitignore": "^0.1.3",
|
|
130
|
+
"eslint-flat-config-utils": "^0.1.1",
|
|
145
131
|
"eslint-merge-processors": "^0.1.0",
|
|
146
132
|
"eslint-plugin-antfu": "^2.1.2",
|
|
147
133
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
148
|
-
"eslint-plugin-import-x": "^0.4.
|
|
134
|
+
"eslint-plugin-import-x": "^0.4.4",
|
|
149
135
|
"eslint-plugin-jsdoc": "^48.2.1",
|
|
150
|
-
"eslint-plugin-jsonc": "^2.
|
|
136
|
+
"eslint-plugin-jsonc": "^2.14.1",
|
|
151
137
|
"eslint-plugin-markdown": "^4.0.1",
|
|
152
138
|
"eslint-plugin-n": "^16.6.2",
|
|
153
139
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
@@ -158,11 +144,11 @@ var package_default = {
|
|
|
158
144
|
"eslint-plugin-toml": "^0.9.2",
|
|
159
145
|
"eslint-plugin-unicorn": "^51.0.1",
|
|
160
146
|
"eslint-plugin-unused-imports": "^3.1.0",
|
|
161
|
-
"eslint-plugin-vitest": "^0.
|
|
162
|
-
"eslint-plugin-vue": "^9.
|
|
163
|
-
"eslint-plugin-yml": "^1.
|
|
147
|
+
"eslint-plugin-vitest": "^0.4.0",
|
|
148
|
+
"eslint-plugin-vue": "^9.24.0",
|
|
149
|
+
"eslint-plugin-yml": "^1.13.2",
|
|
164
150
|
"eslint-processor-vue-blocks": "^0.1.1",
|
|
165
|
-
globals: "^
|
|
151
|
+
globals: "^15.0.0",
|
|
166
152
|
"jsonc-eslint-parser": "^2.4.0",
|
|
167
153
|
"local-pkg": "^0.5.0",
|
|
168
154
|
"parse-gitignore": "^2.0.0",
|
|
@@ -177,20 +163,20 @@ var package_default = {
|
|
|
177
163
|
"@antfu/ni": "^0.21.12",
|
|
178
164
|
"@dhzh/eslint-config": "workspace:*",
|
|
179
165
|
"@stylistic/eslint-plugin-migrate": "^1.7.0",
|
|
180
|
-
"@types/eslint": "^8.56.
|
|
166
|
+
"@types/eslint": "^8.56.6",
|
|
181
167
|
"@types/fs-extra": "^11.0.4",
|
|
182
|
-
"@types/node": "^20.11.
|
|
168
|
+
"@types/node": "^20.11.30",
|
|
183
169
|
"@types/prompts": "^2.4.9",
|
|
184
170
|
"@types/yargs": "^17.0.32",
|
|
185
|
-
"@unocss/eslint-plugin": "^0.58.
|
|
171
|
+
"@unocss/eslint-plugin": "^0.58.7",
|
|
186
172
|
"astro-eslint-parser": "^0.16.3",
|
|
187
173
|
bumpp: "^9.4.0",
|
|
188
|
-
eslint: "
|
|
189
|
-
"eslint-flat-config-viewer": "^0.1.
|
|
190
|
-
"eslint-plugin-astro": "^0.
|
|
174
|
+
eslint: "9.0.0-rc.0",
|
|
175
|
+
"eslint-flat-config-viewer": "^0.1.14",
|
|
176
|
+
"eslint-plugin-astro": "^0.33.1",
|
|
191
177
|
"eslint-plugin-format": "^0.1.0",
|
|
192
|
-
"eslint-plugin-svelte": "
|
|
193
|
-
"eslint-
|
|
178
|
+
"eslint-plugin-svelte": "2.36.0-next.13",
|
|
179
|
+
"eslint-typegen": "^0.1.4",
|
|
194
180
|
esno: "^4.7.0",
|
|
195
181
|
execa: "^8.0.1",
|
|
196
182
|
"fast-glob": "^3.3.2",
|
|
@@ -199,12 +185,12 @@ var package_default = {
|
|
|
199
185
|
"prettier-plugin-astro": "^0.13.0",
|
|
200
186
|
"prettier-plugin-slidev": "^1.0.5",
|
|
201
187
|
rimraf: "^5.0.5",
|
|
202
|
-
"simple-git-hooks": "^2.
|
|
188
|
+
"simple-git-hooks": "^2.11.1",
|
|
203
189
|
svelte: "^4.2.12",
|
|
204
190
|
"svelte-eslint-parser": "^0.33.1",
|
|
205
191
|
tsup: "^8.0.2",
|
|
206
|
-
typescript: "^5.4.
|
|
207
|
-
vitest: "^1.
|
|
192
|
+
typescript: "^5.4.3",
|
|
193
|
+
vitest: "^1.4.0",
|
|
208
194
|
vue: "^3.4.21"
|
|
209
195
|
},
|
|
210
196
|
"simple-git-hooks": {
|
|
@@ -261,14 +247,14 @@ var vscodeSettingsString = `
|
|
|
261
247
|
]
|
|
262
248
|
`;
|
|
263
249
|
var frameworkOptions = [
|
|
264
|
-
{
|
|
265
|
-
label: import_picocolors.default.green("Vue"),
|
|
266
|
-
value: "vue"
|
|
267
|
-
},
|
|
268
250
|
{
|
|
269
251
|
label: import_picocolors.default.cyan("React"),
|
|
270
252
|
value: "react"
|
|
271
253
|
},
|
|
254
|
+
{
|
|
255
|
+
label: import_picocolors.default.green("Vue"),
|
|
256
|
+
value: "vue"
|
|
257
|
+
},
|
|
272
258
|
{
|
|
273
259
|
label: import_picocolors.default.red("Svelte"),
|
|
274
260
|
value: "svelte"
|
|
@@ -340,15 +326,14 @@ var import_node_process = __toESM(require("process"), 1);
|
|
|
340
326
|
var import_picocolors2 = __toESM(require("picocolors"), 1);
|
|
341
327
|
var p = __toESM(require("@clack/prompts"), 1);
|
|
342
328
|
async function updatePackageJson(result) {
|
|
343
|
-
var _a;
|
|
344
329
|
const cwd = import_node_process.default.cwd();
|
|
345
330
|
const pathPackageJSON = import_node_path.default.join(cwd, "package.json");
|
|
346
331
|
p.log.step(import_picocolors2.default.cyan(`Bumping @dhzh/eslint-config to v${package_default.version}`));
|
|
347
332
|
const pkgContent = await import_promises.default.readFile(pathPackageJSON, "utf-8");
|
|
348
333
|
const pkg = JSON.parse(pkgContent);
|
|
349
|
-
pkg.devDependencies
|
|
334
|
+
pkg.devDependencies ??= {};
|
|
350
335
|
pkg.devDependencies["@dhzh/eslint-config"] = `^${package_default.version}`;
|
|
351
|
-
|
|
336
|
+
pkg.devDependencies.eslint ??= package_default.devDependencies.eslint.replace("npm:eslint-ts-patch@", "").replace(/-\d+$/, "");
|
|
352
337
|
const addedPackages = [];
|
|
353
338
|
if (result.extra.length) {
|
|
354
339
|
result.extra.forEach((item) => {
|
|
@@ -505,7 +490,8 @@ async function run(options = {}) {
|
|
|
505
490
|
const message = !isArgTemplateValid && argTemplate ? `"${argTemplate}" isn't a valid template. Please choose from below: ` : "Select a framework:";
|
|
506
491
|
return p4.multiselect({
|
|
507
492
|
message: import_picocolors5.default.reset(message),
|
|
508
|
-
options: frameworkOptions
|
|
493
|
+
options: frameworkOptions,
|
|
494
|
+
required: false
|
|
509
495
|
});
|
|
510
496
|
},
|
|
511
497
|
extra: ({ results }) => {
|
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// src/cli/index.ts
|
|
2
|
-
import process5 from "process";
|
|
2
|
+
import process5 from "node:process";
|
|
3
3
|
import c6 from "picocolors";
|
|
4
4
|
import { hideBin } from "yargs/helpers";
|
|
5
5
|
import yargs from "yargs";
|
|
6
6
|
import * as p5 from "@clack/prompts";
|
|
7
7
|
|
|
8
8
|
// src/cli/run.ts
|
|
9
|
-
import fs3 from "fs";
|
|
10
|
-
import path4 from "path";
|
|
11
|
-
import process4 from "process";
|
|
9
|
+
import fs3 from "node:fs";
|
|
10
|
+
import path4 from "node:path";
|
|
11
|
+
import process4 from "node:process";
|
|
12
12
|
import c5 from "picocolors";
|
|
13
13
|
import * as p4 from "@clack/prompts";
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ import c from "picocolors";
|
|
|
19
19
|
var package_default = {
|
|
20
20
|
name: "@dhzh/eslint-config",
|
|
21
21
|
type: "module",
|
|
22
|
-
version: "0.1.
|
|
22
|
+
version: "0.1.3",
|
|
23
23
|
packageManager: "pnpm@8.15.4",
|
|
24
24
|
description: "Easton's ESLint config",
|
|
25
25
|
author: "Easton Zheng <dhzhme@gmail.com>",
|
|
@@ -42,11 +42,12 @@ var package_default = {
|
|
|
42
42
|
"dist"
|
|
43
43
|
],
|
|
44
44
|
scripts: {
|
|
45
|
-
build: "tsup --format esm,cjs --clean --dts",
|
|
45
|
+
build: "nr typegen && tsup --format esm,cjs --clean --dts",
|
|
46
46
|
stub: "tsup --format esm",
|
|
47
47
|
dev: "tsup --format esm,cjs --watch & eslint-flat-config-viewer",
|
|
48
48
|
watch: "tsup --format esm,cjs --watch",
|
|
49
49
|
lint: "eslint .",
|
|
50
|
+
typegen: "esno scripts/typegen.ts",
|
|
50
51
|
prepack: "nr build",
|
|
51
52
|
release: "bumpp && pnpm publish --access=public",
|
|
52
53
|
test: "vitest",
|
|
@@ -59,10 +60,7 @@ var package_default = {
|
|
|
59
60
|
eslint: ">=8.40.0",
|
|
60
61
|
"eslint-plugin-astro": "^0.31.4",
|
|
61
62
|
"eslint-plugin-format": ">=0.1.0",
|
|
62
|
-
"eslint-plugin-
|
|
63
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
64
|
-
"eslint-plugin-react-refresh": "^0.4.4",
|
|
65
|
-
"eslint-plugin-svelte": "^2.34.1",
|
|
63
|
+
"eslint-plugin-svelte": "^2.35.1",
|
|
66
64
|
"prettier-plugin-astro": "^0.13.0",
|
|
67
65
|
"prettier-plugin-slidev": "^1.0.5",
|
|
68
66
|
"svelte-eslint-parser": "^0.33.1"
|
|
@@ -80,15 +78,6 @@ var package_default = {
|
|
|
80
78
|
"eslint-plugin-format": {
|
|
81
79
|
optional: true
|
|
82
80
|
},
|
|
83
|
-
"eslint-plugin-react": {
|
|
84
|
-
optional: true
|
|
85
|
-
},
|
|
86
|
-
"eslint-plugin-react-hooks": {
|
|
87
|
-
optional: true
|
|
88
|
-
},
|
|
89
|
-
"eslint-plugin-react-refresh": {
|
|
90
|
-
optional: true
|
|
91
|
-
},
|
|
92
81
|
"eslint-plugin-svelte": {
|
|
93
82
|
optional: true
|
|
94
83
|
},
|
|
@@ -103,22 +92,19 @@ var package_default = {
|
|
|
103
92
|
}
|
|
104
93
|
},
|
|
105
94
|
dependencies: {
|
|
106
|
-
"@antfu/
|
|
107
|
-
"@antfu/install-pkg": "^0.3.1",
|
|
95
|
+
"@antfu/install-pkg": "^0.3.2",
|
|
108
96
|
"@clack/prompts": "^0.7.0",
|
|
109
|
-
"@eslint-types/jsdoc": "46.8.2-1",
|
|
110
|
-
"@eslint-types/typescript-eslint": "^7.0.2",
|
|
111
|
-
"@eslint-types/unicorn": "^51.0.1",
|
|
112
97
|
"@stylistic/eslint-plugin": "^1.7.0",
|
|
113
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
114
|
-
"@typescript-eslint/parser": "^7.
|
|
98
|
+
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
99
|
+
"@typescript-eslint/parser": "^7.4.0",
|
|
115
100
|
"eslint-config-flat-gitignore": "^0.1.3",
|
|
101
|
+
"eslint-flat-config-utils": "^0.1.1",
|
|
116
102
|
"eslint-merge-processors": "^0.1.0",
|
|
117
103
|
"eslint-plugin-antfu": "^2.1.2",
|
|
118
104
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
119
|
-
"eslint-plugin-import-x": "^0.4.
|
|
105
|
+
"eslint-plugin-import-x": "^0.4.4",
|
|
120
106
|
"eslint-plugin-jsdoc": "^48.2.1",
|
|
121
|
-
"eslint-plugin-jsonc": "^2.
|
|
107
|
+
"eslint-plugin-jsonc": "^2.14.1",
|
|
122
108
|
"eslint-plugin-markdown": "^4.0.1",
|
|
123
109
|
"eslint-plugin-n": "^16.6.2",
|
|
124
110
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
@@ -129,11 +115,11 @@ var package_default = {
|
|
|
129
115
|
"eslint-plugin-toml": "^0.9.2",
|
|
130
116
|
"eslint-plugin-unicorn": "^51.0.1",
|
|
131
117
|
"eslint-plugin-unused-imports": "^3.1.0",
|
|
132
|
-
"eslint-plugin-vitest": "^0.
|
|
133
|
-
"eslint-plugin-vue": "^9.
|
|
134
|
-
"eslint-plugin-yml": "^1.
|
|
118
|
+
"eslint-plugin-vitest": "^0.4.0",
|
|
119
|
+
"eslint-plugin-vue": "^9.24.0",
|
|
120
|
+
"eslint-plugin-yml": "^1.13.2",
|
|
135
121
|
"eslint-processor-vue-blocks": "^0.1.1",
|
|
136
|
-
globals: "^
|
|
122
|
+
globals: "^15.0.0",
|
|
137
123
|
"jsonc-eslint-parser": "^2.4.0",
|
|
138
124
|
"local-pkg": "^0.5.0",
|
|
139
125
|
"parse-gitignore": "^2.0.0",
|
|
@@ -148,20 +134,20 @@ var package_default = {
|
|
|
148
134
|
"@antfu/ni": "^0.21.12",
|
|
149
135
|
"@dhzh/eslint-config": "workspace:*",
|
|
150
136
|
"@stylistic/eslint-plugin-migrate": "^1.7.0",
|
|
151
|
-
"@types/eslint": "^8.56.
|
|
137
|
+
"@types/eslint": "^8.56.6",
|
|
152
138
|
"@types/fs-extra": "^11.0.4",
|
|
153
|
-
"@types/node": "^20.11.
|
|
139
|
+
"@types/node": "^20.11.30",
|
|
154
140
|
"@types/prompts": "^2.4.9",
|
|
155
141
|
"@types/yargs": "^17.0.32",
|
|
156
|
-
"@unocss/eslint-plugin": "^0.58.
|
|
142
|
+
"@unocss/eslint-plugin": "^0.58.7",
|
|
157
143
|
"astro-eslint-parser": "^0.16.3",
|
|
158
144
|
bumpp: "^9.4.0",
|
|
159
|
-
eslint: "
|
|
160
|
-
"eslint-flat-config-viewer": "^0.1.
|
|
161
|
-
"eslint-plugin-astro": "^0.
|
|
145
|
+
eslint: "9.0.0-rc.0",
|
|
146
|
+
"eslint-flat-config-viewer": "^0.1.14",
|
|
147
|
+
"eslint-plugin-astro": "^0.33.1",
|
|
162
148
|
"eslint-plugin-format": "^0.1.0",
|
|
163
|
-
"eslint-plugin-svelte": "
|
|
164
|
-
"eslint-
|
|
149
|
+
"eslint-plugin-svelte": "2.36.0-next.13",
|
|
150
|
+
"eslint-typegen": "^0.1.4",
|
|
165
151
|
esno: "^4.7.0",
|
|
166
152
|
execa: "^8.0.1",
|
|
167
153
|
"fast-glob": "^3.3.2",
|
|
@@ -170,12 +156,12 @@ var package_default = {
|
|
|
170
156
|
"prettier-plugin-astro": "^0.13.0",
|
|
171
157
|
"prettier-plugin-slidev": "^1.0.5",
|
|
172
158
|
rimraf: "^5.0.5",
|
|
173
|
-
"simple-git-hooks": "^2.
|
|
159
|
+
"simple-git-hooks": "^2.11.1",
|
|
174
160
|
svelte: "^4.2.12",
|
|
175
161
|
"svelte-eslint-parser": "^0.33.1",
|
|
176
162
|
tsup: "^8.0.2",
|
|
177
|
-
typescript: "^5.4.
|
|
178
|
-
vitest: "^1.
|
|
163
|
+
typescript: "^5.4.3",
|
|
164
|
+
vitest: "^1.4.0",
|
|
179
165
|
vue: "^3.4.21"
|
|
180
166
|
},
|
|
181
167
|
"simple-git-hooks": {
|
|
@@ -232,14 +218,14 @@ var vscodeSettingsString = `
|
|
|
232
218
|
]
|
|
233
219
|
`;
|
|
234
220
|
var frameworkOptions = [
|
|
235
|
-
{
|
|
236
|
-
label: c.green("Vue"),
|
|
237
|
-
value: "vue"
|
|
238
|
-
},
|
|
239
221
|
{
|
|
240
222
|
label: c.cyan("React"),
|
|
241
223
|
value: "react"
|
|
242
224
|
},
|
|
225
|
+
{
|
|
226
|
+
label: c.green("Vue"),
|
|
227
|
+
value: "vue"
|
|
228
|
+
},
|
|
243
229
|
{
|
|
244
230
|
label: c.red("Svelte"),
|
|
245
231
|
value: "svelte"
|
|
@@ -283,7 +269,7 @@ var dependenciesMap = {
|
|
|
283
269
|
};
|
|
284
270
|
|
|
285
271
|
// src/cli/utils.ts
|
|
286
|
-
import { execSync } from "child_process";
|
|
272
|
+
import { execSync } from "node:child_process";
|
|
287
273
|
function isGitClean() {
|
|
288
274
|
try {
|
|
289
275
|
execSync("git diff-index --quiet HEAD --");
|
|
@@ -305,21 +291,20 @@ ${config}
|
|
|
305
291
|
}
|
|
306
292
|
|
|
307
293
|
// src/cli/stages/update-package-json.ts
|
|
308
|
-
import path from "path";
|
|
309
|
-
import fsp from "fs/promises";
|
|
310
|
-
import process from "process";
|
|
294
|
+
import path from "node:path";
|
|
295
|
+
import fsp from "node:fs/promises";
|
|
296
|
+
import process from "node:process";
|
|
311
297
|
import c2 from "picocolors";
|
|
312
298
|
import * as p from "@clack/prompts";
|
|
313
299
|
async function updatePackageJson(result) {
|
|
314
|
-
var _a;
|
|
315
300
|
const cwd = process.cwd();
|
|
316
301
|
const pathPackageJSON = path.join(cwd, "package.json");
|
|
317
302
|
p.log.step(c2.cyan(`Bumping @dhzh/eslint-config to v${package_default.version}`));
|
|
318
303
|
const pkgContent = await fsp.readFile(pathPackageJSON, "utf-8");
|
|
319
304
|
const pkg = JSON.parse(pkgContent);
|
|
320
|
-
pkg.devDependencies
|
|
305
|
+
pkg.devDependencies ??= {};
|
|
321
306
|
pkg.devDependencies["@dhzh/eslint-config"] = `^${package_default.version}`;
|
|
322
|
-
|
|
307
|
+
pkg.devDependencies.eslint ??= package_default.devDependencies.eslint.replace("npm:eslint-ts-patch@", "").replace(/-\d+$/, "");
|
|
323
308
|
const addedPackages = [];
|
|
324
309
|
if (result.extra.length) {
|
|
325
310
|
result.extra.forEach((item) => {
|
|
@@ -362,10 +347,10 @@ async function updatePackageJson(result) {
|
|
|
362
347
|
}
|
|
363
348
|
|
|
364
349
|
// src/cli/stages/update-eslint-files.ts
|
|
365
|
-
import fs from "fs";
|
|
366
|
-
import fsp2 from "fs/promises";
|
|
367
|
-
import process2 from "process";
|
|
368
|
-
import path2 from "path";
|
|
350
|
+
import fs from "node:fs";
|
|
351
|
+
import fsp2 from "node:fs/promises";
|
|
352
|
+
import process2 from "node:process";
|
|
353
|
+
import path2 from "node:path";
|
|
369
354
|
import c3 from "picocolors";
|
|
370
355
|
import * as p2 from "@clack/prompts";
|
|
371
356
|
import parse from "parse-gitignore";
|
|
@@ -415,10 +400,10 @@ async function updateEslintFiles(result) {
|
|
|
415
400
|
}
|
|
416
401
|
|
|
417
402
|
// src/cli/stages/update-vscode-settings.ts
|
|
418
|
-
import path3 from "path";
|
|
419
|
-
import fsp3 from "fs/promises";
|
|
420
|
-
import fs2 from "fs";
|
|
421
|
-
import process3 from "process";
|
|
403
|
+
import path3 from "node:path";
|
|
404
|
+
import fsp3 from "node:fs/promises";
|
|
405
|
+
import fs2 from "node:fs";
|
|
406
|
+
import process3 from "node:process";
|
|
422
407
|
import c4 from "picocolors";
|
|
423
408
|
import * as p3 from "@clack/prompts";
|
|
424
409
|
async function updateVscodeSettings(result) {
|
|
@@ -476,7 +461,8 @@ async function run(options = {}) {
|
|
|
476
461
|
const message = !isArgTemplateValid && argTemplate ? `"${argTemplate}" isn't a valid template. Please choose from below: ` : "Select a framework:";
|
|
477
462
|
return p4.multiselect({
|
|
478
463
|
message: c5.reset(message),
|
|
479
|
-
options: frameworkOptions
|
|
464
|
+
options: frameworkOptions,
|
|
465
|
+
required: false
|
|
480
466
|
});
|
|
481
467
|
},
|
|
482
468
|
extra: ({ results }) => {
|
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(src_exports, {
|
|
|
34
34
|
GLOB_ASTRO: () => GLOB_ASTRO,
|
|
35
35
|
GLOB_CSS: () => GLOB_CSS,
|
|
36
36
|
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
37
|
+
GLOB_GRAPHQL: () => GLOB_GRAPHQL,
|
|
37
38
|
GLOB_HTML: () => GLOB_HTML,
|
|
38
39
|
GLOB_JS: () => GLOB_JS,
|
|
39
40
|
GLOB_JSON: () => GLOB_JSON,
|
|
@@ -99,6 +100,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
99
100
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
100
101
|
var import_node_fs = __toESM(require("fs"), 1);
|
|
101
102
|
var import_local_pkg4 = require("local-pkg");
|
|
103
|
+
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
102
104
|
|
|
103
105
|
// src/plugins.ts
|
|
104
106
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
@@ -150,6 +152,7 @@ var GLOB_YAML = "**/*.y?(a)ml";
|
|
|
150
152
|
var GLOB_TOML = "**/*.toml";
|
|
151
153
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
152
154
|
var GLOB_ASTRO = "**/*.astro";
|
|
155
|
+
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
153
156
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
154
157
|
var GLOB_TESTS = [
|
|
155
158
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -1031,7 +1034,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
1031
1034
|
}
|
|
1032
1035
|
if (options.graphql) {
|
|
1033
1036
|
configs.push({
|
|
1034
|
-
files: [
|
|
1037
|
+
files: [GLOB_GRAPHQL],
|
|
1035
1038
|
languageOptions: {
|
|
1036
1039
|
parser: parserPlain
|
|
1037
1040
|
},
|
|
@@ -2101,7 +2104,7 @@ var defaultPluginRenaming = {
|
|
|
2101
2104
|
"vitest": "test",
|
|
2102
2105
|
"yml": "yaml"
|
|
2103
2106
|
};
|
|
2104
|
-
|
|
2107
|
+
function dhzh(options = {}, ...userConfigs) {
|
|
2105
2108
|
const {
|
|
2106
2109
|
astro: enableAstro = false,
|
|
2107
2110
|
autoRenamePlugins = true,
|
|
@@ -2243,13 +2246,15 @@ async function dhzh(options = {}, ...userConfigs) {
|
|
|
2243
2246
|
}, {});
|
|
2244
2247
|
if (Object.keys(fusedConfig).length)
|
|
2245
2248
|
configs.push([fusedConfig]);
|
|
2246
|
-
|
|
2249
|
+
let pipeline = new import_eslint_flat_config_utils.FlatConfigPipeline();
|
|
2250
|
+
pipeline = pipeline.append(
|
|
2247
2251
|
...configs,
|
|
2248
2252
|
...userConfigs
|
|
2249
2253
|
);
|
|
2250
|
-
if (autoRenamePlugins)
|
|
2251
|
-
|
|
2252
|
-
|
|
2254
|
+
if (autoRenamePlugins) {
|
|
2255
|
+
pipeline = pipeline.renamePlugins(defaultPluginRenaming);
|
|
2256
|
+
}
|
|
2257
|
+
return pipeline;
|
|
2253
2258
|
}
|
|
2254
2259
|
function resolveSubOptions(options, key) {
|
|
2255
2260
|
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
@@ -2270,6 +2275,7 @@ var src_default = dhzh;
|
|
|
2270
2275
|
GLOB_ASTRO,
|
|
2271
2276
|
GLOB_CSS,
|
|
2272
2277
|
GLOB_EXCLUDE,
|
|
2278
|
+
GLOB_GRAPHQL,
|
|
2273
2279
|
GLOB_HTML,
|
|
2274
2280
|
GLOB_JS,
|
|
2275
2281
|
GLOB_JSON,
|