Skip to content

Commit b8a5515

Browse files
Carl Tompkinsmarionebl
Carl Tompkins
authored andcommitted
fix: ignore empty commit messages #615
bypass rules for completely empty commit messages (only of blank lines/comments in message)
1 parent 9d14792 commit b8a5515

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

@commitlint/lint/src/lint.ts

+15
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ export default async function lint(
3535

3636
// Parse the commit message
3737
const parsed = await parse(message, undefined, opts.parserOpts);
38+
39+
if (
40+
parsed.header === null &&
41+
parsed.body === null &&
42+
parsed.footer === null
43+
) {
44+
// Commit is empty, skip
45+
return {
46+
valid: true,
47+
errors: [],
48+
warnings: [],
49+
input: message
50+
};
51+
}
52+
3853
const allRules: Map<string, Rule<unknown> | Rule<never>> = new Map(
3954
Object.entries(defaultRules)
4055
);

0 commit comments

Comments
 (0)