VSCode格式配置

VSCode下的文件内容基本格式配置

前提1:VSCode里面已经安装ESLint插件
前提2:在项目里配置关于格式内容的js文件。我的配置文件.eslintrc.js(见文尾)在这里插入图片描述
目的:为了在保存文件的时候能够自动格式化文件(自动删除多余空格,首行缩进,自动对齐等等)
  • 在VSCode界面上面,Ctrl+P打开搜索界面

  • 在搜索框里面输入">settings",找到Settings(即最后一项——打开设置)

在这里插入图片描述

  • 双击打开,将下面的配置粘贴进去,保存

  • 重启项目即可使用

注意:下面的有一项(“terminal.integrated.shell.windows”: “C:\Program Files\Git\bin\bash.exe”,)需要根据自己bash.exe路径进行变更
{
  /*

   * vscode基础配置
     */
       "editor.tabSize": 2,
       "editor.fontFamily": "Fira Code",
       "editor.fontLigatures": true,
       "editor.fontSize": 16,
       "editor.formatOnSave": false,
       "editor.defaultFormatter": "esbenp.prettier-vscode",
       "editor.codeActionsOnSave": {

    "source.fixAll": true

  },
  "window.zoomLevel": 0,
  "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
  "git.autofetch": true,
  "git.confirmSync": false,
  /*

   * javascript格式配置
     */
       "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
       "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true,
       "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
       "javascript.updateImportsOnFileMove.enabled": "always",
       /*
   * eslint和 prettier配置
     */
       "eslint.validate": ["javascript", "javascriptreact", "vue", "html"],
       "prettier.semi": false,
       "prettier.singleQuote": true,
       "prettier.tabWidth": 2,
       "prettier.trailingComma": "none",
       /*
   * psi-head
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值