Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 0b35cd9

Browse files
authored
Merge pull request #228 from streamr-dev/conventional-commits
Add husky & commitlint to enforce conventional-commit messages
2 parents 7c0b343 + c4518eb commit 0b35cd9

File tree

5 files changed

+1014
-2
lines changed

5 files changed

+1014
-2
lines changed

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //')
3+
4+
if [ $BRANCH_NAME != '(no branch)' ]
5+
then
6+
# don't run hook when rebasing
7+
. "$(dirname "$0")/_/husky.sh"
8+
9+
npx --no-install commitlint --edit
10+
fi

commitlint.config.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
// don't care about line length
5+
// 200 seems generous, also just warn
6+
'header-max-length': [1, 'always', 200],
7+
'body-max-line-length': [1, 'always', 200],
8+
'footer-max-line-length': [1, 'always', 200],
9+
// don't care about case
10+
'header-case': [0, 'always', 'lower-case'],
11+
'subject-case': [0, 'always', 'lower-case'],
12+
'body-case': [0, 'always', 'lower-case'],
13+
// don't care about trailing full-stop.
14+
'subject-full-stop': [0, 'never', '.'],
15+
'header-full-stop': [0, 'never', '.'],
16+
// valid types + descriptions
17+
// feel free to add more types as necessary
18+
'type-enum': [2, 'always', [
19+
'build', // Changes that affect the build system
20+
'ci', // Changes to our CI configuration files and scripts.
21+
'docs', // Documentation only changes
22+
'feat', // A new feature
23+
'fix', // A bug fix
24+
'perf', // A code change that improves performance
25+
'refactor', // A code change that neither fixes a bug nor adds a feature
26+
'style', // Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
27+
'test', // Adding missing tests or correcting existing tests
28+
'revert', // git revert
29+
'deps', // Changes that affect external dependencies e.g. refreshing package-lock, updating deps.
30+
'deploy', // for gh-pages
31+
]],
32+
}
33+
}

0 commit comments

Comments
 (0)