Skip to content

Commit c1c280d

Browse files
author
linfeng
committed
feat: lint only git diff file
1 parent a1dbdc0 commit c1c280d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utils/lint.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ export async function lint(showBreakError = true) {
1313
logInfo('\nLint and format code..');
1414

1515
try {
16-
execSync([`${findNearestNodemodulesFile('.bin/eslint')} ${eslintParam}`].join(' '), {
16+
const commitedFiles = execSync('git diff --cached --name-only --diff-filter=ACM')
17+
.toString()
18+
.split('\n');
19+
execSync([`${findNearestNodemodulesFile('.bin/eslint')} --fix`, ...commitedFiles].join(' '), {
1720
stdio: 'inherit'
1821
});
1922
} catch (error) {

0 commit comments

Comments
 (0)