fix: stop package-lock.json drift - #2451
Merged
Merged
Conversation
…n drift @conventional-changelog/git-client (transitive dep of @commitlint/cli via @commitlint/read) declares conventional-commits-parser and conventional-commits-filter as optional peer dependencies with no other hard consumer in the tree. npm's resolution of unclaimed optional peers is order-sensitive, so nearly every commit touching package-lock.json flipped these entries in or out regardless of what the commit actually changed (confirmed via git log -S across ~15 unrelated commits, including two prior one-off "sync package-lock.json" fixes that didn't hold). Overriding both to fixed versions forces a single deterministic resolution instead of an optional-peer coin flip. Verified stable across a full clean reinstall (rm -rf node_modules && npm install) with zero further lockfile diff.
mariechatfield
marked this pull request as ready for review
July 22, 2026 16:15
serikjensen
approved these changes
Jul 22, 2026
mariechatfield
enabled auto-merge
July 22, 2026 16:20
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.
Summary
package-lock.jsonhas been flapping on nearly every dependabot merge, including two prior one-off fixes (#2393, and an earlier "chore: fix package-lock.json sync issue") that didn't hold — see #2446 for the latest recurrence.Root cause:
@conventional-changelog/git-client(transitive dep of@commitlint/clivia@commitlint/read) declaresconventional-commits-parserandconventional-commits-filteras optional peer dependencies with no other hard consumer anywhere in the tree:npm's resolution of an unclaimed optional peer like this is order-sensitive rather than input-sensitive — the same
package.jsoncan resolve either way depending on install state.git log -Son the relevant lockfile block shows it flipping in and out across ~15 unrelated commits (dependabot and human PRs alike), unrelated to whatever each commit was actually about.Fix
Add both packages to the existing
overridesblock, forcing a single deterministic resolution instead of leaving it to the optional-peer coin flip:This also collapses duplicated nested copies (
@commitlint/parse/node_modules/...,@commitlint/types/node_modules/...) into one hoisted resolution.Test plan
rm -rf node_modules && npm install— verified byte-identicalpackage-lock.jsonacross repeated clean installs (no more drift)npm run build,npm run lint:stagedran clean via lint-staged pre-commit hook🤖 Generated with Claude Code