Visual Studio Code double quote syntax
Asked Answered
M

1

11

I just upgraded VS code to v1.20.1 and now I have errors everywhere telling me to replace double quotes with single quotes.

First of, I'm thinking of disabling this feature, since I'm a double quote guy. I have checked my user settings(File->Preferences->Settings) and searched for any tslint validations that has got to do with quotes and couldn't find any.

enter image description here

Second of all, I thought to myself that maybe it could be good practice to use single quotes in JS and I should get used to it.

I though doubt this might be good practice, if not please do prove me wrong.

My question are:

  • Is or will in the later feature using single quotes in JS will be considered as good practice?

  • How do I disable double quotes validation in VS Code?

Middlesworth answered 4/3, 2018 at 12:12 Comment(0)
V
26

Using single or double quotes is a matter of programming taste, at least for me.

To disable quotes validation you need to edit tslint.json (or create it: Create a tslint json file command) in project's folder, find the rule "quotemark" and set the following:

"quotemark": [
      false
    ]

As you see, it is a linter configuration, instead of vscode one. More information of this rule on tslint documentation.

If you want to continue with your double quotes set:

"quotemark": [
      true,
      "double"
    ]

Hope it's useful for you.

Venge answered 4/3, 2018 at 19:27 Comment(2)
Thanks for ur solution! :DCompare
Can we just use single quote ' instead of ", Will it affect the code ?Tem

© 2022 - 2024 — McMap. All rights reserved.