ESLint on staged files only, or the hook gets skipped

Lint failures arriving from CI ten minutes after a push are a context switch for something a machine could have fixed before the commit existed — and a hook that lints the whole project is a hook people bypass.

{
  "husky": { "hooks": { "pre-commit": "lint-staged" } },
  "lint-staged": {
    "*.{js,jsx,ts,tsx}": ["eslint --fix", "git add"],
    "*.{css,scss}": ["stylelint --fix", "git add"],
    "*.php": ["vendor/bin/phpcbf", "git add"]
  }
}

Running only on staged files is what keeps it fast enough to tolerate, and --fix doing the mechanical corrections silently is most of the value — formatting arguments in review are pure waste. The same rules have to run in CI as well, because a hook is advisory: anyone can pass --no-verify, and somebody will. The git add step re-stages what the fixer changed, and omitting it produces a commit that does not contain the fixes.