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 21, 2024
1 parent 84aeb6c commit 5a5f442
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 5a5f442

Please sign in to comment.