Skip to content

commitlint fails when parsing exclamation point in type/scope #884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 4 tasks
topocount opened this issue Jan 2, 2020 · 3 comments
Closed
1 of 4 tasks

commitlint fails when parsing exclamation point in type/scope #884

topocount opened this issue Jan 2, 2020 · 3 comments
Assignees

Comments

@topocount
Copy link

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
  • 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
@byCedric
Copy link
Member

byCedric commented Jan 3, 2020

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).

@byCedric byCedric closed this as completed Jan 3, 2020
@fobdy
Copy link

fobdy commented Feb 14, 2020

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

@jacktuck
Copy link

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)
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants