Skip to content

Commit

Permalink
feat(eslint): improve regex headerPattern (#268)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

Trailing whitespaces at the beginning of commit messages
will not be saved anymore
  • Loading branch information
JPeer264 authored and stevemao committed Jan 15, 2018
1 parent 3d345e3 commit ccc1365
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/conventional-changelog-eslint/parser-opts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

module.exports = {
headerPattern: /^(\w*)\: (.*?)(?:\((.*)\))?$/,
headerPattern: /^(\w*):\s*(.*)$/,
headerCorrespondence: [
`tag`,
`message`
Expand Down
3 changes: 3 additions & 0 deletions packages/conventional-changelog-eslint/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ describe('eslint preset', function() {
writeFileSync('test4', '');
shell.exec('git add --all && git commit -m"Docs: Fix unmatched paren in rule description"');
writeFileSync('test5', '');
shell.exec('git add --all && git commit -m"Fix: Commit with trailing spaces in the beginning"');
writeFileSync('test6', '');
shell.exec('git add --all && git commit -m"Merge pull request #3033 from gcochard/patch-3 "');
});

Expand All @@ -40,6 +42,7 @@ describe('eslint preset', function() {
expect(chunk).to.include('the `no-class-assign` rule');
expect(chunk).to.include('### Fix');
expect(chunk).to.include('indent rule should recognize single line statements with ASI');
expect(chunk).to.include('* Commit with trailing spaces in the beginning');
expect(chunk).to.include('### Docs');

expect(chunk).to.not.include('3033');
Expand Down

0 comments on commit ccc1365

Please sign in to comment.