VSCode single to double quote automatic replace

前端 未结 22 1009
死守一世寂寞
死守一世寂寞 2021-01-30 12:03

When I execute a Format Document command on a Vue Component.vue file VSCode replace all single quoted string with double quoted string.

In my specific case

22条回答
  •  终归单人心
    2021-01-30 12:33

    What worked for me was setting up the .prettierrc.json config file. Put it to the root of your project with a sample config like this:

    {
      "singleQuote": true,
      "trailingComma": "all",
      "tabWidth": 2,
      "semi": true,
      "arrowParens": "always"
    }
    

    After triggering the Format Document command, all works just as expected.

    Side note: What comes as a bonus with this solution is that each team member gets the same formatting outputs thanks to the present config file.

提交回复
热议问题