Skip to content

Commit 48ac391

Browse files
committed
Merge branch 'master' into feat/107_warn-on-empty-config
2 parents 36d25e2 + bd5eba3 commit 48ac391

15 files changed

+18
-93
lines changed

@commitlint/cli/src/cli.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ test('should pick up parser preset and fail accordingly', async t => {
166166
'type(scope): subject'
167167
);
168168
t.is(actual.code, 1);
169-
t.true(actual.stdout.includes('message may not be empty [subject-empty]'));
169+
t.true(actual.stdout.includes('may not be empty'));
170170
});
171171

172172
test('should pick up parser preset and succeed accordingly', async t => {

@commitlint/rules/src/body-tense.js

-6
This file was deleted.

@commitlint/rules/src/body-tense.test.js

-13
This file was deleted.

@commitlint/rules/src/footer-tense.js

-8
This file was deleted.

@commitlint/rules/src/footer-tense.test.js

-13
This file was deleted.

@commitlint/rules/src/index.js

-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@ export default {
55
'body-max-length': require('./body-max-length'),
66
'body-max-line-length': require('./body-max-line-length'),
77
'body-min-length': require('./body-min-length'),
8-
'body-tense': require('./body-tense'),
98
'footer-empty': require('./footer-empty'),
109
'footer-leading-blank': require('./footer-leading-blank'),
1110
'footer-max-length': require('./footer-max-length'),
1211
'footer-max-line-length': require('./footer-max-line-length'),
1312
'footer-min-length': require('./footer-min-length'),
14-
'footer-tense': require('./footer-tense'),
1513
'header-max-length': require('./header-max-length'),
1614
'header-min-length': require('./header-min-length'),
17-
lang: require('./lang'),
1815
'references-empty': require('./references-empty'),
1916
'scope-case': require('./scope-case'),
2017
'scope-empty': require('./scope-empty'),
@@ -27,7 +24,6 @@ export default {
2724
'subject-full-stop': require('./subject-full-stop'),
2825
'subject-max-length': require('./subject-max-length'),
2926
'subject-min-length': require('./subject-min-length'),
30-
'subject-tense': require('./subject-tense'),
3127
'type-case': require('./type-case'),
3228
'type-empty': require('./type-empty'),
3329
'type-enum': require('./type-enum'),

@commitlint/rules/src/lang.js

-3
This file was deleted.

@commitlint/rules/src/lang.test.js

-15
This file was deleted.

@commitlint/rules/src/subject-empty.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ export default (parsed, when) => {
77

88
return [
99
negated ? notEmpty : !notEmpty,
10-
message(['message', negated ? 'may not' : 'must', 'be empty'])
10+
message(['subject', negated ? 'may not' : 'must', 'be empty'])
1111
];
1212
};

@commitlint/rules/src/subject-full-stop.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export default (parsed, when, value) => {
1212

1313
return [
1414
negated ? !hasStop : hasStop,
15-
message(['message', negated ? 'may not' : 'must', 'end with full stop'])
15+
message(['subject', negated ? 'may not' : 'must', 'end with full stop'])
1616
];
1717
};

@commitlint/rules/src/subject-max-length.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export default (parsed, when, value) => {
99

1010
return [
1111
maxLength(input, value),
12-
`footer must not be longer than ${value} characters`
12+
`subject must not be longer than ${value} characters`
1313
];
1414
};

@commitlint/rules/src/subject-tense.js

-8
This file was deleted.

@commitlint/rules/src/subject-tense.test.js

-13
This file was deleted.

docs/guides-local-setup.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,20 @@ Install `husky` as devDependency, a handy git hook helper available on npm.
2828
npm install --save-dev husky
2929
```
3030

31-
This allows us to add [git hooks](https://github.com/typicode/husky/blob/master/HOOKS.md#hooks) directly into our `package.json` scripts.
31+
This allows us to add [git hooks](https://git-scm.com/docs/githooks) directly into our `package.json` via the `husky.hooks` field.
3232

3333
```json
34+
// package.json
3435
{
35-
"scripts": {
36-
"commitmsg": "commitlint -E GIT_PARAMS"
36+
"husky": {
37+
"hooks": {
38+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
39+
}
3740
}
3841
}
3942
```
4043

41-
Using `commitmsg` gives us exactly what we want: It is executed whenever a new commit is created. Passing husky's `GIT_PARAMS` to `commitlint` via the `-E|--env` flag directs it to the relevant edit file. `-e` would default to `.git/COMMIT_EDITMSG`.
44+
Using `commit-msg` gives us exactly what we want: It is executed whenever a new commit is created. Passing husky's `HUSKY_GIT_PARAMS` to `commitlint` via the `-E|--env` flag directs it to the relevant edit file. `-e` would default to `.git/COMMIT_EDITMSG`.
4245

4346
## Test
4447

package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
"license": "MIT",
77
"scripts": {
88
"build": "lerna run build --stream --parallel --include-filtered-dependencies",
9+
"watch": "lerna run watch --stream --parallel --include-filtered-dependencies",
910
"clean": "npx lerna clean --yes && npx lerna run clean --stream --parallel --include-filtered-dependencies",
1011
"commit": "node @commitlint/prompt-cli/cli.js",
11-
"commitmsg": "node @commitlint/cli/lib/cli.js -E GIT_PARAMS",
1212
"deps": "lerna run deps",
1313
"pkg": "lerna run pkg",
1414
"docs": "docsify serve docs",
1515
"lint": "lerna run lint",
16-
"precommit": "lint-staged",
1716
"publish": "lerna publish --conventional-commits",
1817
"reinstall": "yarn clean && yarn install",
1918
"start": "lerna run start --stream --parallel --include-filtered-dependencies",
@@ -101,5 +100,11 @@
101100
"npx": "9.7.1",
102101
"prettier": "1.10.2",
103102
"xo": "0.20.3"
103+
},
104+
"husky": {
105+
"hooks": {
106+
"commit-msg": "node @commitlint/cli/lib/cli.js -E HUSKY_GIT_PARAMS",
107+
"pre-commit": "lint-staged"
108+
}
104109
}
105110
}

0 commit comments

Comments
 (0)