lint-staged and package lint apply different ESLint rule sets
Summary
lint-staged and the package-level lint commands currently enforce different ESLint rule sets. In particular, lint-staged catches jsx-a11y violations in @blueprintjs/select, while pnpm -C packages/select lint:es passes on the same files.
This is surprising because package lint is the canonical validation path for package work, and pre-commit should not be stricter or materially different from the package lint command.
Repro
From the repo root:
pnpm exec eslint packages/select/src/components/select/select.tsx --max-warnings 0
This reports:
packages/select/src/components/select/select.tsx
199:17 error The autoFocus prop should not be used jsx-a11y/no-autofocus
207:21 error Avoid non-native interactive elements jsx-a11y/no-static-element-interactions
But the package lint command passes:
pnpm -C packages/select lint:es
Output:
[node-build-scripts/es-lint] Done running ESLint, with no errors.
A config check shows the mismatch too:
pnpm -C packages/select exec eslint --print-config src/components/select/select.tsx | rg jsx-a11y
This does not show the jsx-a11y rules that root ESLint applies.
Expected Behavior
lint-staged, root ESLint, and package-level lint should agree on the ESLint rules applied to a file.
If jsx-a11y is enabled for packages/select, then pnpm -C packages/select lint:es should catch those violations too. If it is not intended to be enabled for select, then lint-staged should not block commits on those rules.
Likely Cause
lint-staged runs raw ESLint from the repo root:
"*.{ts,tsx}": "eslint --fix --max-warnings 0"
The root config enables jsx-a11y for package paths like:
files: ["**/packages/{core,datetime,datetime2,select,table}/**/*.{ts,tsx}"]
But pnpm -C packages/select lint:es runs the shared es-lint wrapper from the package cwd. From that cwd, files are linted as src/..., so the root package-path glob no longer matches and the jsx-a11y rules are skipped.
Impact
This can block commits on lint violations that package lint does not report, making the pre-commit hook feel flaky or overly aggressive. It also means existing package lint and CI/Nx lint behavior may be missing rules that the root ESLint config appears to intend to enforce.
Possible Fixes
- Make the shared
es-lintwrapper run ESLint with a stable repo-root cwd/config so package lint and root lint resolve globs consistently. - Or change
lint-stagedto invoke the same canonical package/Nx lint path used by normal package validation. - After the lint paths agree, clean up or intentionally suppress any newly exposed
jsx-a11yviolations in affected packages.
Source: palantir/blueprint