Skip to content

Commit

Permalink
fix(husky): migrate to latest version (#6)
Browse files Browse the repository at this point in the history
* 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`
  • Loading branch information
DoubleU23 authored Sep 27, 2021
1 parent f1f752d commit b3c5da5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm test
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"lint": "eslint --fix --ext \".js,.jsx,.ts,.tsx\" . --quiet --format pretty && prettier **/*.{css,scss,md,json} --write",
"clean": "rimraf build",
"build": "npm run clean && webpack -p --mode production --env production",
"start": "webpack-dev-server --open --mode development --env development_core"
"start": "webpack-dev-server --open --mode development --env development_core",
"prepare": "husky install"
},
"repository": {
"type": "git",
Expand All @@ -22,17 +23,16 @@
"homepage": "https://github.com/stackr23/react-stack#readme",
"husky": {
"hooks": {
"pre-commit": "lint-staged"
"pre-commit": "lint-staged",
"pre-push": "npm test"
}
},
"lint-staged": {
"*.{css,scss,json,md}": [
"prettier --write",
"git add"
"*.{css,scss,json,md,yml}": [
"prettier --write"
],
"*.{js,jsx,ts,tsx}": [
"eslint --fix --quiet",
"git add"
"eslint --fix --quiet"
]
},
"devDependencies": {
Expand All @@ -46,7 +46,7 @@
"@stackr23/config-eslint": "^2.0.4",
"@stackr23/webpack": "^2.1.1",
"eslint": "^7.27.0",
"husky": "^6.0.0",
"husky": "^7.0.2",
"karma": "^6.3.4",
"lint-staged": "^11.0.0",
"rimraf": "^3.0.2",
Expand Down

0 comments on commit b3c5da5

Please sign in to comment.