Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get eslint in Visual Studio Code to allow double quotes?

  • I created a vue-js CLI project
  • I want to be able to use double-quotes instead of single quotes
  • when I use double quotes, npm run dev reports eslint errors
  • Where do I tell eslint to allow double quotes?

enter image description here

like image 914
Edward Tanguay Avatar asked Sep 21 '17 09:09

Edward Tanguay


3 Answers

Check your .eslintrc.js file, you can either set the value of the quotes rule to double or set the error level to warning or disable it altogether. Have a look at the docs. This would be an example:

"rules": {
    "quotes": ["error", "double"]
}
like image 125
martinarroyo Avatar answered Oct 21 '22 04:10

martinarroyo


quotes: [0, "double"] works for me

like image 22
Youth overturn Avatar answered Oct 21 '22 04:10

Youth overturn


Sometimes it is cumbersome to find a specific syntax to disallow a specific eslint rule. In this situations you can use "global" disabling for a code block as the following:

/*eslint-disable */

//suppress all warnings between comments
console.info("foo");

/*eslint-enable */
like image 32
Roman Avatar answered Oct 21 '22 04:10

Roman