@apdesign/code-style-react 1.1.9 → 1.2.1
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 +1 -1
- package/scripts/runEslint.js +10 -3
package/package.json
CHANGED
package/scripts/runEslint.js
CHANGED
@@ -76,8 +76,11 @@ async function runEslint(targetPathArg) {
|
|
76
76
|
|
77
77
|
let targetBranch = 'master';
|
78
78
|
if (targetPath !== process.cwd()) {
|
79
|
-
const
|
80
|
-
|
79
|
+
const pkgName = path.basename(targetPath); // 直接取传入的目录名
|
80
|
+
if (pkgName && pkgName.includes('-')) {
|
81
|
+
const suffix = pkgName.split('-').pop();
|
82
|
+
targetBranch = `master-${suffix}`;
|
83
|
+
}
|
81
84
|
}
|
82
85
|
|
83
86
|
// 获取当前分支
|
@@ -148,7 +151,11 @@ async function runEslint(targetPathArg) {
|
|
148
151
|
console.log(`🔍 检查目录: ${eslintTarget}`);
|
149
152
|
}
|
150
153
|
|
151
|
-
const eslint = new ESLint({
|
154
|
+
const eslint = new ESLint({
|
155
|
+
cwd: gitRoot,
|
156
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'], // 等效于 --ext
|
157
|
+
reportUnusedDisableDirectives: 'error', // 等效于 --report-unused-disable-directives
|
158
|
+
});
|
152
159
|
const files = glob.sync('**/*.{js,jsx,ts,tsx}', { cwd: eslintTarget, absolute: true });
|
153
160
|
if (files.length === 0) {
|
154
161
|
console.log('- 没有需要检查的文件');
|