@apdesign/code-style-react 1.1.6 → 1.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apdesign/code-style-react",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "scripts": {},
5
5
  "bin": {
6
6
  "apdesign-code-style": "cli.js"
@@ -3,7 +3,6 @@
3
3
  let spawnSync;
4
4
  let path;
5
5
  let fs;
6
- let os;
7
6
  let glob;
8
7
  let ESLint;
9
8
 
@@ -14,15 +13,13 @@ async function runEslint() {
14
13
  spawnSync = require('child_process').spawnSync;
15
14
  path = require('path');
16
15
  fs = require('fs');
17
- os = require('os');
18
16
  glob = require('glob');
19
- ESLint = require('eslint').ESLint;
17
+ ESLint = require('eslint').ESLint;
20
18
  } else {
21
19
  // ESM
22
20
  spawnSync = await import('node:child_process').spawnSync;
23
21
  path = await import('node:path');
24
22
  fs = await import('node:fs');
25
- os = await import('node:os');
26
23
  glob = (await import('glob')).default;
27
24
  ESLint = (await import('eslint')).ESLint;
28
25
  }
@@ -30,15 +27,6 @@ async function runEslint() {
30
27
  // 参数解析
31
28
  const args = process.argv.slice(2);
32
29
 
33
- let maxWorkers = null; // 默认由 ESLint API 决定
34
- const maxWorkersArgIndex = args.indexOf('--max-workers');
35
- if (maxWorkersArgIndex !== -1 && args[maxWorkersArgIndex + 1]) {
36
- const val = parseInt(args[maxWorkersArgIndex + 1], 10);
37
- if (!isNaN(val) && val > 0) {
38
- maxWorkers = val;
39
- }
40
- }
41
-
42
30
  // 检查是否有分支参数 (--branch <branchName>)
43
31
  let branchArg = null;
44
32
  const branchIndex = args.indexOf('--branch');
@@ -46,23 +34,16 @@ async function runEslint() {
46
34
  branchArg = args[branchIndex + 1];
47
35
  }
48
36
 
49
- // targetPath 是第一个不是 --max-workers 的参数
37
+ // targetPath 是第一个不是 --branch 的参数
50
38
  let targetPath = process.cwd();
51
39
  for (let i = 0; i < args.length; i++) {
52
- if (
53
- i === maxWorkersArgIndex ||
54
- i === maxWorkersArgIndex + 1 ||
55
- i === branchIndex ||
56
- i === branchIndex + 1
57
- )
58
- continue;
40
+ if (i === branchIndex || i === branchIndex + 1) continue;
59
41
  targetPath = args[i] || targetPath;
60
42
  break;
61
43
  }
62
44
 
63
45
  console.log(`\n[ESLint 配置]`);
64
46
  console.log(`路径: ${targetPath}`);
65
- console.log(`并发线程数: ${maxWorkers || 'ESLint 默认'}`);
66
47
  console.log('');
67
48
 
68
49
  // 路径解析
@@ -118,7 +99,7 @@ async function runEslint() {
118
99
  console.log(`[Git 信息]`);
119
100
  console.log(`仓库根目录: ${gitRoot}`);
120
101
  console.log(`当前分支: ${currentBranch}`);
121
- console.log(`目标分支: ${branchArg || targetBranch}`);
102
+ console.log(`目标分支: ${branchToUse}`);
122
103
  console.log('');
123
104
 
124
105
  if (currentBranch !== branchToUse) {
@@ -167,7 +148,7 @@ async function runEslint() {
167
148
  console.log(`🔍 检查目录: ${eslintTarget}`);
168
149
  }
169
150
 
170
- const eslint = new ESLint({ cwd: rootDir, threads: maxWorkers || undefined });
151
+ const eslint = new ESLint({ cwd: rootDir });
171
152
  const files = glob.sync('**/*.{js,jsx,ts,tsx}', { cwd: eslintTarget, absolute: true });
172
153
  if (files.length === 0) {
173
154
  console.log('- 没有需要检查的文件');