Skip to content

Change default value for quoteProps option to "preserve" for JSON5 #4639

@suchipi

Description

@suchipi

Context:

#4636 (comment) by @suchipi:

@ikatyang based on this issue and #4611 I think we should not convert Object keys to identifiers by default in the json5 printer; it is surprising behavior to some. Thoughts?

#4636 (comment) by @ikatyang:

@suchipi I'm not sure what should we do here since converting object keys to identifiers is valid in JSON5, and we don't want to add options. And also if we're not going to convert them, there's no difference between JSON and JSON5, thus no need to split JSON5 from JSON.

And based on the response from linguist, we're probably going to add .jsonc to JSON's extensions for #4611.

(It's really weird to me why VSCode/Atom didn't have the built-in JSON5 support.)


Should we change the JSON5 printer to not convert object keys to identifiers?

I'm thinking yes, since JSON5 support in editors is hit or miss- for example, VS Code treats .babelrc as a JSON file instead of JSON5.

Personally, the only JSON5 feature I've ever leveraged was comments. But that's only one data point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:jsonIssues affecting JSONstatus:needs discussionIssues needing discussion and a decision to be made before action can be taken

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions