{
 "kind": "tool",
 "slug": "lint-staged",
 "path": "tools/lint-staged/",
 "name": "lint-staged",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Dev workflow and config",
   "tools/dev-workflow/"
  ]
 ],
 "lead": "Run linters on git staged files to catch issues before commit.",
 "chips": [
  {
   "label": "Dev workflow and config",
   "path": "tools/dev-workflow/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install lint-staged"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/lint-staged/lint-staged"
  },
  {
   "label": "Website",
   "href": "https://github.com/lint-staged/lint-staged#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/lint-staged/lint-staged"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 22, 2026",
   "note": "Latest GitHub release Nov 22, 2026. ",
   "src": "https://github.com/lint-staged/lint-staged"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "487 projects",
   "status": "info",
   "sub": "#4 of 299 in its category",
   "note": "Dependency in 487 public GitHub projects set up for AI coding agents that we scanned (7.8%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://nextjs.org/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What lint-staged does",
   "parts": [
    {
     "t": "prose",
     "text": "lint-staged does not lint anything itself: it hands the list of staged files to whatever shell command you map to a glob, and wraps the run in a git stash backup so a failed task can be rolled back."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "lint-staged popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "80",
       "of": "/ 100",
       "l": "Gid Score, #98 overall"
      },
      {
       "n": "42.6M",
       "l": "downloads a week, npm"
      },
      {
       "n": "14.8K",
       "l": "GitHub stars"
      },
      {
       "n": "487",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How lint-staged is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "lint-staged is a dependency in 487 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (10.0% of the 4,867 JavaScript/TypeScript ones), #4 of 299 in dev workflow and config.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,035; those are left out of every share on this page.",
      "The most used alternative in our scan is Lefthook (127 projects).",
      "Projects that use it most often also use Husky (89.3%), Prettier (71.0%), ESLint (71.9%).",
      "It is more common in projects set up for OpenAI Codex (13.9%) than for GitHub Copilot (8.2%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "311 projects, 9.5%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "248 projects, 8.2%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "228 projects, 9.3%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "65 projects, 13.9%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "61 projects, 12.9%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "43 projects, 12.5%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "27 projects, 9.7%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "12 projects, 8.6%",
       "v": "Kiro",
       "path": "agents/kiro/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 89.3% of its projects",
       "v": "Husky",
       "path": "tools/husky/"
      },
      {
       "l": "In 71.0% of its projects",
       "v": "Prettier",
       "path": "tools/prettier/"
      },
      {
       "l": "In 71.9% of its projects",
       "v": "ESLint",
       "path": "tools/eslint/"
      },
      {
       "l": "In 82.3% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 46.0% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      },
      {
       "l": "In 39.4% of its projects",
       "v": "Playwright (JavaScript)",
       "path": "tools/playwright-test/"
      },
      {
       "l": "In 27.9% of its projects",
       "v": "Testing Library",
       "path": "tools/testing-library/"
      },
      {
       "l": "In 35.7% of its projects",
       "v": "Vite",
       "path": "tools/vite/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "lint-staged in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Any command, keyed by glob",
       "v": "lint-staged is not tied to one linter. The config maps picomatch globs to shell commands, so ESLint, Prettier, or a project script all plug in the same way."
      },
      {
       "l": "A stash backup before every run",
       "v": "The README says lint-staged stashes the original state before any task runs. If a task errors, task modifications are reverted by default, and lost changes can be restored from the stash entry it labels \"lint-staged automatic backup\"."
      },
      {
       "l": "Partially staged files are handled",
       "v": "If you used <code>git add --patch</code>, the unstaged parts of those files are hidden while tasks run and restored afterwards. <code>--hide-unstaged</code> and <code>--hide-all</code> extend this to all unstaged changes, and to untracked files too."
      },
      {
       "l": "Per-package configs in a monorepo",
       "v": "You can place several config files in a project. Each staged file uses the nearest one, and its tasks run in that config's directory."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Overlapping globs can race",
       "v": "Globs run concurrently by default. If two globs match the same file and both tasks edit files, they can write to it at once. The README's fix is a negation pattern plus the array syntax."
      },
      {
       "l": "Tasks can stage your unstaged edits",
       "v": "Since the latest release, lint-staged stages every tracked file a task modifies, including files you never staged. The release notes point to <code>--hide-unstaged</code> to avoid this."
      },
      {
       "l": "Some flags drop the safety stash",
       "v": "<code>--all</code> and <code>--diff</code> both imply <code>--no-stash</code>, so the automatic backup is off when you use them."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Typed config with defineConfig"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Js",
       "code": "import { defineConfig } from 'lint-staged/config'\n\nexport default defineConfig({\n  '*': 'prettier --write',\n})"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about lint-staged",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "Open Collective: https://opencollective.com/lint-staged"
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "husky: Git hook runner",
        "prettier: Code formatter",
        "eslint: JavaScript linter",
        "vitest: Unit test runner",
        "typescript: Typed JavaScript",
        "@playwright/test: End-to-end tests"
       ]
      },
      {
       "title": "More in Dev workflow and config",
       "path": "tools/dev-workflow/",
       "items": [
        {
         "text": "dotenv",
         "path": "tools/dotenv/"
        },
        {
         "text": "Husky",
         "path": "tools/husky/"
        },
        {
         "text": "python-dotenv",
         "path": "tools/python-dotenv/"
        },
        {
         "text": "concurrently",
         "path": "tools/concurrently/"
        },
        {
         "text": "Rich",
         "path": "tools/rich/"
        },
        {
         "text": "Pydantic Settings",
         "path": "tools/pydantic-settings/"
        },
        {
         "text": "cross-env",
         "path": "tools/cross-env/"
        },
        {
         "text": "chalk",
         "path": "tools/chalk/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "lint-staged",
       "me": true,
       "facts": [
        "MIT",
        "Gid 80",
        "42.6M/wk"
       ]
      },
      {
       "name": "Lefthook",
       "why": "Fast git hooks manager for running checks and tasks on commits.",
       "path": "tools/lefthook/",
       "facts": [
        "MIT",
        "Gid 70",
        "10.2M/wk"
       ]
      }
     ],
     "more": "Compare lint-staged with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install lint-staged"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## lint-staged\n- Install with `npm install --save-dev lint-staged`, then wire it into a `pre-commit` git hook (the README names Husky). Commit `package.json` and `.husky` so the team shares the setup.\n- Do not pass file paths in config commands: lint-staged appends the staged files as arguments.\n- Never let two globs that match the same files both run editing tasks. Use a negation pattern such as `!(*.ts)` plus the array syntax.\n- Use an array (`[\"prettier --list-different\", \"eslint\"]`) to run commands in order for one glob. Nest one more array to run them in parallel.\n- In CI, run `npx lint-staged --all`. Note that it implies `--no-stash`.\n- Type JS configs with `defineConfig` from `lint-staged/config`.\n- If tasks may edit files that have unstaged changes, use `--hide-unstaged`, or those changes get staged too.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm lint-staged"
  ],
  [
   "Category",
   "Dev workflow and config"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "v17.6.0, September 26, 2026"
  ],
  [
   "On GitHub since",
   "January 2016"
  ],
  [
   "Gid Score",
   "80.2"
  ],
  [
   "Rank in category",
   "#4 of 299"
  ],
  [
   "GitHub",
   "lint-staged/lint-staged"
  ],
  [
   "Last change",
   "Nov 22, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/lint-staged.png"
}