π Husky Configuration
This project uses Husky to enforce pre-commit and pre-push hooks, ensuring that only properly formatted and linted code is committed and pushed.
π Husky Hooks Explained:β
πΉ Commit Message Validation (commit-msg
hook)β
This hook ensures that commit messages follow the conventional commit format by running commitlint
.
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no -- commitlint --edit "$1"
β What it does:
- Ensures commit messages follow Conventional Commits.
- Prevents commits con mensajes invΓ‘lidos.
πΉ Pre-Commit Hook (pre-commit
hook)β
This hook runs npm run check
before allowing a commit to proceed.
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run check
β What it does:
- Runs ESLint, Prettier, and any additional checks before committing.
- Prevents commits si el cΓ³digo no pasa las validaciones.
πΉ Pre-Push Hook (pre-push
hook)β
This hook runs the test suite before allowing a push.
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npm run test -- --run
β What it does:
- Ensures that all tests pass before pushing changes.
- Prevents pushing cΓ³digo que pueda romper la aplicaciΓ³n.
By using ESLint + Prettier + Husky, we ensure a well-structured, readable, and maintainable codebase while enforcing best practices! π