Unquote keys in import attributes#15888
Merged
fisker merged 9 commits intoprettier:mainfrom Feb 7, 2024
Merged
Conversation
fisker
requested changes
Jan 7, 2024
Member
There was a problem hiding this comment.
Need update logic in
, number/bigint can't be unquoted. #15563 (comment)Prettier pr-15888
Playground link
--parser babelInput:
import json from "./mod.json" with { "0": "json" };Output:
import json from "./mod.json" with { 0: "json" };Second Output:
SyntaxError: Unexpected token (1:38)
> 1 | import json from "./mod.json" with { 0: "json" };
| ^
2 |
fisker
approved these changes
Jan 8, 2024
Member
There was a problem hiding this comment.
Bug with --prose-wrap always--quote-props consistent
Prettier pr-15888
Playground link
--parser typescript
--quote-props consistent
--prose-wrap alwaysInput:
import json from "./mod.json" with { "type": "json" };Output:
TypeError: Cannot read properties of undefined (reading 'some')
at ft (https://deploy-preview-15888--prettier.netlify.app/lib/plugins/estree.js:36:29755)
at hs (https://deploy-preview-15888--prettier.netlify.app/lib/plugins/estree.js:36:30369)
at Ta (https://deploy-preview-15888--prettier.netlify.app/lib/plugins/estree.js:36:58094)
at Vl (https://deploy-preview-15888--prettier.netlify.app/lib/plugins/estree.js:36:72252)
at Object.Hl (https://deploy-preview-15888--prettier.netlify.app/lib/plugins/estree.js:36:72660)
at Yn (https://deploy-preview-15888--prettier.netlify.app/lib/standalone.js:27:1809)
at D (https://deploy-preview-15888--prettier.netlify.app/lib/standalone.js:27:1629)
at s (https://deploy-preview-15888--prettier.netlify.app/lib/standalone.js:27:1437)
at https://deploy-preview-15888--prettier.netlify.app/lib/standalone.js:15:4072
at bt.each (https://deploy-preview-15888--prettier.netlify.app/lib/standalone.js:15:3975)6682e45 to
e2c5580
Compare
fisker
reviewed
Jan 15, 2024
| import json from "./mod.js" with { "33333": "json" }; | ||
| import json from "./mod.js" with { "33333n": "json" }; | ||
| import json from "./mod.js" with { "33333b": "json" }; | ||
| import json from "./mod.js" with { "03333": "json" }; |
Member
There was a problem hiding this comment.
I think we need more tests for different --quote-props options.
# Conflicts: # src/language-js/clean.js
fisker
approved these changes
Feb 7, 2024
Member
|
Something is not right... I'll fix. |
Member
|
Related issue: #16340 |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Since resolving conflicts is annoying, I created a new PR.
Closes #15564
Fixes #15563
Checklist
docs/directory).changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.✨Try the playground for this PR✨