How to ignore quotes from being formatted by Prettier
Asked Answered
G

0

6

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

Greenback answered 24/8, 2020 at 20:15 Comment(6)
How are you using prettier? As part of ESLint or standalone?Stpierre
I don't belive so. But what circumstances would you use single quotes, and which would you use double quotes? The rationale for prettier's approach seems solid to me.Impenetrability
@Cehhiro with TSLintGreenback
@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.Greenback
The point of using prettier is to make that consistent. It may better to format the entire project with a single commit so that random app development changes aren't coming in along side formatting corrections in the same commits.Impenetrability
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.Maund

© 2022 - 2024 — McMap. All rights reserved.