Skip to content

Commit 22342bb

Browse files
author
月满
committed
fix: execSync with reasonable args length
1 parent 9eb7a50 commit 22342bb

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pri",
3-
"version": "4.0.30-beta.7",
3+
"version": "4.0.30-beta.14",
44
"types": "src/node/index.ts",
55
"main": "built/node/index.js",
66
"scripts": {

src/utils/lint.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,17 @@ export async function lint(options?: Partial<DefaultOptions>) {
5353

5454
let lintFiles: string[] = [];
5555
let prettierFiles: string[] = [];
56+
let lintFilesPattern: string = '';
5657

5758
if (mergedOptions.lintAll) {
5859
if (globalState.selectedSourceType === 'root') {
5960
lintFiles = glob.sync(`${globalState.projectRootPath}/{${srcPath.dir},${packagesPath.dir}}/**/*.{ts,tsx}`);
61+
lintFilesPattern = `${globalState.projectRootPath}/{${srcPath.dir},${packagesPath.dir}}/**/*.{ts,tsx}`;
6062
} else {
6163
lintFiles = glob.sync(
6264
`${globalState.projectRootPath}/${packagesPath.dir}/${globalState.selectedSourceType}/**/*.{ts,tsx}`,
6365
);
66+
lintFilesPattern = `${globalState.projectRootPath}/${packagesPath.dir}/${globalState.selectedSourceType}/**/*.{ts,tsx}`;
6467
}
6568
} else {
6669
lintFiles = _.compact(
@@ -74,14 +77,15 @@ export async function lint(options?: Partial<DefaultOptions>) {
7477
.map(file => {
7578
return path.join(globalState.projectRootPath, file);
7679
});
80+
lintFilesPattern = lintFiles.filter(file => !cli.isPathIgnored(file)).join(' ');
7781
}
7882

7983
lintFiles = lintFiles.filter(file => !cli.isPathIgnored(file));
8084

8185
const lintResult = await spinner(
8286
`Lint ${mergedOptions.lintAll ? 'all' : ''} ${lintFiles.length} files.`,
8387
async () => {
84-
const files = execSync(`npx prettier --list-different --write ${lintFiles.join(' ')}`);
88+
const files = execSync(`npx prettier --ignore-path ${eslintIgnorePath} --list-different --write ${lintFilesPattern}`);
8589
prettierFiles = _.compact(files.toString().split('\n'));
8690
return cli.executeOnFiles(lintFiles);
8791
},

0 commit comments

Comments
 (0)