Repository navigation
Conversation
`npm run lint` is bare `eslint .`, and ESLint only skips node_modules and dotfiles on its own - it does not read .gitignore. Any locally generated output therefore gets linted as if it were source. A `dist/bundle.js` from a web build reports 57,081 problems and `coverage/` another 3, which fails the pre-commit hook on an otherwise clean tree. CI never hits this: it lints a fresh checkout where neither directory exists, `npm test` runs without --coverage, and no committed script produces `dist/`. So the breakage only ever lands on a contributor's machine, and the obvious workaround is `--no-verify`, which defeats the hook entirely. Ignore the artifacts on both sides, since they fix different problems: ESLint's ignorePatterns stops the lint run from reading them, and .gitignore keeps them out of `git status`. .serena/ is a dotdir, so ESLint already skips it; it only needs the .gitignore entry. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
npm run lintis bareeslint .. ESLint skipsnode_modulesand dotfiles on its own, but itdoes not read
.gitignore— so any locally generated output is linted as if it were source.With a
dist/bundle.jsfrom a web build and acoverage/fromjest --coveragepresent, anotherwise clean tree reports:
Zero of those come from real source. Since
npm run lintis in the pre-commit hook, committinganything becomes impossible until you delete the directories — or pass
--no-verify, whichskips the tests too and defeats the point of having the hook.
Why CI never caught it
The
buildjob lints a fresh checkout where neither directory exists:npm testruns without--coverage, and no committed script producesdist/. The failure only ever lands on acontributor's machine, which is also why it has survived this long.
This does mean CI cannot reproduce the bug, so the checks on this PR confirm no regression
rather than demonstrating the fix. The evidence for the fix itself is below.
The fix
Both sides are needed, because they solve different problems:
.eslintrc.jsignorePatternsstops the lint run from reading the artifacts. This is thehalf that actually unbreaks the hook.
.gitignorekeeps them out ofgit statusso they can't be committed by accident..serena/is a dotdir, so ESLint already skips it — it only needs the.gitignoreentry.Validation
Same tree, with
dist/andcoverage/present in both cases:npm run lintgit status --short?? dist/ ?? coverage/ ?? .serena/The source files ESLint still reads are unchanged —
Hcaptcha.js,index.js,__tests__/,__e2e__/,__scripts__/,journey/,md5.js, the configs. Nothing real was ignored to getto zero.
npm testpasses (60 tests, 4 suites), and the pre-commit hook ran both for real on thiscommit rather than being bypassed.
🤖 Generated with Claude Code