@dhzh/eslint-config 1.25.2 → 1.27.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.
@@ -0,0 +1,28 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ Object.defineProperty(exports, "__toESM", {
24
+ enumerable: true,
25
+ get: function() {
26
+ return __toESM;
27
+ }
28
+ });
@@ -1,190 +1,56 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
1
+ const require_chunk = require("../chunk-CKQMccvm.cjs");
2
+ let node_process = require("node:process");
3
+ node_process = require_chunk.__toESM(node_process, 1);
4
+ let _clack_prompts = require("@clack/prompts");
5
+ _clack_prompts = require_chunk.__toESM(_clack_prompts, 1);
6
+ let ansis = require("ansis");
7
+ ansis = require_chunk.__toESM(ansis, 1);
8
+ let cac = require("cac");
9
+ let node_fs_promises = require("node:fs/promises");
10
+ node_fs_promises = require_chunk.__toESM(node_fs_promises, 1);
11
+ let node_path = require("node:path");
12
+ node_path = require_chunk.__toESM(node_path, 1);
13
+ let node_fs = require("node:fs");
14
+ node_fs = require_chunk.__toESM(node_fs, 1);
15
+ //#region package.json
16
+ var version = "1.27.0";
17
+ var devDependencies = {
18
+ "@eslint/config-inspector": "^2.0.0",
19
+ "@prettier/plugin-xml": "^3.4.2",
20
+ "@types/eslint-plugin-tailwindcss": "^3.17.0",
21
+ "@types/node": "^24.12.2",
22
+ "@typescript-eslint/types": "^8.59.0",
23
+ "bumpp": "^11.0.1",
24
+ "bundle-require": "^5.1.0",
25
+ "eslint": "^10.2.1",
26
+ "eslint-typegen": "^2.3.1",
27
+ "lint-staged": "^16.4.0",
28
+ "simple-git-hooks": "^2.13.1",
29
+ "tailwindcss": "^4.2.4",
30
+ "tsdown": "^0.21.10",
31
+ "tsx": "^4.21.0",
32
+ "typescript": "^6.0.3"
15
33
  };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
