Skip to content

fix: strip parent dangling conflict commas#125

Open
pupuking723 wants to merge 1 commit into
npm:mainfrom
pupuking723:fix/trailing-parent-comma
Open

fix: strip parent dangling conflict commas#125
pupuking723 wants to merge 1 commit into
npm:mainfrom
pupuking723:fix/trailing-parent-comma

Conversation

@pupuking723

Copy link
Copy Markdown

Fixes #115.

When a conflict block covers the final property of an object, the synthesized parent JSON can keep the separator comma from the previous top-level line:

{
  "foo": "foo",
}

That parent is only an intermediate baseline used for diff resolution, but parsing it currently throws before the selected side can be applied.

This strips dangling commas from the synthesized parent fragment before parsing it. The selected ours and theirs fragments are still parsed normally, so invalid user-provided conflict sides continue to fail.

Verification:

  • npx tap --no-coverage test/basic.js
  • npm run eslint -- lib/index.js test/basic.js
  • git diff --check
  • npm test passes tests, coverage, and eslint locally, then fails only in template-oss-check because the generated repository template wants unrelated .github branch/template updates. I did not include those unrelated tooling changes in this bugfix PR.

@pupuking723 pupuking723 requested a review from a team as a code owner June 13, 2026 06:28
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.

[BUG] Parent can be left with invalid trailing commas

1 participant