feat(rules): add breaking-change-exclamation-mark#4548
feat(rules): add breaking-change-exclamation-mark#4548escapedcat merged 3 commits intoconventional-changelog:masterfrom adamchristiansen:master
Conversation
|
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. |
| return [true]; | ||
| } | ||
|
|
||
| const hasExclamationMark = !!header && /!:/.test(header); |
There was a problem hiding this comment.
There was a problem hiding this comment.
I will make this change.
Should this be updated to use the breakingHeaderPattern too? To me, that is outside of the scope of this pull request and should be a separate commit.
There was a problem hiding this comment.
Personally I think such tiny change is fine to be inclined in one PR.
There was a problem hiding this comment.
I will make the change.
| } | ||
|
|
||
| const hasExclamationMark = !!header && /!:/.test(header); | ||
| const hasBreakingChange = !!footer && /BREAKING[ -]CHANGE:/.test(footer); |
There was a problem hiding this comment.
We need make sure the footer line starts with BREAKING not only includes?
There was a problem hiding this comment.
Agreed. I will modify the regex for a multiline search.
| import message from "@commitlint/message"; | ||
| import { SyncRule } from "@commitlint/types"; | ||
|
|
||
| export const breakingChangeExclamationMark: SyncRule = ( |
There was a problem hiding this comment.
The new rule should be added into
commitlint/@commitlint/types/src/rules.ts
Line 92 in 0735b63
| import { typeMinLength } from "./type-min-length.js"; | ||
|
|
||
| export default { | ||
| "breaking-change-exclamation-mark": breakingChangeExclamationMark, |
There was a problem hiding this comment.
Should we resort them alphabetically?
There was a problem hiding this comment.
Agreed. I will fix the sorting.
| @@ -1,5 +1,19 @@ | |||
| # Rules | |||
|
|
|||
| ## breaking-change-exclamation-mark | |||
There was a problem hiding this comment.
Same as above about the order.
There was a problem hiding this comment.
Agreed again; I will fix this. It has bothered me in the past looking things up on this page as it is about 90% in the right order.
|
I made several pushes because I resolved a conflict with a merge instead of performing a rebase 🤦. I have implemented all suggestions and rebased the branch onto the latest master, so I believe it is ready now. |
|
Thanks @adamchristiansen ! |
This PR contains the following updates: | Package | Type | Update | Change | Age | Confidence | |---|---|---|---|---|---| | [commitlint/commitlint](https://github.com/conventional-changelog/commitlint) | container | minor | `20.1.0` -> `20.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [docker.io/thegeeklab/git-sv](https://github.com/thegeeklab/git-sv) | container | patch | `2.0.8` -> `2.0.9` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) | devDependencies | minor | [`^0.46.0` -> `^0.47.0`](https://renovatebot.com/diffs/npm/markdownlint-cli/0.46.0/0.47.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>conventional-changelog/commitlint (commitlint/commitlint)</summary> ### [`v20.2.0`](https://github.com/conventional-changelog/commitlint/blob/HEAD/CHANGELOG.md#2020-2025-12-05) [Compare Source](conventional-changelog/commitlint@v20.1.0...v20.2.0) ##### Bug Fixes - update dependency glob to v11 \[security] ([#​4561](conventional-changelog/commitlint#4561)) ([a89a08b](conventional-changelog/commitlint@a89a08b)) ##### Features - **cz-commitlint:** support customizable commit prompt with emojis ([#​4540](conventional-changelog/commitlint#4540)) ([803c05b](conventional-changelog/commitlint@803c05b)) - **lint:** update ESLint configuration to use Vitest and remove Jest plugin ([#​4542](conventional-changelog/commitlint#4542)) ([63e7ad4](conventional-changelog/commitlint@63e7ad4)) - **rules:** add breaking-change-exclamation-mark ([#​4548](conventional-changelog/commitlint#4548)) ([c4d419b](conventional-changelog/commitlint@c4d419b)), closes [#​4547](conventional-changelog/commitlint#4547) </details> <details> <summary>thegeeklab/git-sv (docker.io/thegeeklab/git-sv)</summary> ### [`v2.0.9`](https://github.com/thegeeklab/git-sv/releases/tag/v2.0.9) [Compare Source](thegeeklab/git-sv@v2.0.8...v2.0.9) #### v2.0.9 (2025-12-05) ##### Others - **deps:** update docker.io/library/alpine docker tag to v3.23 ([#​260](thegeeklab/git-sv#260)) ([`2f6207a`](thegeeklab/git-sv@2f6207a)) - **deps:** update golang patch version ([#​261](thegeeklab/git-sv#261)) ([`a4cc5da`](thegeeklab/git-sv@a4cc5da)) </details> <details> <summary>igorshubovych/markdownlint-cli (markdownlint-cli)</summary> ### [`v0.47.0`](https://github.com/igorshubovych/markdownlint-cli/releases/tag/v0.47.0) [Compare Source](igorshubovych/markdownlint-cli@v0.46.0...v0.47.0) - Add output and exit code support for warnings - Update `markdownlint` dependency to `0.40.0` - Improve `MD011`/`MD013`/`MD051`/`MD060` - Update all dependencies via `Dependabot` </details> --- ### Configuration 📅 **Schedule**: Branch creation - Only on Sunday and Saturday ( * * * * 0,6 ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xOC4xIiwidXBkYXRlZEluVmVyIjoiNDEuMTguMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsia2luZC9kZXBlbmRlbmN5Il19--> Reviewed-on: https://gitea.com/gitea/helm-actions/pulls/88 Reviewed-by: DaanSelen <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
Description
A breaking change can be denoted by either
!in the header (e.g.,feat!: add advanced search filters) or by includingBREAKING CHANGEin the footer (e.g.,BREAKING CHANGE: old queries no longer work with the new API.). This pull request adds thebreaking-change-exclamation-markrule that requires aBREAKING CHANGEfooter if!appears in the header and a!in the header ifBREAKING CHANGEappears in the footer. The idea is that it is all or nothing, so if one breaking change marker is present the other must be present too.Motivation and Context
Implements and closes #4547.
This feature enforces a solution to three problems:
!might not convey enough information. For example,feat!: add advanced search filters. Why is this a breaking change? How do I know what broke unless the footer is present? Using this rule will fail because a footer indicating a breaking change must be added in this case.BREAKING CHANGEmight cause confusion. For example, if I use something likegit log --onlineto quickly look at changes and I seefeat: add advanced search filters, I have no idea that it is a breaking change without looking at that specific commit in greater detail. This rule will fail because an exclamation mark must be added to the head in this case.Usage examples
How Has This Been Tested?
I added a new test
@commitlint/rules/src/breaking-change-exclamation-mark.test.tsthat follows the structure of existing tests. The commit messages to tests were decided based on equivalence partitions.Types of changes
Checklist: