Visual Studio Code double quote syntax

Rusty picture Rusty · Mar 4, 2018 · Viewed 7.1k times · Source

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?

Answer

4ndt3s picture 4ndt3s · Mar 4, 2018

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.