Skip to content

Commit bfab842

Browse files
feat(rules): breaking-change-exclamation-mark pull request feedback
Address pull request feedback from @JounQin. - Fixed regex for `subject-exclamation-mark`. - Fixed sorting for `RulesConfig`. - Fixed sorting for `rules.md`.
1 parent a3b6915 commit bfab842

File tree

3 files changed

+141
-141
lines changed

3 files changed

+141
-141
lines changed

@commitlint/rules/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ import { typeMaxLength } from "./type-max-length.js";
3737
import { typeMinLength } from "./type-min-length.js";
3838

3939
export default {
40-
"breaking-change-exclamation-mark": breakingChangeExclamationMark,
4140
"body-case": bodyCase,
4241
"body-empty": bodyEmpty,
4342
"body-full-stop": bodyFullStop,
4443
"body-leading-blank": bodyLeadingBlank,
4544
"body-max-length": bodyMaxLength,
4645
"body-max-line-length": bodyMaxLineLength,
4746
"body-min-length": bodyMinLength,
47+
"breaking-change-exclamation-mark": breakingChangeExclamationMark,
4848
"footer-empty": footerEmpty,
4949
"footer-leading-blank": footerLeadingBlank,
5050
"footer-max-length": footerMaxLength,
@@ -64,10 +64,10 @@ export default {
6464
"signed-off-by": signedOffBy,
6565
"subject-case": subjectCase,
6666
"subject-empty": subjectEmpty,
67+
"subject-exclamation-mark": subjectExclamationMark,
6768
"subject-full-stop": subjectFullStop,
6869
"subject-max-length": subjectMaxLength,
6970
"subject-min-length": subjectMinLength,
70-
"subject-exclamation-mark": subjectExclamationMark,
7171
"trailer-exists": trailerExists,
7272
"type-case": typeCase,
7373
"type-empty": typeEmpty,

@commitlint/rules/src/subject-exclamation-mark.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const subjectExclamationMark: SyncRule = (parsed, when = "always") => {
88
}
99

1010
const negated = when === "never";
11-
const hasExclamationMark = /!:/.test(input);
11+
const hasExclamationMark = /^(\w*)(?:\((.*)\))?!: (.*)$/.test(input);
1212

1313
return [
1414
negated ? !hasExclamationMark : hasExclamationMark,

0 commit comments

Comments
 (0)