feat(cz-commitlint): add exclamation mark support for breaking changes#4655
Conversation
Review Summary by QodoAdd exclamation mark support for breaking changes in commit headers
WalkthroughsDescription• Add opt-in useExclamationMark setting for breaking change notation • Appends ! after type/scope in commit header per Conventional Commits spec • Includes comprehensive test coverage for all scenarios • Updates type definitions and documentation Diagramflowchart LR
A["User enables useExclamationMark setting"] --> B["combineCommitMessage function"]
C["isBreaking flag set to true"] --> B
B --> D["Append ! after type/scope"]
D --> E["feat!: or feat(scope)!: format"]
File Changes1. @commitlint/cz-commitlint/src/SectionHeader.ts
|
Code Review by Qodo
1. Header length off-by-one
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
1d5727b to
a2b22de
Compare
There was a problem hiding this comment.
Pull request overview
Adds an opt-in prompt setting to format Conventional Commits breaking changes with an exclamation mark (!) in the header (e.g., feat(api)!: ...) for @commitlint/cz-commitlint.
Changes:
- Introduces
settings.useExclamationMarkin the prompt config types, defaults, and docs. - Updates header composition to append
!whenisBreakingis true and the setting is enabled. - Adjusts header length calculation and extends test coverage for the new formatting/length behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/reference/prompt.md | Documents the new useExclamationMark setting. |
| @commitlint/types/src/prompt.ts | Extends PromptConfig.settings with useExclamationMark. |
| @commitlint/cz-commitlint/src/store/defaultPromptConfigs.ts | Adds the default value for useExclamationMark (false). |
| @commitlint/cz-commitlint/src/SectionHeader.ts | Appends ! for breaking changes and reserves header length accordingly. |
| @commitlint/cz-commitlint/src/SectionHeader.test.ts | Adds tests for ! formatting and header length reservation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
a2b22de to
d044471
Compare
Opt-in via prompt.settings.useExclamationMark (default: false). This reserves one header character for '!' during subject length validation, regardless of the isBreaking answer. See: https://www.conventionalcommits.org/en/v1.0.0/#summary
d044471 to
9ad6c95
Compare
|
Thanks! |
Description
Add opt-in
prompt.settings.useExclamationMarksetting that appends!after the type/scope prefix in the commit header when a breaking change is indicated (e.g.feat!:orfeat(api)!:).Opt-in via prompt.settings.useExclamationMark (default: false).
Motivation and Context
The Conventional Commits 1.0.0 spec defines
!after the type/scope as a way to draw attention to breaking changes. Currently@commitlint/cz-commitlintonly addsBREAKING CHANGE:to the footer but never modifies the header.Usage examples
How Has This Been Tested?
5 new test cases in SectionHeader.test.ts covering:
Types of changes
Checklist: