@dhzh/eslint-config 0.1.2 → 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 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.2",
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,7 +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-svelte": "^2.34.1",
92
+ "eslint-plugin-svelte": "^2.35.1",
92
93
  "prettier-plugin-astro": "^0.13.0",
93
94
  "prettier-plugin-slidev": "^1.0.5",
94
95
  "svelte-eslint-parser": "^0.33.1"
@@ -120,22 +121,19 @@ var package_default = {
120
121
  }
121
122
  },
122
123
  dependencies: {
123
- "@antfu/eslint-define-config": "^1.23.0-2",
124
- "@antfu/install-pkg": "^0.3.1",
124
+ "@antfu/install-pkg": "^0.3.2",
125
125
  "@clack/prompts": "^0.7.0",
126
- "@eslint-types/jsdoc": "46.8.2-1",
127
- "@eslint-types/typescript-eslint": "^7.0.2",
128
- "@eslint-types/unicorn": "^51.0.1",
129
126
  "@stylistic/eslint-plugin": "^1.7.0",
130
- "@typescript-eslint/eslint-plugin": "^7.2.0",
131
- "@typescript-eslint/parser": "^7.2.0",
127
+ "@typescript-eslint/eslint-plugin": "^7.4.0",
128
+ "@typescript-eslint/parser": "^7.4.0",
132
129
  "eslint-config-flat-gitignore": "^0.1.3",
130
+ "eslint-flat-config-utils": "^0.1.1",
133
131
  "eslint-merge-processors": "^0.1.0",
134
132
  "eslint-plugin-antfu": "^2.1.2",
135
133
  "eslint-plugin-eslint-comments": "^3.2.0",
136
- "eslint-plugin-import-x": "^0.4.1",
134
+ "eslint-plugin-import-x": "^0.4.4",
137
135
  "eslint-plugin-jsdoc": "^48.2.1",
138
- "eslint-plugin-jsonc": "^2.13.0",
136
+ "eslint-plugin-jsonc": "^2.14.1",
139
137
  "eslint-plugin-markdown": "^4.0.1",
140
138
  "eslint-plugin-n": "^16.6.2",
141
139
  "eslint-plugin-no-only-tests": "^3.1.0",
@@ -146,11 +144,11 @@ var package_default = {
146
144
  "eslint-plugin-toml": "^0.9.2",
147
145
  "eslint-plugin-unicorn": "^51.0.1",
148
146
  "eslint-plugin-unused-imports": "^3.1.0",
149
- "eslint-plugin-vitest": "^0.3.26",
150
- "eslint-plugin-vue": "^9.23.0",
151
- "eslint-plugin-yml": "^1.12.2",
147
+ "eslint-plugin-vitest": "^0.4.0",
148
+ "eslint-plugin-vue": "^9.24.0",
149
+ "eslint-plugin-yml": "^1.13.2",
152
150
  "eslint-processor-vue-blocks": "^0.1.1",
153
- globals: "^14.0.0",
151
+ globals: "^15.0.0",
154
152
  "jsonc-eslint-parser": "^2.4.0",
155
153
  "local-pkg": "^0.5.0",
156
154
  "parse-gitignore": "^2.0.0",
@@ -165,20 +163,20 @@ var package_default = {
165
163
  "@antfu/ni": "^0.21.12",
166
164
  "@dhzh/eslint-config": "workspace:*",
167
165
  "@stylistic/eslint-plugin-migrate": "^1.7.0",
168
- "@types/eslint": "^8.56.5",
166
+ "@types/eslint": "^8.56.6",
169
167
  "@types/fs-extra": "^11.0.4",
170
- "@types/node": "^20.11.27",
168
+ "@types/node": "^20.11.30",
171
169
  "@types/prompts": "^2.4.9",
172
170
  "@types/yargs": "^17.0.32",
173
- "@unocss/eslint-plugin": "^0.58.5",
171
+ "@unocss/eslint-plugin": "^0.58.7",
174
172
  "astro-eslint-parser": "^0.16.3",
175
173
  bumpp: "^9.4.0",
176
- eslint: "npm:eslint-ts-patch@^8.57.0-0",
177
- "eslint-flat-config-viewer": "^0.1.11",
178
- "eslint-plugin-astro": "^0.31.4",
174
+ eslint: "9.0.0-rc.0",
175
+ "eslint-flat-config-viewer": "^0.1.14",
176
+ "eslint-plugin-astro": "^0.33.1",
179
177
  "eslint-plugin-format": "^0.1.0",
180
- "eslint-plugin-svelte": "^2.35.1",
181
- "eslint-ts-patch": "^8.57.0-0",
178
+ "eslint-plugin-svelte": "2.36.0-next.13",
179
+ "eslint-typegen": "^0.1.4",
182
180
  esno: "^4.7.0",
183
181
  execa: "^8.0.1",
184
182
  "fast-glob": "^3.3.2",
@@ -187,12 +185,12 @@ var package_default = {
187
185
  "prettier-plugin-astro": "^0.13.0",
188
186
  "prettier-plugin-slidev": "^1.0.5",
189
187
  rimraf: "^5.0.5",
190
- "simple-git-hooks": "^2.10.0",
188
+ "simple-git-hooks": "^2.11.1",
191
189
  svelte: "^4.2.12",
192
190
  "svelte-eslint-parser": "^0.33.1",
193
191
  tsup: "^8.0.2",
194
- typescript: "^5.4.2",
195
- vitest: "^1.3.1",
192
+ typescript: "^5.4.3",
193
+ vitest: "^1.4.0",
196
194
  vue: "^3.4.21"
197
195
  },
198
196
  "simple-git-hooks": {
@@ -328,15 +326,14 @@ var import_node_process = __toESM(require("process"), 1);
328
326
  var import_picocolors2 = __toESM(require("picocolors"), 1);
329
327
  var p = __toESM(require("@clack/prompts"), 1);
330
328
  async function updatePackageJson(result) {
331
- var _a;
332
329
  const cwd = import_node_process.default.cwd();
333
330
  const pathPackageJSON = import_node_path.default.join(cwd, "package.json");
334
331
  p.log.step(import_picocolors2.default.cyan(`Bumping @dhzh/eslint-config to v${package_default.version}`));
335
332
  const pkgContent = await import_promises.default.readFile(pathPackageJSON, "utf-8");
336
333
  const pkg = JSON.parse(pkgContent);
337
- pkg.devDependencies ?? (pkg.devDependencies = {});
334
+ pkg.devDependencies ??= {};
338
335
  pkg.devDependencies["@dhzh/eslint-config"] = `^${package_default.version}`;
339
- (_a = pkg.devDependencies).eslint ?? (_a.eslint = package_default.devDependencies.eslint.replace("npm:eslint-ts-patch@", "").replace(/-\d+$/, ""));
336
+ pkg.devDependencies.eslint ??= package_default.devDependencies.eslint.replace("npm:eslint-ts-patch@", "").replace(/-\d+$/, "");
340
337
  const addedPackages = [];
341
338
  if (result.extra.length) {
342
339
  result.extra.forEach((item) => {
@@ -493,7 +490,8 @@ async function run(options = {}) {
493
490
  const message = !isArgTemplateValid && argTemplate ? `"${argTemplate}" isn't a valid template. Please choose from below: ` : "Select a framework:";
494
491
  return p4.multiselect({
495
492
  message: import_picocolors5.default.reset(message),
496
- options: frameworkOptions
493
+ options: frameworkOptions,
494
+ required: false
497
495
  });
498
496
  },
499
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.2",
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,7 +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-svelte": "^2.34.1",
63
+ "eslint-plugin-svelte": "^2.35.1",
63
64
  "prettier-plugin-astro": "^0.13.0",
64
65
  "prettier-plugin-slidev": "^1.0.5",
65
66
  "svelte-eslint-parser": "^0.33.1"
@@ -91,22 +92,19 @@ var package_default = {
91
92
  }
92
93
  },
93
94
  dependencies: {
94
- "@antfu/eslint-define-config": "^1.23.0-2",
95
- "@antfu/install-pkg": "^0.3.1",
95
+ "@antfu/install-pkg": "^0.3.2",
96
96
  "@clack/prompts": "^0.7.0",
97
- "@eslint-types/jsdoc": "46.8.2-1",
98
- "@eslint-types/typescript-eslint": "^7.0.2",
99
- "@eslint-types/unicorn": "^51.0.1",
100
97
  "@stylistic/eslint-plugin": "^1.7.0",
101
- "@typescript-eslint/eslint-plugin": "^7.2.0",
102
- "@typescript-eslint/parser": "^7.2.0",
98
+ "@typescript-eslint/eslint-plugin": "^7.4.0",
99
+ "@typescript-eslint/parser": "^7.4.0",
103
100
  "eslint-config-flat-gitignore": "^0.1.3",
101
+ "eslint-flat-config-utils": "^0.1.1",
104
102
  "eslint-merge-processors": "^0.1.0",
105
103
  "eslint-plugin-antfu": "^2.1.2",
106
104
  "eslint-plugin-eslint-comments": "^3.2.0",
107
- "eslint-plugin-import-x": "^0.4.1",
105
+ "eslint-plugin-import-x": "^0.4.4",
108
106
  "eslint-plugin-jsdoc": "^48.2.1",
109
- "eslint-plugin-jsonc": "^2.13.0",
107
+ "eslint-plugin-jsonc": "^2.14.1",
110
108
  "eslint-plugin-markdown": "^4.0.1",
111
109
  "eslint-plugin-n": "^16.6.2",
112
110
  "eslint-plugin-no-only-tests": "^3.1.0",
@@ -117,11 +115,11 @@ var package_default = {
117
115
  "eslint-plugin-toml": "^0.9.2",
118
116
  "eslint-plugin-unicorn": "^51.0.1",
119
117
  "eslint-plugin-unused-imports": "^3.1.0",
120
- "eslint-plugin-vitest": "^0.3.26",
121
- "eslint-plugin-vue": "^9.23.0",
122
- "eslint-plugin-yml": "^1.12.2",
118
+ "eslint-plugin-vitest": "^0.4.0",
119
+ "eslint-plugin-vue": "^9.24.0",
120
+ "eslint-plugin-yml": "^1.13.2",
123
121
  "eslint-processor-vue-blocks": "^0.1.1",
124
- globals: "^14.0.0",
122
+ globals: "^15.0.0",
125
123
  "jsonc-eslint-parser": "^2.4.0",
126
124
  "local-pkg": "^0.5.0",
127
125
  "parse-gitignore": "^2.0.0",
@@ -136,20 +134,20 @@ var package_default = {
136
134
  "@antfu/ni": "^0.21.12",
137
135
  "@dhzh/eslint-config": "workspace:*",
138
136
  "@stylistic/eslint-plugin-migrate": "^1.7.0",
139
- "@types/eslint": "^8.56.5",
137
+ "@types/eslint": "^8.56.6",
140
138
  "@types/fs-extra": "^11.0.4",
141
- "@types/node": "^20.11.27",
139
+ "@types/node": "^20.11.30",
142
140
  "@types/prompts": "^2.4.9",
143
141
  "@types/yargs": "^17.0.32",
144
- "@unocss/eslint-plugin": "^0.58.5",
142
+ "@unocss/eslint-plugin": "^0.58.7",
145
143
  "astro-eslint-parser": "^0.16.3",
146
144
  bumpp: "^9.4.0",
147
- eslint: "npm:eslint-ts-patch@^8.57.0-0",
148
- "eslint-flat-config-viewer": "^0.1.11",
149
- "eslint-plugin-astro": "^0.31.4",
145
+ eslint: "9.0.0-rc.0",
146
+ "eslint-flat-config-viewer": "^0.1.14",
147
+ "eslint-plugin-astro": "^0.33.1",
150
148
  "eslint-plugin-format": "^0.1.0",
151
- "eslint-plugin-svelte": "^2.35.1",
152
- "eslint-ts-patch": "^8.57.0-0",
149
+ "eslint-plugin-svelte": "2.36.0-next.13",
150
+ "eslint-typegen": "^0.1.4",
153
151
  esno: "^4.7.0",
154
152
  execa: "^8.0.1",
155
153
  "fast-glob": "^3.3.2",
@@ -158,12 +156,12 @@ var package_default = {
158
156
  "prettier-plugin-astro": "^0.13.0",
159
157
  "prettier-plugin-slidev": "^1.0.5",
160
158
  rimraf: "^5.0.5",
161
- "simple-git-hooks": "^2.10.0",
159
+ "simple-git-hooks": "^2.11.1",
162
160
  svelte: "^4.2.12",
163
161
  "svelte-eslint-parser": "^0.33.1",
164
162
  tsup: "^8.0.2",
165
- typescript: "^5.4.2",
166
- vitest: "^1.3.1",
163
+ typescript: "^5.4.3",
164
+ vitest: "^1.4.0",
167
165
  vue: "^3.4.21"
168
166
  },
169
167
  "simple-git-hooks": {
@@ -271,7 +269,7 @@ var dependenciesMap = {
271
269
  };
272
270
 
273
271
  // src/cli/utils.ts
274
- import { execSync } from "child_process";
272
+ import { execSync } from "node:child_process";
275
273
  function isGitClean() {
276
274
  try {
277
275
  execSync("git diff-index --quiet HEAD --");
@@ -293,21 +291,20 @@ ${config}
293
291
  }
294
292
 
295
293
  // src/cli/stages/update-package-json.ts
296
- import path from "path";
297
- import fsp from "fs/promises";
298
- import process from "process";
294
+ import path from "node:path";
295
+ import fsp from "node:fs/promises";
296
+ import process from "node:process";
299
297
  import c2 from "picocolors";
300
298
  import * as p from "@clack/prompts";
301
299
  async function updatePackageJson(result) {
302
- var _a;
303
300
  const cwd = process.cwd();
304
301
  const pathPackageJSON = path.join(cwd, "package.json");
305
302
  p.log.step(c2.cyan(`Bumping @dhzh/eslint-config to v${package_default.version}`));
306
303
  const pkgContent = await fsp.readFile(pathPackageJSON, "utf-8");
307
304
  const pkg = JSON.parse(pkgContent);
308
- pkg.devDependencies ?? (pkg.devDependencies = {});
305
+ pkg.devDependencies ??= {};
309
306
  pkg.devDependencies["@dhzh/eslint-config"] = `^${package_default.version}`;
310
- (_a = pkg.devDependencies).eslint ?? (_a.eslint = package_default.devDependencies.eslint.replace("npm:eslint-ts-patch@", "").replace(/-\d+$/, ""));
307
+ pkg.devDependencies.eslint ??= package_default.devDependencies.eslint.replace("npm:eslint-ts-patch@", "").replace(/-\d+$/, "");
311
308
  const addedPackages = [];
312
309
  if (result.extra.length) {
313
310
  result.extra.forEach((item) => {
@@ -350,10 +347,10 @@ async function updatePackageJson(result) {
350
347
  }
351
348
 
352
349
  // src/cli/stages/update-eslint-files.ts
353
- import fs from "fs";
354
- import fsp2 from "fs/promises";
355
- import process2 from "process";
356
- 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";
357
354
  import c3 from "picocolors";
358
355
  import * as p2 from "@clack/prompts";
359
356
  import parse from "parse-gitignore";
@@ -403,10 +400,10 @@ async function updateEslintFiles(result) {
403
400
  }
404
401
 
405
402
  // src/cli/stages/update-vscode-settings.ts
406
- import path3 from "path";
407
- import fsp3 from "fs/promises";
408
- import fs2 from "fs";
409
- 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";
410
407
  import c4 from "picocolors";
411
408
  import * as p3 from "@clack/prompts";
412
409
  async function updateVscodeSettings(result) {
@@ -464,7 +461,8 @@ async function run(options = {}) {
464
461
  const message = !isArgTemplateValid && argTemplate ? `"${argTemplate}" isn't a valid template. Please choose from below: ` : "Select a framework:";
465
462
  return p4.multiselect({
466
463
  message: c5.reset(message),
467
- options: frameworkOptions
464
+ options: frameworkOptions,
465
+ required: false
468
466
  });
469
467
  },
470
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: ["**/*.graphql"],
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
- async function dhzh(options = {}, ...userConfigs) {
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
- const merged = await combine(
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
- return renamePluginInConfigs(merged, defaultPluginRenaming);
2252
- return merged;
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,