Skip to content

New line removed after block comment #28

@squallco

Description

@squallco

When parsing and stringifying back a JSON starting with a block comment and a new line, the new line is removed.
It doesn't happen with a JSON starting with an inline comment.

Tell us about your environment

  • Node Version: 15.3.0
  • comment-json Version 4.1.0

Please show your use case / code slices / code link that could reproduce the issue

const blockCommentJson = `/* Block comment. */
{}
`;
stringify(parse(blockCommentJson), null, 2);
/* Block comment. */{}

What did you expect to happen?

/* Block comment. */
{}

Example on StackBlitz

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions