记自己的vue vscode autofomat配置 简洁不复杂

322 阅读1分钟

能让自己效率起来,一劳永逸的才是good tool

不用装那么多插件,装prettier和vetur就足够了,vetur的功能已经足够好了,其他的只需要简单设置几点:

  1. 保存时自动format
  2. 去除代码尾部分号
  3. js部分双引号改单引号
{
  "editor.formatOnSave": true,
  "editor.formatOnPaste": true,
  "prettier.singleQuote": true,
  "prettier.jsxSingleQuote": true,
  "vetur.format.defaultFormatterOptions": {
    "prettier": {
      "semi": false,
      "singleQuote": true
    },
    "js-beautify-html": {
      "wrap_attributes": "force-expand-multiline"
    },
    "prettyhtml": {
      "printWidth": 100,
      "singleQuote": false,
      "wrapAttributes": false,
      "sortAttributes": false
    }
  }
}