On this page
Overview
lint-staged is a development tool that runs linters, formatters, and other tasks only against Git files included in the next commit. Projects map file patterns to commands and invoke it from a pre-commit hook or directly. This narrows quality checks to changed files instead of scanning the whole project every time.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Match staged files by pattern and pass them to existing tools
Commands configured for each glob pattern receive the matching staged-file list as arguments. Existing tools such as ESLint and Prettier can be combined, and multiple commands can run sequentially or in parallel. By default, lint-staged backs up the original state in a Git stash and stages changes produced by tasks.
Sources: [1]
Best fit
Fits teams that want shared commit checks without scanning an entire repository
lint-staged is useful in large repositories where only changed JavaScript, JSON, Markdown, or other matched files need formatting and static checks. Committing its configuration and Git hook lets contributors run the same checks before each commit.
Sources: [1]
Before adoption
Tasks can change both the worktree and index, so review their side effects
Because configurations run arbitrary shell commands, broad rewrites and commands that ignore their file arguments need care. In a repository with at least one commit, the default workflow first creates a backup stash. In v17.6.0, all tracked files changed by tasks are staged; if a task edits a file with unstaged work, that work can be staged as well. Use --hide-unstaged when appropriate and test the workflow on a small change first. Version 17.6.0 requires Node.js 22.22.1 or newer and is MIT licensed.
Official sources
- [1]lint-staged — README at v17.6.0(2026-10-04)
- [2]lint-staged — package.json at v17.6.0(2026-10-04)
- [3]lint-staged v17.6.0 release(2026-10-04)
- [4]lint-staged — MIT license(2026-10-04)
Supplemental curator note
lint-staged reduces feedback time by narrowing checks to commit candidates rather than skipping quality gates. During adoption, test how every configured task affects the index and any unstaged work, not just whether formatting succeeds.
Try it in 3 steps
- 1
Install the checking tools as development dependencies
Use Node.js 22.22.1 or newer in a new disposable Git/npm test project or test branch with at least one commit. The following step creates configuration files.
npm install --save-dev lint-staged@17.6.0 eslint@9 - 2
Configure ESLint and lint-staged
Create a minimal ESLint flat config and a lint-staged config that fixes staged JavaScript from the project root.
cat > eslint.config.mjs <<'EOF' export default [{ files: ["**/*.js"], rules: { semi: ["error", "always"] } }] EOF cat > lint-staged.config.mjs <<'EOF' export default { "*.js": "eslint --fix" } EOF - 3
Stage a real file and run the check
Confirm that ESLint adds the semicolon and lint-staged stages the task change. By default it creates a backup stash for tracked state, so test on a clean disposable branch.
printf 'const answer = 42\n' > lint-demo.js git add lint-demo.js eslint.config.mjs lint-staged.config.mjs package.json package-lock.json npx lint-staged
Growth
Growth trends · Last 30 days
14,740 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 44
- Open PRs
- 0
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- stage-files
- linter
- stylelint
- eslint
- git
- developer-experience
- workflow
- Stars
- 14,740
- Forks
- 473
- Watchers
- 39
- Open issues
- 2
- Contributors
- 157
- Owner type
- Organization
- Primary language
- JavaScript
- License
- MIT
- Repository last updated
- Sep 26, 2026
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Electron123,376 Stars
2 shared tag(s) · 1 shared category(s)
bundle Chromium and Node.js to build desktop applications for three major operating systems with HTML, CSS, and JavaScript
C++ - Storybook91,195 Stars
2 shared tag(s) · 1 shared category(s)
capture UI states once and reuse them across docs, interaction tests, and agent tooling
TypeScript - Docusaurus66,390 Stars
2 shared tag(s) · 1 shared category(s)
combine docs, blogs, custom React pages, and localization into a static documentation-site build
TypeScript - Expo52,545 Stars
2 shared tag(s) · 1 shared category(s)
build React Native apps for Android, iOS, and web from one project model
TypeScript - commitlint18,758 Stars
3 shared tag(s) · 2 shared category(s)
lint Git commit messages against Conventional Commits and custom rules so release and changelog automation receives consistent metadata
TypeScript - Changesets12,466 Stars
3 shared tag(s) · 2 shared category(s)
record SemVer bump intent and changelog notes with each change, then coordinate version updates and package publishing across monorepos
TypeScript
Report incorrect information
Tell us if any listing information is incorrect or outdated.