VScode格式化和vue脚手架中的eslint相冲突,总是在最后有个逗号

文件——>首选项——>设置
在这里插入图片描述
setting.json,这边只看跟vue相关的就行了,注意要把vue的默认格式设置位vetur

{
  "git.ignoreMissingGitWarning": true,
  "editor.tabSize": 2,
  //保存的时候格式化
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "fileheader.configObj": {
    "createFileTime": true,
    "dateFormat": "YYYY-MM-DD HH:mm:ss"
  },
  "fileheader.customMade": {
    "Author": "Meng Jiawei",
    "Date": "Do not edit",
    "LastEditTime": "Do not edit",
    "FilePath": "Do not edit"
  },
  "winopacity.opacity": 255,
  "git.enableSmartCommit": true,
  "files.associations": {
    "*.cjson": "jsonc",
    "*.wxss": "css",
    "*.wxs": "javascript"
  },
  "emmet.includeLanguages": {
    "wxml": "html"
  },
  "minapp-vscode.disableAutoConfig": true,
  "vetur.format.defaultFormatter.html": "prettier",
  "git.ignoreWindowsGit27Warning": true,
  "[dart]": {
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.rulers": [80],
    "editor.selectionHighlight": false,
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.suggestSelection": "first",
    "editor.tabCompletion": "onlySnippets",
    "editor.wordBasedSuggestions": false
  },
  "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
  "dart.openDevTools": "flutter",
  "git.autofetch": true,
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "eslint.codeAction.showDocumentation": {
    "enable": true
  },
  "eslint.format.enable": true,
  // vetur格式配置
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      "wrap_attributes": "force-expand-multiline"
    },
    //html配置
    "prettyhtml": {
      "printWidth": 100,
      "singleQuote": false,
      "wrapAttributes": false,
      "sortAttributes": false
    },
    //js配置
    "prettier": {
      //设置分号
      "semi": true,
      //双引号变成单引号
      "singleQuote": false,
      //禁止末尾添加逗号!!!!!
      "trailingComma": "none"
    }
  },
  //配置vue组件的格式化用vetur
  "[vue]": {
    "editor.defaultFormatter": "octref.vetur"
  },
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值