conventional-changelog/commitlint

Error when linting a message with the word "fix" in it using custom parser preset

Open

#3231 opened on Jun 7, 2022

View on GitHub
 (2 comments) (0 reactions) (0 assignees)TypeScript (15,497 stars) (896 forks)batch import
bughelp wanted

Description

When using a custom parser preset, any form of the word "fix" seems to break parsing of references.

Running echo "refs#111111 Fixed something" | commitlint yields the following error:

{
  references: [],
  subject: 'Fixed something',
  merge: null,
  header: 'refs#111111 Fixed something',
  body: null,
  footer: null,
  notes: [],
  mentions: [],
  revert: null,
  raw: 'refs#111111 Fixed something\r\n'
}
⧗   input: refs#111111 Fixed something
✖   references may not be empty [references-empty]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

However, linting "refs#111111 This is a correct message" passes as expected.

echo "refs#111111 This is a correct message" | commitlint

{
  references: [
    {
      action: null,
      owner: null,
      repository: null,
      issue: '111111',
      raw: 'refs#111111',
      prefix: 'refs#'
    }
  ],
  subject: 'This is a correct message',
  merge: null,
  header: 'refs#111111 This is a correct message',
  body: null,
  footer: null,
  notes: [],
  mentions: [],
  revert: null,
  raw: 'refs#111111 This is a correct message\r\n'
}

Expected Behavior

The mentioned commit message should pass validation

Current Behavior

It seems as if any form of the word "fix" (e.g. "fixed", "fixes", "Fix..") must be the last word of the message or the linter will mistakenly fail.

Affected packages

  • cli
  • core (I suppose)
  • prompt
  • config-angular

Steps to Reproduce (for bugs)

Context

I am trying to configure commitlint for our custom message format refs#TICKETNO Sentence case message, where ticketno is a number at least 6 digits wide.

Your Environment

Executable Version
commitlint --version @commitlint/cli@17.0.2
git --version git version 2.35.3.windows.1
node --version v14.16.0

Contributor guide