diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 00000000..f137fefd --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,7 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +# Skip commit-msg hook on CI +[ -n "$CI" ] && exit 0 + +npx commitlint --edit $1 diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..1500ab63 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,7 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +# Skip pre-commit hook on CI +[ -n "$CI" ] && exit 0 + +npx lint-staged diff --git a/.huskyrc b/.huskyrc deleted file mode 100644 index 914cf42e..00000000 --- a/.huskyrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "hooks": { - "pre-commit": "lint-staged", - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" - } -} diff --git a/package.json b/package.json index 7480c391..783888a8 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "test:update": "npm run test -- --u", "test:watch": "npm run test -- --watch", "type-check": "tsc --noEmit", - "semantic-release": "semantic-release" + "semantic-release": "semantic-release", + "prepare": "husky install" }, "dependencies": { "@typescript-eslint/experimental-utils": "^4.24.0" @@ -60,9 +61,9 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-promise": "^5.1.0", - "husky": "^4.3.8", + "husky": "^7.0.0", "jest": "^27.0.4", - "lint-staged": "^10.5.4", + "lint-staged": "^11.1.1", "prettier": "2.3.2", "semantic-release": "^17.4.3", "ts-jest": "^27.0.3",