Skip to content

Commit

Permalink
fix(preset): recommended-bump ESLint preset (#295)
Browse files Browse the repository at this point in the history
With commit 60815b5, it seems that the
Angular preset was inadvertently copied into the ESLint package.

This corrects the `conventional-recommended-bump` ESLint preset in
`conventional-changelog-eslint` to behave the same as the built-in
ESLint preset that was removed with #270.

Related to #241
  • Loading branch information
ingmarh authored and hutson committed Mar 3, 2018
1 parent 35e60b5 commit acf9c19
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
'use strict';

module.exports = {
whatBump: (commits) => {
whatBump: commits => {
let level = 2;
let breakings = 0;
let features = 0;

commits.forEach(commit => {
if (commit.notes.length > 0) {
breakings += commit.notes.length;
if (!commit.type) {
return;
}

if (commit.type.toLowerCase() === 'breaking') {
breakings += 1;
level = 0;
} else if (commit.type === `feat`) {
} else if (commit.type.toLowerCase() === 'new') {
features += 1;
if (level === 2) {
level = 1;
Expand All @@ -20,19 +24,16 @@ module.exports = {

return {
level: level,
reason: `There are ${breakings} BREAKING CHANGES and ${features} features`
reason: `There are ${breakings} breaking changes and ${features} features`
};
},

parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?\: (.*)$/,
headerPattern: /^(\w*): (.*)$/,
headerCorrespondence: [
`type`,
`scope`,
`subject`
'type',
'subject'
],
noteKeywords: `BREAKING CHANGE`,
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
revertPattern: /^[rR]evert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: ['header', 'hash']
}
};

0 comments on commit acf9c19

Please sign in to comment.