Skip to content

Commit 11b830c

Browse files
author
linfeng
committed
feat: git add after lint fix
1 parent 5575efb commit 11b830c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"gulp-watch": "^5.0.1",
9898
"highlight.js": "9.15.8",
9999
"html-webpack-plugin": "3.2.0",
100-
"husky": "3.0.0",
100+
"husky": "1.3.1",
101101
"inquirer": "6.4.1",
102102
"isomorphic-fetch": "2.2.1",
103103
"jest": "24.8.0",

src/utils/lint.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,9 @@ export async function lint(options?: Partial<DefaultOptions>) {
136136
}
137137

138138
if (mergedOptions.needFix && lintResult.results.some(each => each.output)) {
139-
console.log(
140-
colors.yellow(
141-
`${lintResult.results.filter(each => each.output).length} files autofixed, please recheck your code.`,
142-
),
143-
);
139+
const fixedFiles = lintResult.results.filter(each => each.output);
140+
console.log(colors.yellow(`${fixedFiles.length} files autofixed, please recheck your code.`));
141+
execSync(`git add ${fixedFiles.map(file => file.filePath).join(' ')}`);
144142
process.exit(1);
145143
}
146144
}

0 commit comments

Comments
 (0)