Skip to content

chore: stop linting and tracking local build artifacts - #121

Open
CAMOBAP wants to merge 1 commit into
masterfrom
chore/ignore-build-artifacts
Open

CAMOBAP wants to merge 1 commit into
masterfrom
chore/ignore-build-artifacts

Conversation

@CAMOBAP

@CAMOBAP CAMOBAP commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

The problem

npm run lint is bare eslint .. ESLint skips node_modules and dotfiles on its own, but it
does not read .gitignore — so any locally generated output is linted as if it were source.

With a dist/bundle.js from a web build and a coverage/ from jest --coverage present, an
otherwise clean tree reports:

TOTAL problems: 57084
files linted: 62
  dist: 57081
  coverage: 3

Zero of those come from real source. Since npm run lint is in the pre-commit hook, committing
anything becomes impossible until you delete the directories — or pass --no-verify, which
skips the tests too and defeats the point of having the hook.

Why CI never caught it

The build job lints a fresh checkout where neither directory exists: npm test runs without
--coverage, and no committed script produces dist/. The failure only ever lands on a
contributor'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.js ignorePatterns stops the lint run from reading the artifacts. This is the
    half that actually unbreaks the hook.
  • .gitignore keeps them out of git status so they can't be committed by accident.

.serena/ is a dotdir, so ESLint already skips it — it only needs the .gitignore entry.

Validation

Same tree, with dist/ and coverage/ present in both cases:

before after
npm run lint 57,084 problems, exit 1 0 problems, exit 0
files linted 62 58 (the 4 artifact files, no source)
git status --short ?? dist/ ?? coverage/ ?? .serena/ clean

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 get
to zero.

npm test passes (60 tests, 4 suites), and the pre-commit hook ran both for real on this
commit rather than being bypassed.

🤖 Generated with Claude Code

`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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant