Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single quote in tsx file with prettier

For 2-3 weeks, while I didn't change anything in prettier file, VSC started changing single quotes to double quotes, while it was always single quotes. I tried many options but it keeps changing it. Heres my .prettierrc

{
  "trailingComma": "es5",
  "printWidth": 200,
  "semi": true,
  "singleQuote": true,
  "jsxSingleQuote": true,
  "tabWidth": 2,
  "quoteProps": "as-needed"
}

EDIT: I think, that it is a matter of .tsx files, as prettier has just option for .jsx files but still didn't find a solution.

like image 832
heisenberg7584 Avatar asked Nov 28 '19 07:11

heisenberg7584


2 Answers

In .prettierrc, add:

{
  "singleQuote": true,
  "jsxSingleQuote": true
}
like image 173
Edmar Miyake Avatar answered Sep 27 '22 22:09

Edmar Miyake


create a .prettierrc file on your root folder and add:

{
  "singleQuote": true
}
like image 34
Joseph Briggs Avatar answered Sep 27 '22 22:09

Joseph Briggs