Pre-commit hook doesn't flag deleted build assets (js/css)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6
- Forks
- 1
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 10
Description
TL;DR: .githooks/pre-commit only checks staged files with --diff-filter=ACM (Added/Copied/Modified), never D (Deleted). Before #129, local builds never deleted anything under js//css/ (fixed js/ filenames, css/ only grew), so the gap was invisible. After #129 (which empties css/ before each build to stop stale hashed chunks from accumulating), a local npm run build && git commit -am ... will silently commit CSS deletions — the hook stays quiet, and CI's npm-build "check build changes" job even goes green on that commit since the output matches.
Detail
.githooks/pre-commitline ~14:git diff --cached --name-only --diff-filter=ACM -- js/ css/(or equivalent) never surfaces deleted paths, so the hook's "you're about to commit generated build assets" guard silently misses deletions.- This repo's intended flow (per
AGENTS.md) is: contributors runnpm run buildlocally to test, thengit restore --staged js cssbefore committing — the hook is meant as a backstop for anyone who forgets. That backstop has a hole specifically for deletions. - Suggested fix: include
Din the--diff-filter(e.g.--diff-filter=ACMD), so a staged deletion underjs//css/trips the same warning as an addition/modification. - Found during review of #129 (build: remove outdated CSS files when building).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with .githooks/pre-commit around line 14 and read AGENTS.md for the intended build and staging flow. Run npm run build, stage a deletion under js/ or css/, and verify the hook warns about it; done means deleted build assets trigger the same guard as additions and modifications.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, javascript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100