Skip to content

Commit 0564eaf

Browse files
committed
chore: switch to husky v7
1 parent 0cda561 commit 0564eaf

File tree

5 files changed

+39
-6
lines changed

5 files changed

+39
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules/
44
.DS_Store
55
yarn.lock
66
*.tar.gz
7+
!.husky/_/husky.sh

.husky/_/husky.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
if [ -z "$husky_skip_init" ]; then
3+
debug () {
4+
if [ "$HUSKY_DEBUG" = "1" ]; then
5+
echo "husky (debug) - $1"
6+
fi
7+
}
8+
9+
readonly hook_name="$(basename "$0")"
10+
debug "starting $hook_name..."
11+
12+
if [ "$HUSKY" = "0" ]; then
13+
debug "HUSKY env variable is set to 0, skipping hook"
14+
exit 0
15+
fi
16+
17+
if [ -f ~/.huskyrc ]; then
18+
debug "sourcing ~/.huskyrc"
19+
. ~/.huskyrc
20+
fi
21+
22+
export readonly husky_skip_init=1
23+
sh -e "$0" "$@"
24+
exitCode="$?"
25+
26+
if [ $exitCode != 0 ]; then
27+
echo "husky - $hook_name hook exited with code $exitCode (error)"
28+
fi
29+
30+
exit $exitCode
31+
fi

.husky/post-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
git update-index --again

.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
yarn lint-staged

package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,11 @@
3131
"devDependencies": {
3232
"@shelf/eslint-config": "0.19.0",
3333
"eslint": "7.6.0",
34-
"husky": "4.2.5",
34+
"husky": "7.0.4",
3535
"jest": "26.2.2",
3636
"lint-staged": "10.2.11",
3737
"prettier": "2.0.5"
3838
},
39-
"husky": {
40-
"hooks": {
41-
"pre-commit": "lint-staged"
42-
}
43-
},
4439
"lint-staged": {
4540
"*.js": [
4641
"eslint --fix",

0 commit comments

Comments
 (0)