In VSCode, whenever I save a file, Prettier changes all single quotes to double quotes. I want to keep this behaviour for SCSS and CSS files, but want to change it for JavaScript and JSON files.
I am aware of the setting "prettier.singleQuote": true, but this will change double quotes to single quotes in all file types.
How can I activate single quote only for JavaScript and JSON files and keep double quote for SCSS and CSS files?
Use a Prettier configuration file in your project folder: .prettierrc
Inside your config file use Prettier overrides: https://prettier.io/docs/en/configuration.html#configuration-overrides
So in your case this example config should work (.prettierrc):
{
"singleQuote": true,
"overrides": [
{
"files": ["**/*.css", "**/*.scss", "**/*.html"],
"options": {
"singleQuote": false
}
}
]
}