vscode settings.json(自动修复、保存格式化)

{
  "files.eol": "\n",
  "typescript.preferences.quoteStyle": "single",
  "javascript.preferences.quoteStyle": "single",
  // tab 大小为2个空格
  "editor.tabSize": 2,
  // 编辑器换行
  "editor.wordWrap": "off",
  "css.validate": false,
  "less.validate": false,
  "scss.validate": false,
  // 开启 vscode 文件路径导航
  "breadcrumbs.enabled": true,
  // prettier 设置语句末尾不加分号
  "prettier.semi": false,
  // prettier 设置强制单引号
  "prettier.singleQuote": true,
  // 选择 vue 文件中 template 的格式化工具
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  // vetur 的自定义设置
  "vetur.format.defaultFormatterOptions": {
    // 让html的attributes不换行,看起来更美观
    "js-beautify-html": {
      // aligned-multiple 、auto
      "wrap_attributes": "auto",
      "wrap_line_length": 240,
      "end_with_newline": false
    },
    "prettier": {
      "singleQuote": true,
      "semi": false,
      "printWidth": 100,
      "wrapAttributes": false,
      "sortAttributes": false
      // "trailingComma": "none" // 禁止随时添加逗号
    }
  },
  "tabnine.experimentalAutoImports": true,
  // 保存代码,自动格式化
  "editor.formatOnSave": true,
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "prettier.configPath": "./prettier.config.js",
  "prettier.useEditorConfig": false,
  "settingsSync.ignoredSettings": [],
  "security.workspace.trust.untrustedFiles": "open",
  "workbench.editor.enablePreview": false,
  "editor.stickyScroll.enabled": false,
  // 配置elint
  "eslint.enable": true,
  "eslint.validate": [
    "javascript",
    // 用eslint的规则检测JS代码
    {
      "language": "vue", // 检测Vue文件
      "autoFix": true //为vue文件开启保存自动修复的功能
    },
    {
      "language": "html",
      "autoFix": true
    },
    "vue"
  ]
  // "editor.codeActionsOnSave": {
  //   "source.fixAll.eslint": "explicit"
  // }
}

// 当保存的时候,eslint自动帮我们修复错误
// "editor.codeActionsOnSave": {
//   "source.fixAll": true
// }

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值