Skip to content

[JSONC] Document with only a comment gives SyntaxError #17257

@dsogari

Description

@dsogari

Prettier 3.5.3
Playground link

--parser jsonc

Input:

// comment

Output:

SyntaxError: Unexpected token (1:11)
> 1 | // comment
    |           ^

Expected output:

// comment

Why?

I believe the document is valid, for the same reason that an empty document is valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions