-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Hi, related to the discussions in #838 and #1103, Prettier uses a consistent-as-needed approach 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 ignore in 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 quoted
Is this something I could help with? Something like the PR in #1108 would be fine for us. We'd also be totally ok with consistent quoting if that's more in-line with Prettier's strongly-opinionated philosophy.
Thanks,