Skip to content

Commit

Permalink
🧑‍💻 use husky for pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Jan 21, 2025
1 parent 39553ac commit f519b8d
Show file tree
Hide file tree
Showing 5 changed files with 741 additions and 62 deletions.
8 changes: 8 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
bash <<EOF
if [[ "$(git branch --show-current)" == "main" ]]; then
echo "❌ Do not commit to main branch" >&2
exit 1
fi
EOF

npx lint-staged
6 changes: 6 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# prompt for gitmoji
exec < /dev/tty
cat .git/COMMIT_EDITMSG | npx commitlint -q || {
npx --package=gitmoji-cli -- gitmoji --hook $1 $2;
cat .git/COMMIT_EDITMSG | npx commitlint
}
36 changes: 0 additions & 36 deletions .pre-commit-config.yaml

This file was deleted.

Loading

0 comments on commit f519b8d

Please sign in to comment.