dprint-plugin-typescript icon indicating copy to clipboard operation
dprint-plugin-typescript copied to clipboard

Support for quote style of template literal strings

Open jasonkuhrt opened this issue 3 years ago • 4 comments

This was rejected in prettier, would love to see it here. https://github.com/prettier/prettier/issues/54

jasonkuhrt avatar Mar 02 '22 03:03 jasonkuhrt

So currently for "quoteStyle" there is:

  • alwaysDouble
  • alwaysSingle
  • preferDouble
  • preferSingle

I think we could add:

  • alwaysTemplate (or maybe alwaysBacktick to follow eslint terminology, though I think "template" is already used elsewhere in the config so it would be better for consistency)

This would not apply to "jsx.quoteStyle".

dsherret avatar Mar 02 '22 16:03 dsherret

How about a "avoidEscape" equivalent ? https://eslint.org/docs/latest/rules/quotes#options

We use preferSingle, but sometimes a backtick is needed to avoid escaping both ' and " in a string. Then I could turn off yet another ESLint rule (the more rules are off, the faster it runs) and let dprint completely take care of quotes.

SamuelT-Beslogic avatar Apr 11 '23 01:04 SamuelT-Beslogic

So currently for "quoteStyle" there is:

  • alwaysDouble
  • alwaysSingle
  • preferDouble
  • preferSingle

I think we could add:

  • alwaysTemplate (or maybe alwaysBacktick to follow eslint terminology, though I think "template" is already used elsewhere in the config so it would be better for consistency)

This would not apply to "jsx.quoteStyle".

How about, as well as adding alwaysTemplate, we add preferTemplate - to be used when the string needs escaping?

todor-a avatar Apr 03 '24 09:04 todor-a