diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..498dea92 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,17 @@ +#!/bin/sh + +# Get the current branch +branch="$(git rev-parse --abbrev-ref HEAD)" + +case $branch in + # If the branch starts with "changeset-release/*", run `check:fix` to auto + # format code generated by changesets. + # + # Note: For better developer experience, format-on-save is handled by each + # individual's IDE. We run `check` on pre-push to ensure the code is + # formatted. + "changeset-release/"*) + pnpm check:fix + git add . + ;; +esac \ No newline at end of file