Skip to content

Commit b3c5da5

Browse files
authored
fix(husky): migrate to latest version (#6)
* deps: update `husky` to latest version (v7) * config(npm): add `husky install` to prepare lifecycle * config(lint-staged): remove `git add` * config: add `yml` to prettiers `lint-staged` hook * config(husky): add pre-commit hook for `lint-staged` * config(husky): add pre-push hook for `npm test`
1 parent f1f752d commit b3c5da5

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

.husky/pre-commit

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

.husky/pre-push

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

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"lint": "eslint --fix --ext \".js,.jsx,.ts,.tsx\" . --quiet --format pretty && prettier **/*.{css,scss,md,json} --write",
99
"clean": "rimraf build",
1010
"build": "npm run clean && webpack -p --mode production --env production",
11-
"start": "webpack-dev-server --open --mode development --env development_core"
11+
"start": "webpack-dev-server --open --mode development --env development_core",
12+
"prepare": "husky install"
1213
},
1314
"repository": {
1415
"type": "git",
@@ -22,17 +23,16 @@
2223
"homepage": "https://github.com/stackr23/react-stack#readme",
2324
"husky": {
2425
"hooks": {
25-
"pre-commit": "lint-staged"
26+
"pre-commit": "lint-staged",
27+
"pre-push": "npm test"
2628
}
2729
},
2830
"lint-staged": {
29-
"*.{css,scss,json,md}": [
30-
"prettier --write",
31-
"git add"
31+
"*.{css,scss,json,md,yml}": [
32+
"prettier --write"
3233
],
3334
"*.{js,jsx,ts,tsx}": [
34-
"eslint --fix --quiet",
35-
"git add"
35+
"eslint --fix --quiet"
3636
]
3737
},
3838
"devDependencies": {
@@ -46,7 +46,7 @@
4646
"@stackr23/config-eslint": "^2.0.4",
4747
"@stackr23/webpack": "^2.1.1",
4848
"eslint": "^7.27.0",
49-
"husky": "^6.0.0",
49+
"husky": "^7.0.2",
5050
"karma": "^6.3.4",
5151
"lint-staged": "^11.0.0",
5252
"rimraf": "^3.0.2",

0 commit comments

Comments
 (0)