@commitlint/prompt-cli fails for empty git stages after authoring the commit message. This makes for a frustrating experience.
Check if there are files in stage before entering the prompt.
Edit
The implementation for this should happen before this line: @commitlint/prompt-cli/cli.js#L21
main could look like this:
async function main() {
if (await isStageEmpty()) {
console.log(`Nothing to commit. Stage your changes via "git add" execute "commit" again`);
process.exit(1);
}
return prompt();
}
async function isStageEmpty() {
const result = await execa('git', ['diff', '--cached']);
return result.stdout === '';
}
@commitlint/prompt-clifails for empty git stages after authoring the commit message. This makes for a frustrating experience.Check if there are files in stage before entering the prompt.
Edit
The implementation for this should happen before this line: @commitlint/prompt-cli/cli.js#L21
maincould look like this: