-
-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot format doubleQuotes to singleQuote in single javascript file #1085
Comments
Wow, this was driving me CRAZY. I had no idea what I had done to cause Prettier to suddenly start changing my single quotes to double quotes every time I format (which is every time I save!) At least I'm not the only one. Found a workaround: Roll back to 3.7.0 For what it's worth, the relevant settings from my settings.json: |
how ?roll back to 3.7.0?I do not know what should i do,can you tell me the details?thanks |
Sure, you can follow the instructions here: https://stackoverflow.com/a/53755378 |
hey, |
Please provide repro step and the output log. I cannot spend time on bugs that don’t have all the information. This bug will automatically be closed in 5 days unless more info is provide. Thanks! |
STR:
Expected behavior: Prettier should keep single quotes Note 1: with esbenp.prettier-vscode v 3.7.0 we don't have the issue Could you provide instructions so that I can generated the requested output log ? ** UPDATED **
|
@Yanal-Yves to provide the output click the "Prettier" button in the toolbar and the logs will be shown. Just copy and past them here. |
I'm also using VSCode 1.40.1 Initial conditions:
Steps:
Example code snippet:
Result after formatting:
Output:
Finally for completeness, here is the output from 3.7.0:
It seems the root cause is likely related to propagation of options. |
Same here. For me extra semicolon is added even semi is set to false. Seems like this plugin totally ignore all prettier config |
Same here... |
@ntotten, I have updated my comment with the requested output log. |
Hello, might be that the .editorconfig files exists in your projects? That is the recent changes that was introduced without nobody noticing. :) If you have .editorconfig ALL your settings for prettier are ignored by design. #1079 |
Have the same issue |
Same issue. |
Indeed, it seems this 'by design' behaviour came in with #1074 Definitely seems to be a polarising change. I can see where Nathan is coming from, but it is very confusing when all of the GUI presented settings say one thing and the plugin is doing another based on a file that may contain an incomplete configuration (such as the .editorconfig created as part of Angular's boilerplate). I would personally prefer a settings hierarchy than for settings to revert to defaults in this situation, but there may be reasons that this isn't practical. |
The problem with doing this is that every My standpoint is that every project should always have a |
I tried to add I am saying a work around because I can go to the Prettier settings and untick |
This is reasonable for ignore vscode setting when there is a |
The .editorconfig actually has no setting for quote_type. Then why does Prettier use this setting and set it to double by default? |
@Austaras the detection of configuration happens in the core prettier library. The logic used in this extension is if prettier returns config, we use that, otherwise the extension falls back to VSCode settings. I’m going to close this issue as we’re not going to change this behavior. The recommendation is to use a prettier config file in each project or set a prettier config file in your home folder. |
I downgraded to 3.7.0 from 3.13.0 (latest) as easy solution but i didn't like this. Then i changed name of .editorConfig to .editorConfigHatesPrettier. Now it's ok. |
You don't have to. |
Thanks. This is better solution. |
it may introduce more warning then just single quote.
my full
|
I am not using
Therefore, I can't use the option Note: I did install globally editorconfig using So, I am not sure if the issue is |
Amazing. Its weird how there is a disconnect between prettier and the editor config on quotes, seeing as how you can use |
I put below rule into .eslintrc which is suggested by options of eslint-plugin-prettier then prettier won't replace single quote to double quote in my case
|
In my case i uncheck "Use Editor Config" in settings and it helped |
This is driving me nuts. I've lost countless hours trying to find the source of this... |
version:3.8.0
please ignore my english,and fix this bug
The text was updated successfully, but these errors were encountered: