lint-staged
Runs linters and formatters against staged Git files only — not the entire codebase. lint-staged intercepts the pre-commit hook, identifies which files are staged, and runs configured commands (ESLint, Prettier, TypeScript check) only on those files. Dramatically faster than running linters on the full codebase, making pre-commit checks practical even in large repositories. The standard companion to Husky.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Local tool — no network access. Runs configured commands on local files only. MIT licensed. Main risk is executing misconfigured commands that modify files unexpectedly.
⚡ Reliability
Best When
You want fast pre-commit linting that only processes files being committed, making quality gates practical in large codebases.
Avoid When
You need to lint the entire codebase (use linters directly in CI) or work in non-Node environments.
Use Cases
- • Run Prettier automatically on staged files only during pre-commit — formats just the files being committed, not the whole codebase
- • Execute ESLint on staged JavaScript/TypeScript files before commit to catch errors without full-codebase lint overhead
- • Run Python linters (Black, isort, flake8) on staged Python files using lint-staged with Python scripts configured
- • Apply multiple formatters in sequence on staged files — first Prettier, then ESLint --fix — in a single lint-staged pipeline
- • Block commits with linting errors while automatically fixing auto-fixable issues using lint-staged's auto-fix workflow
Not For
- • Full-codebase linting in CI — lint-staged only operates on staged files; use ESLint/Biome directly in CI for full linting
- • Non-Git workflows — lint-staged requires Git staging area; no equivalent for other VCS systems
- • Language-agnostic setups without npm — lint-staged is an npm package, requires Node.js
Interface
Authentication
Local tool — no authentication. Runs entirely within the local Git repository.
Pricing
lint-staged is MIT open source. Maintained by Andrey Okonetchnikov and community.
Agent Metadata
Known Gotchas
- ⚠ lint-staged passes staged files to configured commands as arguments — the command pattern 'prettier --write' becomes 'prettier --write file1.ts file2.ts'; tools that don't accept filename arguments need wrapper scripts
- ⚠ When using auto-fixers (Prettier --write, ESLint --fix), lint-staged re-stages the fixed files automatically — this is the intended workflow but can surprise first-time users
- ⚠ Glob patterns in lint-staged config use micromatch — slightly different from standard glob; e.g., '**/*.ts' matches nested files but '*.ts' only matches root-level files
- ⚠ lint-staged 15.x runs commands in parallel by default — if commands have dependencies (e.g., Prettier must run before ESLint), configure them as a sequential array
- ⚠ Git partial staging (staging only some hunks of a file) interacts poorly with auto-fixers — lint-staged may reformat unstaged changes, causing unexpected diff
- ⚠ lint-staged config can be in package.json or .lintstagedrc; config in package.json under 'lint-staged' key is the most common — verify which format your version supports
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for lint-staged.
Scores are editorial opinions as of 2026-03-06.