Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion bin/output-fixing-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ const fixingCommands = {
};

const command = process.argv.slice(2);
const currentScriptName = process.env.npm_lifecycle_event;

// Redirect the main lint command, but not individual commands.
if (currentScriptName === 'lint' && command.includes('--fix')) {
console.log(`🔧 Detected --fix flag, running: yarn lint-fix`);
const result = cp.spawnSync('yarn', ['lint-fix'], { stdio: 'inherit' });
process.exitCode = result.status;
process.exit();
}

const result = cp.spawnSync(command[0], command.slice(1), { stdio: 'inherit' });

if (result.status !== 0) {
process.exitCode = result.status;
const currentScriptName = process.env.npm_lifecycle_event;
if (currentScriptName && currentScriptName in fixingCommands) {
console.log(
'💡 You might be able to fix the error by running `yarn ' +
Expand Down