Change default value for quoteProps option to "preserve" for JSON5
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 52.3k
- Forks
- 5k
- Avg merge
- 19h 2m
- Merged PRs (30d)
- 117
Description
Context:
https://github.com/prettier/prettier/issues/4636#issuecomment-394515965 by @suchipi:
@ikatyang based on this issue and https://github.com/prettier/prettier/issues/4611 I think we should not convert Object keys to identifiers by default in the json5 printer; it is surprising behavior to some. Thoughts?
https://github.com/prettier/prettier/issues/4636#issuecomment-394546383 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
.jsoncto 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the JSON5 printer and the quoteProps option behavior described in this issue. Check the existing JSON5 formatting tests, then verify that object keys are preserved rather than converted to identifiers by default while other JSON5 behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100