commitlint fails when parsing exclamation point in type/scope

Created on 2 Jan 2020  Â·  3Comments  Â·  Source: conventional-changelog/commitlint


When I try to submit a breaking-change commit with the provided conventional commit config file used, I get an error:

husky > commit-msg (node v10.15.3)
â§—   input: test!: should work
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

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

husky > commit-msg hook failed (add --no-verify to bypass)

Expected Behavior


This commit should pass the husky check because it falls in the spec of a conventional commit

Current Behavior


The commit fails the lint, probably because the exclamation point isn't getting parsed correctly

Affected packages

  • [ ] cli
  • [x] core
  • [ ] prompt
  • [ ] config-angular

Possible Solution


Steps to Reproduce (for bugs)


  1. attempt to commit changes with an exclamation point after the type/scope but before the colon

commitlint.config.js


module.exports = {
  extends: ['@commitlint/config-conventional'],
  rules: {
    'type-enum': [
      1,
      'always',
      [
        'build',
        'chore',
        'ci',
        'docs',
        'feat',
        'fix',
        'perf',
        'refactor',
        'revert',
        'style',
        'test'
      ]
    ]
  }
}

Context


Your Environment

| Executable | Version |
| ---: | :--- |
| commitlint --version | 6.4.1 |
| git --version | 2.17.1 |
| node --version | v10.15.3 |

Most helpful comment

Sorry, I have the same problem with @commitlint/cli @ 8.3.5

All 3 comments

Hi @topocount! I see you are running an outdated version of commitlint (6.4.1), this doesn't have support for the new format of the conventional changelog parsers. We made some internal changes in [email protected] that includes support for these parsers.

If you upgrade to 8.3.3, the exclamation mark should be parsed as breaking change commit (without any failing type/scope/message rules).

Sorry, I have the same problem with @commitlint/cli @ 8.3.5

Still not working as of 9.x.x

    "@commitlint/config-conventional": "^9.0.1",
    "@commitlint/core": "^9.0.1",
const { lint, load } = require('@commitlint/core')

load().then(({ rules }) => {
    console.log({ rules })
    const title = 'chore!: some chores'
    lint(title, rules).then(console.log)
})
Was this page helpful?
0 / 5 - 0 ratings

Related issues

1natsu172 picture 1natsu172  Â·  5Comments

QuentinRoy picture QuentinRoy  Â·  5Comments

xmlking picture xmlking  Â·  4Comments

foray1010 picture foray1010  Â·  3Comments

ResDiaryLewis picture ResDiaryLewis  Â·  4Comments