Skip to content

Don't use smart quotes for JSON5 with --quote-props=preserve#10323

Merged
thorn0 merged 3 commits intoprettier:mainfrom
thorn0:json5-as-json-with-trailing-comma
Feb 15, 2021
Merged

Don't use smart quotes for JSON5 with --quote-props=preserve#10323
thorn0 merged 3 commits intoprettier:mainfrom
thorn0:json5-as-json-with-trailing-comma

Conversation

@thorn0
Copy link
Copy Markdown
Member

@thorn0 thorn0 commented Feb 15, 2021

Description

Fixes #5708
More specifically, addresses #5708 (comment)

With the quoteProps option set to preserve and singleQuotes to false (default), double quotes are always used for printing strings, including situations like this: "bla\"bla". This effectively allows using --parser json5 for "JSON with comments and trailing commas".

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@thorn0 thorn0 merged commit 3a73f48 into prettier:main Feb 15, 2021
@thorn0 thorn0 deleted the json5-as-json-with-trailing-comma branch February 15, 2021 17:13
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow JSON with trailing commas

2 participants