Skip to main content

πŸ›  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:

πŸ”Ή 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! πŸš€