Skip to content

Commit

Permalink
Fix idempotency
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Jun 6, 2020
1 parent 3818eb6 commit 9be56ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/language-js/printer-estree.js
Expand Up @@ -3767,9 +3767,14 @@ function printPropertyKey(path, options, print) {
(options.quoteProps === "consistent" && !needsQuoteProps.get(parent)))
) {
// 'a' -> a
// '1e+100' -> 1e+100
// '1e+100' -> 1e100
return path.call(
(keyPath) => comments.printComments(keyPath, () => key.value, options),
(keyPath) =>
comments.printComments(
keyPath,
() => (/^\d/.test(key.value) ? printNumber(key.value) : key.value),
options
),
"key"
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -294,7 +294,7 @@ const f = {
1: null,
"1E2": null,
"1e+3": null,
1e+100: null,
1e100: null,
"0b10": null,
"0o10": null,
"0xf": null,
Expand Down

0 comments on commit 9be56ce

Please sign in to comment.