@vida0905/eslint-config 2.1.0 → 2.1.2

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +13 -15
  2. package/package.json +16 -18
package/dist/cli/index.js CHANGED
@@ -1,13 +1,12 @@
1
1
  import process from "node:process";
2
- import yargs from "yargs";
3
- import { hideBin } from "yargs/helpers";
2
+ import { cac } from "cac";
4
3
  import fs from "node:fs";
5
4
  import fsp from "node:fs/promises";
6
5
  import path from "node:path";
7
6
  import { green } from "ansis";
8
7
 
9
8
  //#region package.json
10
- var version = "2.1.0";
9
+ var version = "2.1.2";
11
10
 
12
11
  //#endregion
13
12
  //#region src/cli/constants.ts
@@ -64,7 +63,7 @@ const vscodeSettingsString = `
64
63
  `;
65
64
 
66
65
  //#endregion
67
- //#region src/cli/update-vscode-settings.ts
66
+ //#region src/cli/update/update-vscode-settings.ts
68
67
  async function updateVSCodeSettings() {
69
68
  const cwd = process.cwd();
70
69
  const dotVscodePath = path.join(cwd, ".vscode");
@@ -84,25 +83,24 @@ async function updateVSCodeSettings() {
84
83
  }
85
84
 
86
85
  //#endregion
87
- //#region src/cli/run.ts
88
- async function run(options = {}) {
89
- if (options.vscode) await updateVSCodeSettings();
86
+ //#region src/cli/update/index.ts
87
+ async function update(files = []) {
88
+ if (files.includes("vscode")) await updateVSCodeSettings();
90
89
  }
91
90
 
92
91
  //#endregion
93
92
  //#region src/cli/index.ts
94
- const instance = yargs(hideBin(process.argv)).scriptName("@vida0905/eslint-config").usage("").command("*", "Run the initialization", (args) => args.option("vscode", {
95
- description: "Update .vscode/settings.json",
96
- type: "boolean",
97
- default: true
98
- }), async (args) => {
93
+ const cli = cac("@vida0905/eslint-config");
94
+ cli.command("update [...files]", "Update configuration files for specified files").alias("up").option("vscode", "Update .vscode/settings.json").action(async (files) => {
99
95
  try {
100
- await run(args);
96
+ await update(files);
101
97
  } catch (error) {
102
98
  console.error(`✘ ${String(error)}`);
103
99
  process.exit(1);
104
100
  }
105
- }).showHelpOnFail(false).alias("h", "help").version("version", version).alias("v", "version");
106
- instance.help().argv;
101
+ });
102
+ cli.help();
103
+ cli.version(version);
104
+ cli.parse();
107
105
 
108
106
  //#endregion
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@vida0905/eslint-config",
3
3
  "type": "module",
4
- "version": "2.1.0",
5
- "packageManager": "pnpm@10.3.0",
4
+ "version": "2.1.2",
5
+ "packageManager": "pnpm@10.4.1",
6
6
  "description": "Vida Xie's ESLint Config",
7
7
  "author": "Vida Xie <vida_2020@163.com> (https://github.com/9romise/)",
8
8
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "typegen": "tsx scripts/typegen",
34
34
  "typecheck": "tsc --noEmit",
35
35
  "lint": "eslint .",
36
- "lint:fix": "eslint . --fix",
36
+ "check": "npm run typecheck && npm run lint",
37
37
  "prepack": "npm run build",
38
38
  "prepare": "npm run typegen && simple-git-hooks"
39
39
  },
@@ -41,32 +41,30 @@
41
41
  "eslint": ">=9.10.0"
42
42
  },
43
43
  "dependencies": {
44
- "@antfu/eslint-config": "^4.2.0",
45
- "ansis": "^3.14.0",
44
+ "@antfu/eslint-config": "^4.3.0",
45
+ "ansis": "^3.15.0",
46
+ "cac": "^6.7.14",
46
47
  "eslint-flat-config-utils": "^2.0.1",
47
- "eslint-import-resolver-oxc": "^0.10.1",
48
- "eslint-plugin-de-morgan": "^1.0.1",
48
+ "eslint-import-resolver-oxc": "^0.11.0",
49
+ "eslint-plugin-de-morgan": "^1.1.0",
49
50
  "eslint-plugin-pinia": "^0.4.1",
50
- "local-pkg": "^1.0.0",
51
- "yargs": "^17.7.2"
51
+ "local-pkg": "^1.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@eslint/config-inspector": "^1.0.0",
55
54
  "@types/node": "^22.13.4",
56
- "@types/yargs": "^17.0.33",
57
55
  "eslint": "^9.20.1",
58
- "eslint-typegen": "^1.0.0",
59
- "lint-staged": "^15.4.3",
60
- "oxc-transform": "^0.50.0",
56
+ "eslint-typegen": "^2.0.0",
57
+ "nano-staged": "^0.8.0",
58
+ "oxc-transform": "^0.51.0",
61
59
  "simple-git-hooks": "^2.11.1",
62
- "tsdown": "^0.5.9",
63
- "tsx": "^4.19.2",
60
+ "tsdown": "^0.5.10",
61
+ "tsx": "^4.19.3",
64
62
  "typescript": "^5.7.3"
65
63
  },
66
64
  "simple-git-hooks": {
67
- "pre-commit": "pnpm lint-staged"
65
+ "pre-commit": "npx nano-staged"
68
66
  },
69
- "lint-staged": {
67
+ "nano-staged": {
70
68
  "*": "eslint --fix"
71
69
  }
72
70
  }