-
25
- // src/cli/index.ts
26
- var p6 = __toESM(require("@clack/prompts"), 1);
27
- var import_ansis6 = __toESM(require("ansis"), 1);
28
- var import_cac = require("cac");
29
-
30
- // package.json
31
- var version = "1.25.2";
32
- var package_default = {
33
- name: "@dhzh/eslint-config",
34
- type: "module",
35
- version,
36
- packageManager: "pnpm@10.31.0",
37
- description: "tinywaves's ESLint config",
38
- author: {
39
- name: "Lyle Zheng",
40
- email: "dhzhme@gmail.com"
41
- },
42
- license: "MIT",
43
- homepage: "https://github.com/tinywaves/eslint-config",
44
- repository: {
45
- type: "git",
46
- url: "git+https://github.com/tinywaves/eslint-config"
47
- },
48
- bugs: {
49
- url: "https://github.com/tinywaves/eslint-config/issues"
50
- },
51
- keywords: [
52
- "eslint",
53
- "eslint-config"
54
- ],
55
- sideEffects: false,
56
- exports: {
57
- ".": {
58
- import: "./dist/index.js",
59
- require: "./dist/index.cjs"
60
- }
61
- },
62
- main: "./dist/index.js",
63
- types: "./dist/index.d.ts",
64
- bin: "./bin/index.js",
65
- files: [
66
- "bin",
67
- "dist"
68
- ],
69
- engines: {
70
- node: "^22.13.0 || >=24"
71
- },
72
- scripts: {
73
- build: "pnpm run typegen && tsup --clean --dts",
74
- "build:inspector": "pnpm run build && npx @eslint/config-inspector build",
75
- dev: "pnpm run typegen && npx @eslint/config-inspector --config eslint.config.ts",
76
- lint: "eslint",
77
- "lint-fix": "eslint --fix .",
78
- prepack: "pnpm run build",
79
- prepare: "simple-git-hooks",
80
- release: "bumpp",
81
- typecheck: "tsc --noEmit",
82
- typegen: "tsx scripts/eslint-typegen.ts"
83
- },
84
- peerDependencies: {
85
- "@prettier/plugin-xml": "^3.4.2",
86
- eslint: "^10.0.3"
87
- },
88
- peerDependenciesMeta: {
89
- "@prettier/plugin-xml": {
90
- optional: true
91
- }
92
- },
93
- dependencies: {
94
- "@clack/prompts": "^1.1.0",
95
- "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
96
- "@eslint-react/eslint-plugin": "^2.13.0",
97
- "@eslint/js": "^10.0.1",
98
- "@stylistic/eslint-plugin": "^5.10.0",
99
- "@unocss/eslint-config": "66.6.6",
100
- ansis: "^4.2.0",
101
- cac: "^7.0.0",
102
- "eslint-merge-processors": "^2.0.0",
103
- "eslint-plugin-antfu": "^3.2.2",
104
- "eslint-plugin-format": "^2.0.1",
105
- "eslint-plugin-import-x": "^4.16.1",
106
- "eslint-plugin-jsonc": "^3.1.1",
107
- "eslint-plugin-n": "^17.24.0",
108
- "eslint-plugin-package-json": "^0.89.4",
109
- "eslint-plugin-react-compiler": "19.1.0-rc.2",
110
- "eslint-plugin-react-google-translate": "^0.1.1",
111
- "eslint-plugin-react-hooks": "^7.0.1",
112
- "eslint-plugin-react-refresh": "^0.5.2",
113
- "eslint-plugin-regexp": "^3.0.0",
114
- "eslint-plugin-simple-import-sort": "^12.1.1",
115
- "eslint-plugin-tailwindcss": "4.0.0-beta.0",
116
- "eslint-plugin-toml": "^1.3.1",
117
- "eslint-plugin-unicorn": "^63.0.0",
118
- "eslint-plugin-unused-imports": "^4.4.1",
119
- "eslint-plugin-vue": "^10.8.0",
120
- "eslint-plugin-yml": "^3.3.1",
121
- "eslint-processor-vue-blocks": "^2.0.0",
122
- globals: "^17.4.0",
123
- "local-pkg": "^1.1.2",
124
- "toml-eslint-parser": "^1.0.3",
125
- "typescript-eslint": "^8.56.1",
126
- "vue-eslint-parser": "^10.4.0"
127
- },
128
- devDependencies: {
129
- "@eslint/config-inspector": "^1.5.0",
130
- "@prettier/plugin-xml": "^3.4.2",
131
- "@types/eslint-plugin-tailwindcss": "^3.17.0",
132
- "@types/node": "^24.12.0",
133
- "@typescript-eslint/types": "^8.56.1",
134
- bumpp: "^10.4.1",
135
- "bundle-require": "^5.1.0",
136
- eslint: "^10.0.3",
137
- "eslint-typegen": "^2.3.1",
138
- "lint-staged": "^16.3.2",
139
- "simple-git-hooks": "^2.13.1",
140
- tailwindcss: "^4.2.1",
141
- tsup: "^8.5.1",
142
- tsx: "^4.21.0",
143
- typescript: "^5.9.3"
144
- },
145
- "simple-git-hooks": {
146
- "pre-commit": "npx lint-staged"
147
- },
148
- "lint-staged": {
149
- "*": "eslint --fix"
150
- }
151
- };
152
-
153
- // src/cli/run.ts
154
- var p5 = __toESM(require("@clack/prompts"), 1);
155
- var import_ansis5 = __toESM(require("ansis"), 1);
156
-
157
- // src/cli/stages/update-package-json.ts
158
- var import_promises = __toESM(require("fs/promises"), 1);
159
- var import_node_path = __toESM(require("path"), 1);
160
- var import_node_process = __toESM(require("process"), 1);
161
- var p = __toESM(require("@clack/prompts"), 1);
162
- var import_ansis = __toESM(require("ansis"), 1);
34
+ //#endregion
35
+ //#region src/cli/stages/update-package-json.ts
163
36
  async function updatePackageJson() {
164
- const cwd = import_node_process.default.cwd();
165
- const pathPackageJSON = import_node_path.default.join(cwd, "package.json");
166
- p.log.step(import_ansis.default.cyan`Bumping @dhzh/eslint-config to v${version}`);
167
- const pkgContent = await import_promises.default.readFile(pathPackageJSON, "utf8");
168
- const pkg = JSON.parse(pkgContent);
169
- pkg.devDependencies ??= {};
170
- pkg.devDependencies["@dhzh/eslint-config"] = `^${version}`;
171
- pkg.devDependencies.eslint ??= package_default.devDependencies.eslint;
172
- pkg.scripts ??= {};
173
- pkg.scripts.lint = "eslint .";
174
- pkg.scripts["lint-fix"] = "eslint --fix .";
175
- await import_promises.default.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
176
- p.log.success(import_ansis.default.green`Changes wrote to package.json`);
37
+ const cwd = node_process.default.cwd();
38
+ const pathPackageJSON = node_path.default.join(cwd, "package.json");
39
+ _clack_prompts.log.step(ansis.default.cyan`Bumping @dhzh/eslint-config to v${version}`);
40
+ const pkgContent = await node_fs_promises.default.readFile(pathPackageJSON, "utf8");
41
+ const pkg = JSON.parse(pkgContent);
42
+ pkg.devDependencies ??= {};
43
+ pkg.devDependencies["@dhzh/eslint-config"] = `^${version}`;
44
+ pkg.devDependencies.eslint ??= devDependencies.eslint;
45
+ pkg.scripts ??= {};
46
+ pkg.scripts.lint = "eslint .";
47
+ pkg.scripts["lint-fix"] = "eslint --fix .";
48
+ await node_fs_promises.default.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
49
+ _clack_prompts.log.success(ansis.default.green`Changes wrote to package.json`);
177
50
  }
