Skip to content

Commit

Permalink
chore: update pre-commit (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao authored Aug 14, 2024
1 parent 677392f commit c6bc1f7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/bin/sh
[ -n "$CI" ] && exit 0
. "$(dirname "$0")/_/husky.sh"

npx commitlint -e $HUSKY_GIT_PARAMS

exec < /dev/tty && npx cz --hook || true
npx --no-install commitlint --edit ""
3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
[ -n "$CI" ] && exit 0
. "$(dirname "$0")/_/husky.sh"

npm run lint:fix
npx lint-staged && log_emails=$(git config user.email) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo 本地提交邮箱 $log_emails 校验非法,需要本地更改重新提交 && exit 2;else echo 邮箱 $log_emails 校验通过;fi
6 changes: 6 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
[[ "$(uname -a)" = *"MINGW64"* ]] && exit 0
[ -n "$CI" ] && exit 0
. "$(dirname "$0")/_/husky.sh"

exec < /dev/tty && npx git-cz --hook || true
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"inquirer": "^8.2.0",
"jsdom": "^24.1.0",
"less": "^4.1.2",
"lint-staged": "^15.2.9",
"markdown-it-fence": "^0.1.3",
"mockdate": "^3.0.5",
"npm-run-all": "^4.1.5",
Expand Down Expand Up @@ -173,5 +174,11 @@
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"lint-staged": {
"src/**/*.{ts,tsx,js,jsx}": [
"prettier --write",
"npm run lint:fix"
]
}
}
}

0 comments on commit c6bc1f7

Please sign in to comment.