commitlint icon indicating copy to clipboard operation
commitlint copied to clipboard

fix: prompt does not respect [body-leading-blank] setting

Open TiagoGrosso opened this issue 1 year ago • 5 comments

Expected Behavior

When creating a commit with prompt, if you have body-leading-blank enabled, it should insert a line between the summary and the body

Current Behavior

When creating a commit with prompt, if you have body-leading-blank enabled, it will not insert a line between the summary and the body and will cause a warning or error (depending on your config) when validating the commit message

Affected packages

  • [ ] cli
  • [ ] core
  • [X] prompt
  • [ ] config-angular

Possible Solution

No response

Steps to Reproduce

  1. Add prompt to your project
  2. Add extends: ['@commitlint/config-angular'] to your commitlint config file (or explicltly add rules: { 'body-leading-blank': [2, 'always'] } )
  3. Run prompt (npx commit) and provide a body to your commit message
  4. Check the commit message, it will not have a line between the summary and the body
  • (Optional) Run commitlint and you'll see a warning about [body-leading-blank]

Context

No response

commitlint --version

18.4.3

git --version

2.34.1

node --version

v20.9.0

TiagoGrosso avatar Dec 18 '23 12:12 TiagoGrosso

I also encountered this problem and was very confused.

kajweb avatar Dec 25 '23 13:12 kajweb

Just to add that this also happens with the footer, meaning that prompt will not add a line between the body and the footer

TiagoGrosso avatar Dec 25 '23 13:12 TiagoGrosso

you guys been able to set prompt? lol

ticmaisdev avatar Mar 20 '24 19:03 ticmaisdev

@escapedcat , I feel like calling forceLeadingBlankFn in the onEnd event here would work right? I will look into it a bit more and create a PR for this.

weixinwu avatar Apr 26 '24 21:04 weixinwu

@weixinwu thanks! prompt is not in a good state I believe. But sure, give it a try!

escapedcat avatar Apr 28 '24 02:04 escapedcat