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

Commit 360932b

Browse files
committed
style(git): Add husky & commitlint to enforce conventional-commit format.
1 parent dcb9ab2 commit 360932b

File tree

5 files changed

+998
-2
lines changed

5 files changed

+998
-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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
}
17+
}

0 commit comments

Comments
 (0)