欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

visual studio code的配置选项

程序员文章站 2022-06-17 14:38:53
...

老规矩,放链接:https://www.jianshu.com/p/f15b67c94c78
1、默认没有添加eslint检查的配置项:

{
  "editor.formatOnSave": true,
  "editor.tabSize": 2,
  "files.autoSave": "off",
  "window.zoomLevel": 1,
  "breadcrumbs.enabled": true,
  "explorer.confirmDragAndDrop": false,
  "update.mode": "none",
  "editor.fontSize": 12,
  "git.path": "D:/Program Files/Git/bin/git.exe",
  "git.enableSmartCommit": true
}

2、添加Eslint语法检查后配置:

{
  "editor.formatOnSave": true,
  "editor.tabSize": 2,
  "files.autoSave": "off",
  "window.zoomLevel": 1,
  "breadcrumbs.enabled": true,
  "explorer.confirmDragAndDrop": false,
  "update.mode": "none",
  "editor.fontSize": 12,
  "git.path": "D:/Program Files/Git/bin/git.exe",
  "git.enableSmartCommit": true,
  "vetur.format.defaultFormatter.html": "prettyhtml",
  "vetur.format.defaultFormatter.js": "prettier",
  "vetur.format.defaultFormatterOptions": {
    "prettier": {
      "singleQuote": true,
      "semi": false,
    }
  },
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    {
      "language": "vue",
      "autoFix": true
    }
  ],
  "eslint.run": "onSave",
  "eslint.autoFixOnSave": true
}

3、项目目录需要安装eslint依赖:

npm install --save-dev eslint-plugin-vue
npm install --save-dev eslint

如果报bable-eslint的错误,需要再多安装一个依赖

npm install --save-dev babel-eslint