Skip to content

fix: ignore comments apply to trailing commas - #69

Merged
dsherret merged 1 commit into
mainfrom
fix/ignore-comment-trailing-comma
Sep 15, 2026
Merged

dsherret merged 1 commit into
mainfrom
fix/ignore-comment-trailing-comma

Conversation

@dsherret

Copy link
Copy Markdown
Member

Closes #9

A property or array element with an ignore comment (ex. // dprint-ignore) now keeps its trailing comma as written. Before, trailingCommas still added or removed the comma, so this was changed when using never, or jsonc on a .json file (which is how Deno hits it):

{
  "tasks": {
    // dprint-ignore
    "foo": "echo bar",
  }
}

When the last node is ignored, its trailing comma is now handled as maintain. Like maintain, the kept comma only prints when the object or array is multi-line.

Tests: specs for never, always, and jsonc on a .json file, covering object properties and array elements.

🤖 Generated with Claude Code

@dsherret
dsherret merged commit a5dffd1 into main Sep 15, 2026
2 checks passed
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.

Have ignore comments apply to trailing commas

1 participant