diff --git a/@commitlint/is-ignored/src/defaults.ts b/@commitlint/is-ignored/src/defaults.ts index e8acc4448e..31d419e52b 100644 --- a/@commitlint/is-ignored/src/defaults.ts +++ b/@commitlint/is-ignored/src/defaults.ts @@ -18,6 +18,7 @@ export const wildcards: Matcher[] = [ test( /^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m ), + test(/^(Merge tag (.*?))(?:\r?\n)*$/m), test(/^(R|r)evert (.*)/), test(/^(fixup|squash)!/), isSemver, diff --git a/@commitlint/is-ignored/src/is-ignored.test.ts b/@commitlint/is-ignored/src/is-ignored.test.ts index 08911a615b..833ab04c49 100644 --- a/@commitlint/is-ignored/src/is-ignored.test.ts +++ b/@commitlint/is-ignored/src/is-ignored.test.ts @@ -70,6 +70,26 @@ test('should return true for branch merges with newline characters and more char ); }); +test('should return true for tag merges', () => { + expect(isIgnored("Merge tag '1.1.1'")).toBe(true); + expect(isIgnored("Merge tag 'a tag'")).toBe(true); +}); + +test('should return true for tag merges with newline characters', () => { + expect(isIgnored("Merge tag '1.1.1'\n")).toBe(true); + expect(isIgnored("Merge tag '1.1.1'\r\n")).toBe(true); +}); + +test('should return true for tag merges with multiple newline characters', () => { + expect(isIgnored("Merge tag '1.1.1'\n\n\n")).toBe(true); + expect(isIgnored("Merge tag '1.1.1'\r\n\r\n\r\n")).toBe(true); +}); + +test('should return true for tag merges with newline characters and more characters after it', () => { + expect(isIgnored("Merge tag '1.1.1'\n ")).toBe(true); + expect(isIgnored("Merge tag '1.1.1'\r\n # some comment")).toBe(true); +}); + test('should return true for revert commits', () => { expect( isIgnored( @@ -133,6 +153,10 @@ test('should return false for commits containing, but not starting, with merge b expect(isIgnored('foo bar Merge branch xxx')).toBe(false); }); +test('should return false for commits containing, but not starting, with merge tag', () => { + expect(isIgnored("foo bar Merge tag '1.1.1'")).toBe(false); +}); + test('should return false for ignored message if defaults is false', () => { expect( isIgnored('Auto-merged develop into master', {