I am having an issue getting the vscode prettier extension to convert my javascript documents correctly. I am running VSCode 1.22.2 with version 1.3.1 of the Prettier extension.
I have a prettier configuration set to convert double quotes to single quotes using the "prettier.singleQuotes": true setting. I have this setting set in both visual studio's user setting in .prettierrc within my project.
When I format my VueJS files, this setting is getting honored for any javascript contained in my <script> body in those files. But for vanilla javascript module files, my single quotes are getting replaced with double quotes. I do not have any other code formatters installed. Here is a snippet of my User configuration:
// Force single quotes
"prettier.singleQuote": true,
Here is my code before I click on "Format document":
console.log('Hello World');
Here is what it looks like afterwards:
console.log("Hello World");
This breaks our organization's linting standards, which is forcing me to manually search/replace all occurrences of an errant double quote with single quotes, so any pointers would be greatly appreciated. Thanks!
Did a bit more testing. As it turns out, it looks like all my formatting rules are being ignored for javascript files, not just the single quote rule. I do not have any languages or extensions disabled in my prettier config.
could you show your prettierrc file?
Do you have eslint integration enabled? If yes, it could be the problem and you might need to update your eslint config, because in that case eslint rules takes precedence:
Code 鉃★笍 prettier 鉃★笍 eslint --fix 鉃★笍 Formatted Code
Stalled closing
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Did a bit more testing. As it turns out, it looks like all my formatting rules are being ignored for javascript files, not just the single quote rule. I do not have any languages or extensions disabled in my prettier config.