48.6 Pre-Commit Hooks with Husky and lint-staged for TypeScript
Right, let’s talk about pre-commit hooks. You’re about to automate the most annoying, nagging part of your workflow: catching stupid mistakes before they become a commit message you have to explain to your team. This isn’t just about linting; it’s about professional-grade hygiene. We’re going to use Husky to easily manage Git hooks and lint-staged to be brutally efficient about it. Why run linting on your entire 10,000-file project when you only changed two? That’s like washing your entire car because a bird targeted your windshield. lint-staged is your detail-oriented friend with the Windex and a rag.