Skip to content
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

singleQuote config is not respected #206

Closed
capaj opened this issue Aug 30, 2017 · 28 comments
Closed

singleQuote config is not respected #206

capaj opened this issue Aug 30, 2017 · 28 comments
Labels
bug locked Please open a new issue and fill out the template instead of commenting.

Comments

@capaj
Copy link
Contributor

capaj commented Aug 30, 2017

I always get my code with double quotes, even when I have
image
set.

@RobinMalfait
Copy link
Contributor

Do you have other formatters enabled or eslint integration?

@CiGit CiGit added the bug label Sep 1, 2017
@CiGit
Copy link
Member

CiGit commented Sep 1, 2017

Is there a single quote in your string ? 'it\'s' prettier avoids escaping.

@capaj
Copy link
Contributor Author

capaj commented Sep 1, 2017

I do have eslint and Standard style enabled:
image
but I don't have .eslintrc anywhere in my project

@CiGit no it changes all strings, no matter if they have a single quote or not

@CiGit
Copy link
Member

CiGit commented Sep 1, 2017

Try disabling those extensions.

@capaj
Copy link
Contributor Author

capaj commented Sep 1, 2017

disabled both, I still get this when I format:
image

@CiGit
Copy link
Member

CiGit commented Sep 1, 2017

JSX props are always double quoted. see prettier/prettier#656

@CiGit CiGit closed this as completed Sep 1, 2017
@capaj
Copy link
Contributor Author

capaj commented Sep 1, 2017

@CiGit thanks 😔

@ArmanNisch
Copy link

ArmanNisch commented Oct 8, 2017

Hi, Im getting this issue however in my case double quotes are also being applied to normal javascript/ .js files too.

I have disabled eslint but no change to the behaviour.

My prettier .prettierrc config:

{
  "singleQuote": true,
  "trailingComma": "all",
  "parser": "flow"
}

I have also tried moving the prettier config setting into the package.json file to see if it gets picked up from there, but no effect.

I also noticed that on save trailingComma are also being removed.

It seems like prettier-vscode is not reading the config setting...

My VS Code Version: 1.17.0

@rc-chandan
Copy link

rc-chandan commented Apr 23, 2018

I am also facing the same problem, .prettierrc config file is not getting read from vscode.
But if I put the same configurations in vscode's USER SETTINGS then it works fine.

@dfinton
Copy link

dfinton commented Apr 26, 2018

vscode is not honoring the "singleQuote": true option for me (it used to last week). I have this setting set both in .prettierrc and in the user settings. I'm not sure what broke. I'm stuck with manually converting double quotes to single quotes because it conflicts with our linting configuration. Based on this and some other issues with prettier we've been encountering I may just abandon it entirely.

@CiGit
Copy link
Member

CiGit commented Apr 26, 2018

@rc-chandan Can you open a new issue ? this seems not related to this one.

@dfinton singleQuote has some rules see https://prettier.io/docs/en/options.html#quotes

@divyamamgai
Copy link

This really bugs me, why won't they allow devs to configure the way they want. Makes me want to make a whole new plugin just because of this one issue, which they won't fix.

@hallya
Copy link

hallya commented Oct 8, 2019

@divyamamgai problem is still actual...

@JollyGrin
Copy link

I'm having this same issue. I have enabled single quote everywhere I can: prettier, eslint, tslint, vscode user settings... yet it STILL converts the single quote to double. It even underlines the doublequote as incorrect.

@asegarra
Copy link

@JollyGrin Creating a .prettierrc.json got it working for me, looks like it isn't respecting this setting from vscode settings.

{ "singleQuote": true, }

@ntotten
Copy link
Member

ntotten commented Nov 26, 2019

The behavior of using the values of prettier config or editor config INSTEAD of VS Code settings is BY DESIGN. Please see discussion here on why it wouldn't make sense to do merge the settings: #1099 (comment)

@asegarra
Copy link

asegarra commented Nov 26, 2019

@ntotten Don't know who you are replying to but in my case I had no prettier config or editorconfig, only vscode settings and prettier was converting all my single quotes to double quotes, moving this config to prettier config worked for me. I never said anything about merging settings.

@ntotten
Copy link
Member

ntotten commented Nov 26, 2019

@asegarra Please open a new issue with the log and such if you can. I'd like to figure out what is happening.

@PerpetualWar
Copy link

Same here.... since Prettier updated, double quotes everywhere, even though in user settings I have set up singleQuote: true.

@willbeaufoy
Copy link

I have the same problem, in that single quotes are converted to double despite my prettier vscode settings being for single quotes. @asegarra's solution worked for me.

@PerpetualWar
Copy link

PerpetualWar commented Nov 30, 2019

I have the same problem, in that single quotes are converted to double despite my prettier vscode settings being for single quotes. @asegarra's solution worked for me.

Well, in this project I cannot use prettier config, and I would prefer to have my code settings affect prettier setup. Hopefully it can be fixed by prettier team.

edit: In the end, I put .prettierrc in parent folder so I don't have to commit, and it works.

@ntotten
Copy link
Member

ntotten commented Nov 30, 2019

@PerpetualWar if you can’t use a prettier config, one option in addition to what you did is to disable using editorconfig. In which case no project config should be detected and the VSCode settings will be used. That being said, the route you took is also a good option.

@PerpetualWar
Copy link

@PerpetualWar if you can’t use a prettier config, one option in addition to what you did is to disable using editorconfig. In which case no project config should be detected and the VSCode settings will be used. That being said, the route you too is also a good option.

Oh, I haven't realized it's the editorconfig that is taking priority ... It must be new addition, since it wasn't affecting codebase before latest update... but now I'm fine when I know where the problem is. Thanks!

@eshunnar
Copy link

eshunnar commented Mar 23, 2020

Fixed by adding "typescript.preferences.quoteStyle": "single" to global vscode settings.json on React Native .TSX project.

@DanKaplanSES
Copy link

Fixed by adding "typescript.preferences.quoteStyle": "single" to global vscode settings.json on React Native .TSX project.

I already have this property in my settings.json and it still isn't respecting it

@eshunnar
Copy link

eshunnar commented Mar 23, 2020

Fixed by adding "typescript.preferences.quoteStyle": "single" to global vscode settings.json on React Native .TSX project.

I already have this property in my settings.json and it still isn't respecting it

Combine it with "prettier.singleQuote": true on the global vs code file. Also in your workspace look for tslint.json and tsconfig.json then look in there for the "quotemark": "double" and make it "quotemark": "single" on both files.

@DanKaplanSES
Copy link

DanKaplanSES commented Mar 23, 2020

Combine it with "prettier.singleQuote": true on the global vs code file. Also in your workspace look for tslint.json and tsconfig.json then look in there for the "quotemark": "double" and make it "quotemark": "single" on both files.

I am using typescript-eslint. Isn't that more modern?

Either way, I discovered my problem was with the Prettier extension. It doesn't work in a way that eslint's rules will accept. More context on that here: https://stackoverflow.com/questions/60821494/visual-studio-code-does-not-respect-my-eslint-quote-rules

@stoplion
Copy link

stoplion commented Jun 17, 2020

I deleted .editorconfig and that fixed it.

@prettier prettier locked as resolved and limited conversation to collaborators Jun 24, 2020
@ntotten ntotten added the locked Please open a new issue and fill out the template instead of commenting. label Jul 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug locked Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests