Skip to content

Commit

Permalink
fix: avoid slicing header if not long enough
Browse files Browse the repository at this point in the history
Recent PR[1] didn't take in account very small subjects in
subject-full-stop rule.

[1] conventional-changelog#3839
  • Loading branch information
knocte committed Jan 20, 2024
1 parent d0be172 commit 5991060
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion @commitlint/rules/src/subject-full-stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const subjectFullStop: SyncRule<string> = (

const negated = when === 'never';
let hasStop = input[input.length - 1] === value;
if (input.slice(-3) === '...') {
let ellipsis = '...';
if (input.length > ellipsis.length && input.slice(-ellipsis.length) === ellipsis) {
hasStop = false;
}

Expand Down

0 comments on commit 5991060

Please sign in to comment.