Skip to content

Commit e7a03ed

Browse files
committed
commitlint.config: remove workaround for body
The workaround is not needed anymore because we're now using a recent-enough version of commitlint that includes the fix for the bug [1]. [1] conventional-changelog/commitlint#3428
1 parent be3106d commit e7a03ed

File tree

3 files changed

+298
-240
lines changed

3 files changed

+298
-240
lines changed

commitlint.config.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module.exports = {
5858
{
5959
rules: {
6060
"body-prose": ({ raw }: { raw: any }) => {
61-
let rawStr = Helpers.convertAnyToString(raw, "raw").trim();
61+
let rawStr = Helpers.convertAnyToString(raw, "raw");
6262
return Plugins.bodyProse(rawStr);
6363
},
6464

@@ -91,12 +91,12 @@ module.exports = {
9191
},
9292

9393
"footer-notes-misplacement": ({ raw }: { raw: any }) => {
94-
let rawStr = Helpers.convertAnyToString(raw, "raw").trim();
94+
let rawStr = Helpers.convertAnyToString(raw, "raw");
9595
return Plugins.footerNotesMisplacement(rawStr);
9696
},
9797

9898
"footer-references-existence": ({ raw }: { raw: any }) => {
99-
let rawStr = Helpers.convertAnyToString(raw, "raw").trim();
99+
let rawStr = Helpers.convertAnyToString(raw, "raw");
100100
return Plugins.footerReferencesExistence(rawStr);
101101
},
102102

@@ -113,7 +113,7 @@ module.exports = {
113113
},
114114

115115
"proper-issue-refs": ({ raw }: { raw: any }) => {
116-
let rawStr = Helpers.convertAnyToString(raw, "raw").trim();
116+
let rawStr = Helpers.convertAnyToString(raw, "raw");
117117
return Plugins.properIssueRefs(rawStr);
118118
},
119119

@@ -164,12 +164,15 @@ module.exports = {
164164
},
165165

166166
"body-soft-max-line-length": (
167-
{ raw }: { raw: any },
167+
{ body }: { body: any },
168168
_: any,
169169
maxLineLength: number
170170
) => {
171-
let rawStr = Helpers.convertAnyToString(raw, "raw").trim();
172-
return Plugins.bodySoftMaxLineLength(rawStr, maxLineLength);
171+
let bodyStr = Helpers.convertAnyToString(body, "body");
172+
return Plugins.bodySoftMaxLineLength(
173+
bodyStr,
174+
maxLineLength
175+
);
173176
},
174177

175178
"trailing-whitespace": ({ raw }: { raw: any }) => {

commitlint/helpers.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@ export abstract class Helpers {
1919
public static convertAnyToString(
2020
potentialString: any,
2121
paramName: string
22-
): string {
22+
): string | null {
2323
if (potentialString === null || potentialString === undefined) {
2424
// otherwise, String(null) might give us the stupid string "null"
25-
throw new Error(
26-
"Unexpected " +
27-
paramName +
28-
"===null or " +
29-
paramName +
30-
"===undefined happened"
31-
);
25+
return null;
3226
}
3327
return String(potentialString);
3428
}

0 commit comments

Comments
 (0)