5
头图
Pass .vscode/settings.json vscode performance of non-aware control members

By adding a .vscode/setings.json file in the project root directory, the project members' vscode performance can be consistent. Common requirements include saving file auto-fix, saving auto-formatting code, etc. In order to respect the individual needs of members, do not control themes, fonts, etc.

.vscode/settings.json

 {
  // 避免非 ts 的 vue 项目提示 n 多红线提示 Property ‘xxx‘ does not exist on type
  "vetur.validation.interpolation": false,
  // 文件保存时自动格式化
  "editor.formatOnSave": true,
  // 可选,文件自动保存
  "files.autoSave": "afterDelay",
  // eslint规则对以下几种后缀文件生效. 默认为["javascript", "javascriptreact"]
  "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue"],
  "stylelint.validate": ["css", "scss", "less", "acss"],
  // 文件保存时自动修复 eslint 与stylelint 中可修复的问题
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true,
    "source.fixAll.stylelint": true
    // "source.fixAll.markdownlint": true
  },
  // 语言默认格式化规则
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[css]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[less]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[scss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

Principle: The project-level configuration has a higher priority than the configuration of the vscode editor.

It is better to configure it together with .vscode/extensions.json 😁

The front-end code specification vscode has basically been introduced, and then the author will start to roll eslint.

The latest configuration of vscode's settings.json

Personal configuration of vscode's formatted settings.json


亖混子
4.7k 声望2.4k 粉丝

自信、自洽、自在