Skip to content

Commit

Permalink
fix(preset): ESLint recommended-bump is always "patch" (#371)
Browse files Browse the repository at this point in the history
Recommended version bump detection with ESLint preset is broken since
`conventional-changelog-eslint` version 3.0.0:

`npx conventional-recommended-bump -p eslint` always returns "patch".

This is because the preset's `parserOpts` (re-used with v3.0.0)
"headerCorrespondence" is set to `['tag', 'message']` rather than
`['type', 'subject']`, which was used before in the [ESLint preset
"conventional-recommended-bump" specific `parserOpts`][1].

This adapts the ESLint preset's `whatBump` implementation to check "tag"
instead of "type", which fixes the issue.

[1]: https://github.com/conventional-changelog/conventional-changelog/blob/ce1fd981f88ce201e996dfa833e4682de3aafcdd/packages/conventional-changelog-eslint/conventional-recommended-bump.js#L32-L35
  • Loading branch information
ingmarh authored and stevemao committed Sep 11, 2018
1 parent 791e8d5 commit 35e279d
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ module.exports = {
let features = 0

commits.forEach(commit => {
if (!commit.type) {
return
}
if (!commit.tag) return

if (commit.type.toLowerCase() === 'breaking') {
if (commit.tag.toLowerCase() === 'breaking') {
breakings += 1
level = 0
} else if (commit.type.toLowerCase() === 'new') {
} else if (commit.tag.toLowerCase() === 'new') {
features += 1
if (level === 2) {
level = 1
Expand Down

0 comments on commit 35e279d

Please sign in to comment.