@apdesign/code-style-react 1.1.8 → 1.2.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.
- package/cli.js +1 -1
- package/package.json +1 -1
- package/scripts/runEslint.js +8 -4
package/cli.js
CHANGED
package/package.json
CHANGED
package/scripts/runEslint.js
CHANGED
@@ -6,7 +6,7 @@ let fs;
|
|
6
6
|
let glob;
|
7
7
|
let ESLint;
|
8
8
|
|
9
|
-
async function runEslint() {
|
9
|
+
async function runEslint(targetPathArg) {
|
10
10
|
try {
|
11
11
|
if (typeof require !== 'undefined') {
|
12
12
|
// CommonJS
|
@@ -14,7 +14,7 @@ async function runEslint() {
|
|
14
14
|
path = require('path');
|
15
15
|
fs = require('fs');
|
16
16
|
glob = require('glob');
|
17
|
-
ESLint = require('eslint').ESLint;
|
17
|
+
ESLint = require('eslint').ESLint;
|
18
18
|
} else {
|
19
19
|
// ESM
|
20
20
|
spawnSync = await import('node:child_process').spawnSync;
|
@@ -25,7 +25,7 @@ async function runEslint() {
|
|
25
25
|
}
|
26
26
|
|
27
27
|
// 参数解析
|
28
|
-
const args = process.argv.slice(2);
|
28
|
+
const args = targetPathArg || process.argv.slice(2);
|
29
29
|
|
30
30
|
// 检查是否有分支参数 (--branch <branchName>)
|
31
31
|
let branchArg = null;
|
@@ -148,7 +148,11 @@ async function runEslint() {
|
|
148
148
|
console.log(`🔍 检查目录: ${eslintTarget}`);
|
149
149
|
}
|
150
150
|
|
151
|
-
const eslint = new ESLint({
|
151
|
+
const eslint = new ESLint({
|
152
|
+
cwd: gitRoot,
|
153
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'], // 等效于 --ext
|
154
|
+
reportUnusedDisableDirectives: 'error', // 等效于 --report-unused-disable-directives
|
155
|
+
});
|
152
156
|
const files = glob.sync('**/*.{js,jsx,ts,tsx}', { cwd: eslintTarget, absolute: true });
|
153
157
|
if (files.length === 0) {
|
154
158
|
console.log('- 没有需要检查的文件');
|