Skip to content

Commit c464090

Browse files
committed
chore(infra): add husky hooks
1 parent fc154cb commit c464090

File tree

4 files changed

+593
-16
lines changed

4 files changed

+593
-16
lines changed

.huskyrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"hooks": {
3+
"pre-commit": "pretty-quick --staged && npm run lint:staged",
4+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
5+
}
6+
}

commitlint.config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module.exports = {
2+
rules: {
3+
'body-leading-blank': [1, 'always'],
4+
'footer-leading-blank': [1, 'always'],
5+
'header-max-length': [2, 'always', 72],
6+
'scope-case': [0],
7+
'subject-case': [0],
8+
'subject-empty': [2, 'never'],
9+
'subject-full-stop': [2, 'never', '.'],
10+
'type-case': [2, 'always', 'lower-case'],
11+
'type-empty': [2, 'never'],
12+
'type-enum': [
13+
2,
14+
'always',
15+
[
16+
'build',
17+
'chore',
18+
'ci',
19+
'docs',
20+
'feat',
21+
'fix',
22+
'perf',
23+
'refactor',
24+
'revert',
25+
'style',
26+
'test',
27+
],
28+
],
29+
},
30+
}

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"ios": "expo start --ios",
77
"eject": "expo eject",
88
"test": "node ./node_modules/jest/bin/jest.js --watchAll",
9-
"lint": "eslint containers/*"
9+
"lint": "eslint containers/*",
10+
"lint:staged": "git diff --cached --name-only --diff-filter=ACRM | grep \".js$\" | xargs ./node_modules/.bin/eslint"
1011
},
1112
"jest": {
1213
"preset": "jest-expo"
@@ -23,10 +24,14 @@
2324
"styled-components": "^4.3.1"
2425
},
2526
"devDependencies": {
27+
"@commitlint/cli": "^8.0.0",
28+
"@commitlint/config-conventional": "^8.0.0",
2629
"babel-preset-expo": "^5.0.0",
2730
"eslint": "^5.16.0",
2831
"eslint-config-react-native-wcandillon": "^1.2.4",
29-
"jest-expo": "^33.0.0"
32+
"husky": "^2.4.1",
33+
"jest-expo": "^33.0.0",
34+
"pretty-quick": "^1.11.1"
3035
},
3136
"private": true
3237
}

0 commit comments

Comments
 (0)