Skip to content

Commit ed020b2

Browse files
committed
Move comment into code
1 parent dd47799 commit ed020b2

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

docs/options.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ Note that Prettier never unquotes numeric property names in Angular expressions,
115115
[quote-props-flow]: https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVBjOA7AzgFzAA8wBeMAb1TDAAYAuMARlQF8g
116116
[quote-props-vue]: https://github.com/prettier/prettier/issues/10127
117117

118-
<!-- TODO[@fisker]: Check this -->
119-
120-
If this option is set to `preserve`, `singleQuote` to `false` (default value), and `parser` to `json5`, double quotes are always used for strings. This effectively allows using the `json5` parser for “JSON with comments and trailing commas”.
121-
122118
## JSX Quotes
123119

124120
Use single quotes instead of double quotes in JSX.

src/utils/print-string.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ function printString(raw, options) {
1212
const enclosingQuote =
1313
options.parser === "json" ||
1414
options.parser === "jsonc" ||
15+
// This was added before we have the `jsonc` parser
16+
// If `{quoteProps: "preserve"}` and `{singleQuote: false}` (default value),
17+
// and `parser` to `json5`, double quotes are always used for strings.
18+
// This effectively allows using the `json5` parser for “JSON with comments and trailing commas”.
19+
// See https://github.com/prettier/prettier/pull/10323
20+
// See https://github.com/prettier/prettier/pull/15831#discussion_r1431010636
1521
(options.parser === "json5" &&
1622
options.quoteProps === "preserve" &&
1723
!options.singleQuote)

0 commit comments

Comments
 (0)