Quotes in JSX are double quotes even if singleQuote is true
See original GitHub issueThis is replicable in the demo environment: the singleQuote
variable works properly for vanilla JavaScript but does not affect JSX, which is always double-quotes.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Single quote in tsx file with prettier - Stack Overflow
If you're using the settings GUI just search for single quote and check/uncheck the Prettier: Jsx Single quote and Prettier: Single quote.
Read more >jsx-quotes - ESLint - Pluggable JavaScript Linter
This rule enforces the consistent use of either double or single quotes in JSX attributes. Options. This rule has a string option: "prefer-double"...
Read more >Prettier single quote setting not respected in .tsx files (VS Code)
The solution is to set the jsxSingleQuote setting to true as well. This will change all double quotes in your .tsx files to...
Read more >quotemark - Rule
"jsx-double" enforces double quotes for JSX attributes. "avoid-template" forbids single-line untagged template strings that do not contain string interpolations ...
Read more >Do you use Single Quotes or Double Quotes? : r/learnjavascript
I started learning it with double quote in HTML I think. I dont even know if plain HTML accepts single quotes haha. However,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@atombender prettier will not honor the
--single-quote
option for JSX. This is an explicit decision and we’re not looking into changing it.Prettier is an opinionated printer, if you do not like the decisions that were made, I’m afraid that you either have to fork it to make them match the way you format code or not use prettier 😦
JSX was designed to be close to HTML and people use double quote to write HTML, so are we at Facebook and a lot of people writing JSX.