This document provides instructions on setting up pre-commit hooks to ensure that code is properly formatted and linted, and tests are run before each commit.
Navigate to or Create the .husky
directory and a pre-commit
file:
mkdir -p .husky
touch .husky/pre-commit
. "$(dirname "$0")/_/husky.sh"
npx lint-staged && npm test
lint-staged is optional, it is recommended that npm test goes alone
chmod +x .husky/pre-commit