Skip to content

Commit

Permalink
fix eslint missing exit
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Jun 10, 2019
1 parent 2070128 commit 714ba33
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/preCommit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function runCmd(cmd: string, args: string[]) {
runner.on('close', code => {
if (code) {
signale.error(`Error on execution: ${cmd} ${(args || []).join(' ')}`);
reject();
reject(code);
return;
}
resolve();
Expand Down Expand Up @@ -151,7 +151,12 @@ export async function check() {
const eslintConfig = getEsLintConfig();
const eslintBin = require.resolve('eslint/bin/eslint');
const args = [eslintBin, '-c', eslintConfig, ...list, '--fix'];
await runCmd('node', args);

try {
await runCmd('node', args);
} catch (code) {
process.exit(code);
}

signale.success(`${chalk.cyan('eslint')} success!`);
}
Expand Down

0 comments on commit 714ba33

Please sign in to comment.