5

I have a code base with both single and double quotes all over the place. When I format my TS files all the single quotes are being converted to double quotes. I want prettier to ignore considering both single and double quotes alone and do rest of the formatting for TS files. Can anyone help? TIA

  • How are you using prettier? As part of ESLint or standalone? – OFRBG Aug 24 '20 at 20:21
  • [I don't belive so.](https://prettier.io/docs/en/options.html#quotes) But what circumstances would you use single quotes, and which would you use double quotes? The [rationale for prettier's approach](https://prettier.io/docs/en/rationale.html#strings) seems solid to me. – Alex Wayne Aug 24 '20 at 20:21
  • @Cehhiro with TSLint – Hariharan D Aug 24 '20 at 20:36
  • 3
    @AlexWayne I have a codebase where both the quotes are used randomly all over the place. Let's say in a file I'm having 1000loc I make changes to two lines and now when I format the file it converts all the single quotes in the file to double quotes. I want prettier to ignore doing it. – Hariharan D Aug 24 '20 at 20:40
  • 2
    The point of using prettier is to make that consistent. It may better to [format the entire project with a single commit](https://github.com/prettier/prettier-vscode/issues/321) so that random app development changes aren't coming in along side formatting corrections in the same commits. – Alex Wayne Aug 24 '20 at 20:43
  • Single quotes are required to print a JSON string into a HTML attribute in Jinja. So prettier-ignore must be used in this case I guess. – Adam Jagosz Mar 23 '23 at 12:39

0 Answers0