dprint / dprint-plugin-typescript

TypeScript and JavaScript code formatting plugin for dprint.
https://dprint.dev/plugins/typescript
MIT License
258 stars 57 forks source link

Allow different quoteStyle inside of JSX #592

Closed sstackus closed 11 months ago

sstackus commented 11 months ago

Need a way to specify single quote style in TS but double quotes for JSX element props/attributes, e.g.:

const a  = 'single';
(<Component prop="double" />)

Rant: Might be a headache for you guys and trigger an out of scope/don't care response, but this is a very common scenario and would help dprint adoption given the number of TS devs being also React devs.

dsherret commented 11 months ago

Rant: Might be a headache for you guys and trigger an out of scope/don't care response, but this is a very common scenario and would help dprint adoption given the number of TS devs being also React devs.

Why rant when it's already implemented?

{
  "quoteStyle": "preferSingle",
  "jsx.quoteStyle": "preferDouble"
}

https://dprint.dev/playground/#code/MYewdgziA2CmB00QHMAUByAFgS3QSgG4AoUSAFwAJKBeCgHgFE4BbWMSgBwCcQPqAiAG4BDaAFdY-CgHoAfEA/config/N4KABGBECOCuD2AXApgZUQTwDbMgLigAcAnZAM2WNQEsA7Acx0gBpwoArAZwA8A6OJGkxMCkEuUoAReLABGTEAF8QQA/plugin/typescript