-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Respect quoted object keys, as unquoting breaks aggressive minifiers like Closure Compiler #4327
Copy link
Copy link
Closed
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!Issues with an accompanying pull request. These issues will probably be fixed soon!type:option requestIssues requesting a new option. We generally don’t accept these unless there is technical necessity.Issues requesting a new option. We generally don’t accept these unless there is technical necessity.
Milestone
Metadata
Metadata
Assignees
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!Issues with an accompanying pull request. These issues will probably be fixed soon!type:option requestIssues requesting a new option. We generally don’t accept these unless there is technical necessity.Issues requesting a new option. We generally don’t accept these unless there is technical necessity.
Hi, related to the discussions in #838 and #1103, Prettier uses a
consistent-as-neededapproach for quoting object keys (ref: https://eslint.org/docs/rules/quote-props#options).This behaviour is a blocker for us using Prettier in my current company (...and we'd really love to use it!) because it strips quoted object keys. This negatively impacts the input to Closure Compiler in our tool chain, which mangles all unquoted keys, and breaks places like http call serialisation where those keys have meaning.
We're unfortunately stuck with CC in our current setup, and hacks like using
{ ['foo']: bar }or adding// prettier ignorein various places have been viewed as muddying the code and/or too much overhead.I'd love to see Prettier support for something like:
preserving object quotes, i.e. the approach suggested in #1103
handling quotes in a
consistentway instead ofconsistent-as-needed, i.e. if it finds at least one quote in an object, it will ensure all keys are quotedIs this something I could help with? Something like the PR in #1108 would be fine for us. We'd also be totally ok with
consistentquoting if that's more in-line with Prettier's strongly-opinionated philosophy.Thanks,