-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Unquote keys in import attributes #15888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unquote keys in import attributes #15888
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need update logic in
| function printPropertyKey(path, options, print) { |
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 |There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved by mistake
6682e45 to
e2c5580
Compare
| 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" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need more tests for different --quote-props options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Conflicts: # src/language-js/clean.js
|
Something is not right... I'll fix. |
|
Related issue: #16340 |
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✨