npm / comment-json
comment-json
What changed in comment-json 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-25.
2 breaking4 new APIs and options1 tooling
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initcomment-json 56 changes
Breaking changes 2
CommentToken is now a union that can include BlankLine tokens, so value and loc are no longer guaranteed on every token.
stringify() renders blank lines only from explicit BlankLine tokens, rather than inferring them from loc or historical line-break logic.
New APIs and options 4
Blank lines are represented by explicit BlankLine comment tokens used during parse() and stringify().
Parsing with no_blank_lines: true explicitly drops blank lines; default parsing preserves them as first-class tokens.
parse() accepts the no_comments option.
Removes blank lines globally or at a specific comment location.
comment-json 41 changes
Tooling 1
Improves TypeScript definitions for developers using the package.