35 comments

Thank you!

What is a result of running prettier .  --write in command line? Does it change quotes to single in .tsx files? According to documentation, the "singleQuote" option doesn't affect JSX files, you need using --jsx-single-quote instead.

1

prettier .  --write --jsx-single-quote
[warn] Ignored unknown option { "prettier.singleQuote": true }.

prettier .  --write --jsx-single-quote
That changes all JSX and TSX files. However, in a .tsx IDEA editor, Ctrl+Alt+L changes them all back to double quotes. 

0

Did you try specifying this option in the .prettierrc.json instead of passing it in CLI? 

1

That's the solution! Setting "jsxSingleQuote": true in .prettierrc.json fixes the Ctrl+Alt+L behavior,
and restarting the IDE.

Example .prettierrc.json:

{
  "plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"],
  "jsxSingleQuote": true,
  "overrides": [
    {
      "files": "*.astro",
      "options": {
        "parser": "astro",
        "jsxSingleQuote": false
      }
    }
  ]
}
0
Great, thanks for the update!
0

Please sign in to leave a comment.