178
-
179
- // src/cli/stages/update-eslint-config.ts
180
- var import_promises2 = __toESM(require("fs/promises"), 1);
181
- var import_node_path2 = __toESM(require("path"), 1);
182
- var import_node_process2 = __toESM(require("process"), 1);
183
- var import_ansis2 = __toESM(require("ansis"), 1);
184
- var p2 = __toESM(require("@clack/prompts"), 1);
185
-
186
- // src/cli/constants.ts
187
- var vscodeSettingsString = `
51
+ //#endregion
52
+ //#region src/cli/constants.ts
53
+ const vscodeSettingsString = `
188
54
  // Entry
189
55
  "eslint.format.enable": true,
190
56
  "eslint.ignoreUntitled": true,
@@ -292,7 +158,7 @@ var vscodeSettingsString = `
292
158
  "editor.defaultFormatter": "dbaeumer.vscode-eslint"
293
159
  }
294
160
  `;
295
- var eslintConfigContent = (options) => `import { defineConfig } from '@dhzh/eslint-config';
161
+ const eslintConfigContent = (options) => `import { defineConfig } from '@dhzh/eslint-config';
296
162
 
297
163
  export default defineConfig(${options.hasNest ? `{
298
164
  configs: {
@@ -302,114 +168,92 @@ export default defineConfig(${options.hasNest ? `{
302
168
  },
303
169
  }` : ""});
304
170
  `;
305
- var npmignoreString = `# If these files (ESLint flat config files) are not included in .npmignore,
171
+ const npmignoreString = `# If these files (ESLint flat config files) are not included in .npmignore,
306
172
  # they will be published, and importing devDependencies in published files will trigger \`n/no-unpublished-import\` errors.
307
173
  eslint.config.js
308
174
  eslint.config.mjs
309
175
  `;
310
-
311
- // src/cli/stages/update-eslint-config.ts
176
+ //#endregion
177
+ //#region src/cli/stages/update-eslint-config.ts
312
178
  async function updateEslintConfig(options) {
313
- const cwd = import_node_process2.default.cwd();
314
- const pathPackageJSON = import_node_path2.default.join(cwd, "package.json");
315
- const pkgContent = await import_promises2.default.readFile(pathPackageJSON, "utf8");
316
- const pkg = JSON.parse(pkgContent);
317
- const configFileName = pkg.type === "module" ? "eslint.config.js" : "eslint.config.mjs";
318
- const pathFlatConfig = import_node_path2.default.join(cwd, configFileName);
319
- await import_promises2.default.writeFile(pathFlatConfig, eslintConfigContent(options));
320
- p2.log.success(import_ansis2.default.green`Created ${configFileName}`);
179
+ const cwd = node_process.default.cwd();
180
+ const pathPackageJSON = node_path.default.join(cwd, "package.json");
181
+ const pkgContent = await node_fs_promises.default.readFile(pathPackageJSON, "utf8");
182
+ const configFileName = JSON.parse(pkgContent).type === "module" ? "eslint.config.js" : "eslint.config.mjs";
183
+ const pathFlatConfig = node_path.default.join(cwd, configFileName);
184
+ await node_fs_promises.default.writeFile(pathFlatConfig, eslintConfigContent(options));
185
+ _clack_prompts.log.success(ansis.default.green`Created ${configFileName}`);
321
186
  }
322
-
323
- // src/cli/stages/update-npmignore.ts
324
- var import_promises3 = __toESM(require("fs/promises"), 1);
325
- var import_node_path3 = __toESM(require("path"), 1);
326
- var import_node_process3 = __toESM(require("process"), 1);
327
- var import_ansis3 = __toESM(require("ansis"), 1);
328
- var p3 = __toESM(require("@clack/prompts"), 1);
187
+ //#endregion
188
+ //#region src/cli/stages/update-npmignore.ts
329
189
  async function updateNpmignore() {
330
- const cwd = import_node_process3.default.cwd();
331
- const npmignoreFileName = ".npmignore";
332
- const npmignoreFilePath = import_node_path3.default.join(cwd, npmignoreFileName);
333
- let action = "Created";
334
- try {
335
- await import_promises3.default.access(npmignoreFilePath);
336
- const existingContent = await import_promises3.default.readFile(npmignoreFilePath, "utf8");
337
- const trimmedContent = existingContent.trimEnd();
338
- await import_promises3.default.writeFile(npmignoreFilePath, `${trimmedContent}
339
- ${npmignoreString}`);
340
- action = "Updated";
341
- } catch {
342
- await import_promises3.default.writeFile(npmignoreFilePath, npmignoreString);
343
- }
344
- p3.log.success(import_ansis3.default.green`${action} ${npmignoreFileName}`);
190
+ const cwd = node_process.default.cwd();
191
+ const npmignoreFileName = ".npmignore";
192
+ const npmignoreFilePath = node_path.default.join(cwd, npmignoreFileName);
193
+ let action = "Created";
194
+ try {
195
+ await node_fs_promises.default.access(npmignoreFilePath);
196
+ const trimmedContent = (await node_fs_promises.default.readFile(npmignoreFilePath, "utf8")).trimEnd();
197
+ await node_fs_promises.default.writeFile(npmignoreFilePath, `${trimmedContent}\n${npmignoreString}`);
198
+ action = "Updated";
199
+ } catch {
200
+ await node_fs_promises.default.writeFile(npmignoreFilePath, npmignoreString);
201
+ }
202
+ _clack_prompts.log.success(ansis.default.green`${action} ${npmignoreFileName}`);
345
203
  }
346
-
347
- // src/cli/stages/update-vscode-settings.ts
348
- var import_node_fs = __toESM(require("fs"), 1);
349
- var import_promises4 = __toESM(require("fs/promises"), 1);
350
- var import_node_path4 = __toESM(require("path"), 1);
351
- var import_node_process4 = __toESM(require("process"), 1);
352
- var import_ansis4 = require("ansis");
353
- var p4 = __toESM(require("@clack/prompts"), 1);
204
+ //#endregion
205
+ //#region src/cli/stages/update-vscode-settings.ts
354
206
  async function updateVscodeSettings() {
355
- const cwd = import_node_process4.default.cwd();
356
- const dotVscodePath = import_node_path4.default.join(cwd, ".vscode");
357
- const settingsPath = import_node_path4.default.join(dotVscodePath, "settings.json");
358
- if (!import_node_fs.default.existsSync(dotVscodePath)) {
359
- await import_promises4.default.mkdir(dotVscodePath, { recursive: true });
360
- }
361
- if (import_node_fs.default.existsSync(settingsPath)) {
362
- let settingsContent = await import_promises4.default.readFile(settingsPath, "utf8");
363
- settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
364
- settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
365
- settingsContent += `${vscodeSettingsString}}
366
- `;
367
- await import_promises4.default.writeFile(settingsPath, settingsContent, "utf8");
368
- p4.log.success(import_ansis4.green`Updated .vscode/settings.json`);
369
- } else {
370
- await import_promises4.default.writeFile(settingsPath, `{${vscodeSettingsString}}
371
- `, "utf8");
372
- p4.log.success(import_ansis4.green`Created .vscode/settings.json`);
373
- }
207
+ const cwd = node_process.default.cwd();
208
+ const dotVscodePath = node_path.default.join(cwd, ".vscode");
209
+ const settingsPath = node_path.default.join(dotVscodePath, "settings.json");
210
+ if (!node_fs.default.existsSync(dotVscodePath)) await node_fs_promises.default.mkdir(dotVscodePath, { recursive: true });
211
+ if (node_fs.default.existsSync(settingsPath)) {
212
+ let settingsContent = await node_fs_promises.default.readFile(settingsPath, "utf8");
213
+ settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
214
+ settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
215
+ settingsContent += `${vscodeSettingsString}}\n`;
216
+ await node_fs_promises.default.writeFile(settingsPath, settingsContent, "utf8");
217
+ _clack_prompts.log.success(ansis.green`Updated .vscode/settings.json`);
218
+ } else {
219
+ await node_fs_promises.default.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf8");
220
+ _clack_prompts.log.success(ansis.green`Created .vscode/settings.json`);
221
+ }
374
222
  }
375
-
376
- // src/cli/run.ts
223
+ //#endregion
224
+ //#region src/cli/run.ts
377
225
  async function run(options) {
378
- await updatePackageJson();
379
- await updateEslintConfig(options);
380
- await updateNpmignore();
381
- await updateVscodeSettings();
382
- p5.log.success(import_ansis5.default.green`Setup completed`);
383
- p5.outro(`Now you can update the dependencies by run ${import_ansis5.default.blue("pnpm i")} and run ${import_ansis5.default.blue("eslint --fix")}
384
- `);
226
+ await updatePackageJson();
227
+ await updateEslintConfig(options);
228
+ await updateNpmignore();
229
+ await updateVscodeSettings();
230
+ _clack_prompts.log.success(ansis.default.green`Setup completed`);
231
+ _clack_prompts.outro(`Now you can update the dependencies by run ${ansis.default.blue("pnpm i")} and run ${ansis.default.blue("eslint --fix")}\n`);
385
232
  }
386
-
387
- // src/cli/index.ts
388
- var cli = (0, import_cac.cac)("@dhzh/eslint-config");
233
+ //#endregion
234
+ //#region src/cli/index.ts
235
+ const cli = (0, cac.cac)("@dhzh/eslint-config");
389
236
  cli.command("", "Run the initialization or migration").action(async () => {
390
- console.log("\n");
391
- p6.intro(`${import_ansis6.default.green`@dhzh/eslint-config `}${import_ansis6.default.dim`v${version}`}`);
392
- const options = {
393
- hasNest: false
394
- };
395
- const hasNest = await p6.confirm({
396
- message: "Is NestJS a part of the current project?",
397
- initialValue: false
398
- });
399
- if (p6.isCancel(hasNest)) {
400
- p6.cancel("Operation cancelled");
401
- throw new Error("Operation cancelled");
402
- } else {
403
- options.hasNest = hasNest;
404
- }
405
- try {
406
- await run(options);
407
- } catch (error) {
408
- p6.log.error(import_ansis6.default.inverse.red(" Failed to migrate "));
409
- p6.log.error(import_ansis6.default.red`✘ ${String(error)}`);
410
- throw error;
411
- }
237
+ console.log("\n");
238
+ _clack_prompts.intro(`${ansis.default.green`@dhzh/eslint-config `}${ansis.default.dim`v${version}`}`);
239
+ const options = { hasNest: false };
240
+ const hasNest = await _clack_prompts.confirm({
241
+ message: "Is NestJS a part of the current project?",
242
+ initialValue: false
243
+ });
244
+ if (_clack_prompts.isCancel(hasNest)) {
245
+ _clack_prompts.cancel("Operation cancelled");
246
+ throw new Error("Operation cancelled");
247
+ } else options.hasNest = hasNest;
248
+ try {
249
+ await run(options);
250
+ } catch (error) {
251
+ _clack_prompts.log.error(ansis.default.inverse.red(" Failed to migrate "));
252
+ _clack_prompts.log.error(ansis.default.red`✘ ${String(error)}`);
253
+ throw error;
254
+ }
412
255
  });
413
256
  cli.help();
414
257
  cli.version(version);
415
258
  cli.parse();
259
+ //#endregion
@@ -1,2 +1 @@
1
-
2
- export { }
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };