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.

Evaluated Mar 06, 2026 (0d ago) v15.x
Homepage ↗ Repo ↗ Developer Tools git staged-files linting formatting pre-commit eslint prettier automation
⚙ Agent Friendliness
69
/ 100
Can an agent use this?
🔒 Security
97
/ 100
Is it safe for agents?
⚡ Reliability
90
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
90
Error Messages
82
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
88
Secret Handling
95

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

Uptime/SLA
100
Version Stability
88
Breaking Changes
85
Error Recovery
88
AF Security 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

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
No
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Local tool — no authentication. Runs entirely within the local Git repository.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

lint-staged is MIT open source. Maintained by Andrey Okonetchnikov and community.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

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.

$99

Scores are editorial opinions as of 2026-03-06.

5215
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered