Lint-Staged
ELI5 — The Vibe Check
Lint-Staged runs linters only on files you're about to commit, not the entire project. Changed 3 files? Lint those 3. It's the difference between cleaning your entire house and just tidying the room the guests will see. Fast, focused, and doesn't waste your time.
Real Talk
Lint-staged runs configured linters and formatters against staged Git files before commit. It only processes files that are about to be committed, making pre-commit hooks fast even in large repositories. Supports glob patterns for targeting specific file types.
Show Me The Code
// package.json
{
"lint-staged": {
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
"*.css": "stylelint --fix",
"*.md": "prettier --write"
}
}
When You'll Hear This
"Lint-staged auto-fixes formatting on commit — I never think about Prettier." / "It only lints staged files, so pre-commit hooks take seconds, not minutes."
Related Terms
ESLint
ESLint is the code cop that reads your JavaScript and yells at you when you do something wrong or inconsistent.
Husky
Husky manages Git hooks in your Node.js project. Pre-commit? Pre-push?
Pre-Commit Hooks
Pre-commit hooks are scripts that run automatically before every Git commit.
Prettier
Prettier is an opinionated code formatter that automatically reformats your code to look consistent. Single quotes or double quotes? 2 spaces or 4?