Skip to content

Commit e6582e0

Browse files
authored
fix: commit body should be empty by default (#2980)
1 parent b0666be commit e6582e0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

@commitlint/cz-commitlint/src/SectionBody.test.ts

+8
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,12 @@ describe('combineCommitMessage', () => {
8383
});
8484
expect(commitMessage).toBe('This is issue body message.');
8585
});
86+
87+
test('should return empty message when body is empty', () => {
88+
setRules({});
89+
const commitMessage = combineCommitMessage({
90+
body: '',
91+
});
92+
expect(commitMessage).toBe('');
93+
});
8694
});

@commitlint/cz-commitlint/src/SectionBody.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function combineCommitMessage(answers: Answers): string {
1919
const leadingBlankFn = getLeadingBlankFn(getRule('body', 'leading-blank'));
2020
const {body, breakingBody, issuesBody} = answers;
2121

22-
const commitBody = body || breakingBody || issuesBody || '-';
22+
const commitBody = body || breakingBody || issuesBody || '';
2323

2424
if (commitBody) {
2525
return leadingBlankFn(

0 commit comments

Comments
 (0)