Skip to content

Instantly share code, notes, and snippets.

@ruben1
Last active August 11, 2021 08:18
Show Gist options
  • Save ruben1/768dc68b25eeeefff78a2b23cc7680fd to your computer and use it in GitHub Desktop.
Save ruben1/768dc68b25eeeefff78a2b23cc7680fd to your computer and use it in GitHub Desktop.
Pre-commit git hook for CCI frontend projects
# Install
cd <project root>
touch .git/hooks/pre-commit # create pre-commit file
chmod +x .git/hooks/pre-commit # make it executable
# copy pre-commit contents to the file
# Use
git commit # will trigger the hook. you might see prettier rules fixed after committing
git commit --amend -n # after checking prettier changes look good, commit again and skip the hook this time
#!/bin/sh
set -eo pipefail
yarn lint --fix
yarn typecheck
yarn test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment