Skip to content

Commit

Permalink
Fix the eslint command supressing the error output
Browse files Browse the repository at this point in the history
  • Loading branch information
eaviles committed Mar 3, 2023
1 parent 10d4a67 commit 0cf7dbf
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/commands/eslint.js
Expand Up @@ -8,7 +8,7 @@ module.exports = {
command,
describe: 'Check the codebase with ESLint.',
handler: async () => {
const { $ } = await import('zx/core');
const { $, ProcessOutput } = await import('zx/core');
process.env.FORCE_COLOR = '3';
if (process.argv[2] === command) {
process.argv.splice(2, 1);
Expand All @@ -17,10 +17,15 @@ module.exports = {
try {
$.verbose = false;
await $`./node_modules/.bin/eslint ${process.argv.slice(2)}`;
} catch (/** @type {*} */ err) {
const { exitCode, stdout } = err;
console.error(stdout.replace('\n', '').trimEnd());
process.exit(exitCode);
} catch (err) {
if (err instanceof ProcessOutput) {
const { exitCode, stdout, stderr } = err;
const out = stdout?.toString() || stderr?.toString() || '';
console.error(out.replace('\n', '').trimEnd());
process.exit(exitCode || 1);
} else {
throw err;
}
}
}
};

0 comments on commit 0cf7dbf

Please sign in to comment.