Skip to content

Commit f3beda1

Browse files
authored
fix(core): ignore comments
* switch to patched fork of conventional-commits-parser * add test cases for comments * fixes #78
1 parent bbab1d8 commit f3beda1

File tree

4 files changed

+30
-14
lines changed

4 files changed

+30
-14
lines changed

@commitlint/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@
8282
"xo": "0.18.2"
8383
},
8484
"dependencies": {
85+
"@marionebl/conventional-commits-parser": "^3.0.0",
8586
"@marionebl/git-raw-commits": "^1.2.0",
8687
"@marionebl/sander": "^0.6.0",
8788
"babel-runtime": "^6.23.0",
8889
"chalk": "^2.0.1",
8990
"conventional-changelog-angular": "^1.3.3",
90-
"conventional-commits-parser": "^1.3.0",
9191
"cosmiconfig": "^3.0.1",
9292
"find-up": "^2.1.0",
9393
"lodash": "^4.17.4",

@commitlint/core/src/library/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {sync} from 'conventional-commits-parser';
1+
import {sync} from '@marionebl/conventional-commits-parser';
22
import defaultChangelogOpts from 'conventional-changelog-angular';
33

44
export default parse;

@commitlint/core/src/library/parse.test.js

+16
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,19 @@ test('supports scopes with /', async t => {
104104
t.is(actual.scope, 'some/scope');
105105
t.is(actual.subject, 'subject');
106106
});
107+
108+
test('ignores comments', async t => {
109+
const message = 'type(some/scope): subject\n# some comment';
110+
const actual = await parse(message);
111+
t.is(actual.body, null);
112+
t.is(actual.footer, null);
113+
t.is(actual.subject, 'subject');
114+
});
115+
116+
test('registers inline #', async t => {
117+
const message =
118+
'type(some/scope): subject #reference\n# some comment\nthings #reference';
119+
const actual = await parse(message);
120+
t.is(actual.subject, 'subject #reference');
121+
t.is(actual.body, 'things #reference');
122+
});

yarn.lock

+12-12
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@
5959
dependencies:
6060
arrify "^1.0.1"
6161

62+
"@marionebl/conventional-commits-parser@^3.0.0":
63+
version "3.0.0"
64+
resolved "https://registry.npmjs.org/@marionebl/conventional-commits-parser/-/conventional-commits-parser-3.0.0.tgz#9da29b4d2c8f05c0f9cdd02936713b8096c958d3"
65+
dependencies:
66+
JSONStream "^1.0.4"
67+
is-text-path "^1.0.0"
68+
lodash "^4.2.1"
69+
meow "^3.3.0"
70+
split2 "^2.0.0"
71+
through2 "^2.0.0"
72+
trim-off-newlines "^1.0.0"
73+
6274
"@marionebl/git-raw-commits@^1.2.0":
6375
version "1.2.0"
6476
resolved "https://registry.npmjs.org/@marionebl/git-raw-commits/-/git-raw-commits-1.2.0.tgz#7cd8a6dfc09a96df98d8fbe9175c5971cc07c82b"
@@ -1849,18 +1861,6 @@ conventional-commits-filter@^1.0.0:
18491861
is-subset "^0.1.1"
18501862
modify-values "^1.0.0"
18511863

1852-
conventional-commits-parser@^1.3.0:
1853-
version "1.3.0"
1854-
resolved "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-1.3.0.tgz#e327b53194e1a7ad5dc63479ee9099a52b024865"
1855-
dependencies:
1856-
JSONStream "^1.0.4"
1857-
is-text-path "^1.0.0"
1858-
lodash "^4.2.1"
1859-
meow "^3.3.0"
1860-
split2 "^2.0.0"
1861-
through2 "^2.0.0"
1862-
trim-off-newlines "^1.0.0"
1863-
18641864
conventional-commits-parser@^2.0.0:
18651865
version "2.0.0"
18661866
resolved "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-2.0.0.tgz#71d01910cb0a99aeb20c144e50f81f4df3178447"

0 commit comments

Comments
 (0)