From 90078f6a58523e0bde386b9b6aa3c05e8b916653 Mon Sep 17 00:00:00 2001 From: Takuya Fukuju Date: Sun, 14 Apr 2024 16:57:50 +0900 Subject: [PATCH] fix(is-ignored): ignore "amend!" commits (#4024) * fix(is-ignored): ignore "amend!" commits * add test --- @commitlint/is-ignored/src/defaults.ts | 2 +- @commitlint/is-ignored/src/is-ignored.test.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/@commitlint/is-ignored/src/defaults.ts b/@commitlint/is-ignored/src/defaults.ts index 8f04c18ed4..281c9fbc1e 100644 --- a/@commitlint/is-ignored/src/defaults.ts +++ b/@commitlint/is-ignored/src/defaults.ts @@ -20,7 +20,7 @@ export const wildcards: Matcher[] = [ ), test(/^(Merge tag (.*?))(?:\r?\n)*$/m), test(/^(R|r)evert (.*)/), - test(/^(fixup|squash)!/), + test(/^(amend|fixup|squash)!/), isSemver, test(/^(Merged (.*?)(in|into) (.*)|Merged PR (.*): (.*))/), test(/^Merge remote-tracking branch(\s*)(.*)/), diff --git a/@commitlint/is-ignored/src/is-ignored.test.ts b/@commitlint/is-ignored/src/is-ignored.test.ts index 6f3179cf46..d3b89d7df6 100644 --- a/@commitlint/is-ignored/src/is-ignored.test.ts +++ b/@commitlint/is-ignored/src/is-ignored.test.ts @@ -124,6 +124,10 @@ test('should ignore npm semver commits with footers', () => { ); }); +test('should return true amend commits', () => { + expect(isIgnored('amend! initial commit')).toBe(true); +}); + test('should return true fixup commits', () => { expect(isIgnored('fixup! initial commit')).toBe(true); });