Closed capaj closed 6 years ago
Do you have other formatters enabled or eslint integration?
Is there a single quote in your string ? 'it\'s'
prettier avoids escaping.
I do have eslint and Standard style enabled:
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
Try disabling those extensions.
disabled both, I still get this when I format:
JSX props are always double quoted. see https://github.com/prettier/prettier/issues/656
@CiGit thanks :pensive:
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
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.
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.
@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
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.
@divyamamgai problem is still actual...
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.
@JollyGrin Creating a .prettierrc.json got it working for me, looks like it isn't respecting this setting from vscode settings.
{ "singleQuote": true, }
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: https://github.com/prettier/prettier-vscode/issues/1099#issuecomment-558636346
@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.
@asegarra Please open a new issue with the log and such if you can. I'd like to figure out what is happening.
Same here.... since Prettier updated, double quotes everywhere, even though in user settings I have set up singleQuote: true.
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.
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.
@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 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!
Fixed by adding "typescript.preferences.quoteStyle": "single"
to global vscode settings.json
on React Native .TSX
project.
Fixed by adding
"typescript.preferences.quoteStyle": "single"
to globalvscode settings.json
on React Native.TSX
project.
I already have this property in my settings.json and it still isn't respecting it
Fixed by adding
"typescript.preferences.quoteStyle": "single"
to globalvscode 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.
Combine it with
"prettier.singleQuote": true
on the global vs code file. Also in your workspace look fortslint.json
andtsconfig.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
I deleted .editorconfig
and that fixed it.
I always get my code with double quotes, even when I have set.