Skip to content

Commit ead20b6

Browse files
committed
fix(core): ignore version commits with leading whitespace
1 parent 67ba5c6 commit ead20b6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

@commitlint/core/src/library/is-ignored.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const WILDCARDS = [
44
c => c.match(/^(Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?))$)/),
55
c => c.match(/^(R|r)evert (.*)/),
66
c => c.match(/^(fixup|squash)!/),
7-
c => semver.valid(c)
7+
c => semver.valid(c.trim())
88
];
99

1010
export default function isIgnored(commit = '') {

@commitlint/core/src/library/is-ignored.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ test('should return true for npm version commits', t => {
3939
t.true(isIgnored(`0.0.1-some-crazy-tag.0`));
4040
t.true(isIgnored(`0.0.1-some-crazy-tag.999`));
4141
t.true(isIgnored(`0.0.1-1e69d54`));
42+
t.true(isIgnored(`v0.0.1`));
43+
t.true(isIgnored(` v3.0.0`));
4244
});
4345

4446
test('should return true fixup commits', t => {

0 commit comments

Comments
 (0)