Skip to content

Commit

Permalink
Merge branch 'master' into feat/107_warn-on-empty-config
Browse files Browse the repository at this point in the history
  • Loading branch information
escapedcat committed Nov 18, 2018
2 parents 36d25e2 + bd5eba3 commit 48ac391
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 93 deletions.
2 changes: 1 addition & 1 deletion @commitlint/cli/src/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ test('should pick up parser preset and fail accordingly', async t => {
'type(scope): subject'
);
t.is(actual.code, 1);
t.true(actual.stdout.includes('message may not be empty [subject-empty]'));
t.true(actual.stdout.includes('may not be empty'));
});

test('should pick up parser preset and succeed accordingly', async t => {
Expand Down
6 changes: 0 additions & 6 deletions @commitlint/rules/src/body-tense.js

This file was deleted.

13 changes: 0 additions & 13 deletions @commitlint/rules/src/body-tense.test.js

This file was deleted.

8 changes: 0 additions & 8 deletions @commitlint/rules/src/footer-tense.js

This file was deleted.

13 changes: 0 additions & 13 deletions @commitlint/rules/src/footer-tense.test.js

This file was deleted.

4 changes: 0 additions & 4 deletions @commitlint/rules/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ export default {
'body-max-length': require('./body-max-length'),
'body-max-line-length': require('./body-max-line-length'),
'body-min-length': require('./body-min-length'),
'body-tense': require('./body-tense'),
'footer-empty': require('./footer-empty'),
'footer-leading-blank': require('./footer-leading-blank'),
'footer-max-length': require('./footer-max-length'),
'footer-max-line-length': require('./footer-max-line-length'),
'footer-min-length': require('./footer-min-length'),
'footer-tense': require('./footer-tense'),
'header-max-length': require('./header-max-length'),
'header-min-length': require('./header-min-length'),
lang: require('./lang'),
'references-empty': require('./references-empty'),
'scope-case': require('./scope-case'),
'scope-empty': require('./scope-empty'),
Expand All @@ -27,7 +24,6 @@ export default {
'subject-full-stop': require('./subject-full-stop'),
'subject-max-length': require('./subject-max-length'),
'subject-min-length': require('./subject-min-length'),
'subject-tense': require('./subject-tense'),
'type-case': require('./type-case'),
'type-empty': require('./type-empty'),
'type-enum': require('./type-enum'),
Expand Down
3 changes: 0 additions & 3 deletions @commitlint/rules/src/lang.js

This file was deleted.

15 changes: 0 additions & 15 deletions @commitlint/rules/src/lang.test.js

This file was deleted.

2 changes: 1 addition & 1 deletion @commitlint/rules/src/subject-empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export default (parsed, when) => {

return [
negated ? notEmpty : !notEmpty,
message(['message', negated ? 'may not' : 'must', 'be empty'])
message(['subject', negated ? 'may not' : 'must', 'be empty'])
];
};
2 changes: 1 addition & 1 deletion @commitlint/rules/src/subject-full-stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export default (parsed, when, value) => {

return [
negated ? !hasStop : hasStop,
message(['message', negated ? 'may not' : 'must', 'end with full stop'])
message(['subject', negated ? 'may not' : 'must', 'end with full stop'])
];
};
2 changes: 1 addition & 1 deletion @commitlint/rules/src/subject-max-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export default (parsed, when, value) => {

return [
maxLength(input, value),
`footer must not be longer than ${value} characters`
`subject must not be longer than ${value} characters`
];
};
8 changes: 0 additions & 8 deletions @commitlint/rules/src/subject-tense.js

This file was deleted.

13 changes: 0 additions & 13 deletions @commitlint/rules/src/subject-tense.test.js

This file was deleted.

11 changes: 7 additions & 4 deletions docs/guides-local-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,20 @@ Install `husky` as devDependency, a handy git hook helper available on npm.
npm install --save-dev husky
```

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

```json
// package.json
{
"scripts": {
"commitmsg": "commitlint -E GIT_PARAMS"
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
```

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`.
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`.

## Test

Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
"license": "MIT",
"scripts": {
"build": "lerna run build --stream --parallel --include-filtered-dependencies",
"watch": "lerna run watch --stream --parallel --include-filtered-dependencies",
"clean": "npx lerna clean --yes && npx lerna run clean --stream --parallel --include-filtered-dependencies",
"commit": "node @commitlint/prompt-cli/cli.js",
"commitmsg": "node @commitlint/cli/lib/cli.js -E GIT_PARAMS",
"deps": "lerna run deps",
"pkg": "lerna run pkg",
"docs": "docsify serve docs",
"lint": "lerna run lint",
"precommit": "lint-staged",
"publish": "lerna publish --conventional-commits",
"reinstall": "yarn clean && yarn install",
"start": "lerna run start --stream --parallel --include-filtered-dependencies",
Expand Down Expand Up @@ -101,5 +100,11 @@
"npx": "9.7.1",
"prettier": "1.10.2",
"xo": "0.20.3"
},
"husky": {
"hooks": {
"commit-msg": "node @commitlint/cli/lib/cli.js -E HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged"
}
}
}

0 comments on commit 48ac391

Please sign in to comment.