文章目录
- 1. settings.json
 - 2. 在项目根目录添加.eslintrc.js
 - 3. 在项目根目录添加.prettierrc.json
 
1. settings.json
ctrl+shirt+p 搜索settings.json替换为下面内容即可
{
  // 主题颜色 浅色主题
  "workbench.colorTheme": "Monokai",
  "workbench.iconTheme": "vscode-icons", //图标主题
  "git.autofetch": true,
  "window.zoomLevel": 0,
  "editor.fontSize": 20,
  "javascript.updateImportsOnFileMove.enabled": "always",
  "editor.detectIndentation": false,
  "editor.tabSize": 2, // 重新设定tabsize
  "editor.formatOnSave": true, // #每次保存的时候自动格式化
  "editor.codeActionsOnSave": { // #每次保存的时候将代码按eslint格式进行修复
    "source.fixAll.eslint": true
  },
}2. 在项目根目录添加.eslintrc.js
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
'@vue/standard'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
"space-before-function-paren": 0
}
}
注:异常 Missing space before function parentheses
 添加"space-before-function-paren": 0 规则解决
3. 在项目根目录添加.prettierrc.json
{
  "singleQuote": true,
  "semi": false
}注:保存自动格式化为单引号,去除分好结尾
- 企业内部全局配置
 

{
  "prettier.semi": true,
  "prettier.singleQuote": true, 
    "vetur.ignoreProjectWarning": true,//配置Vetur插件,忽略提示
     // 在方法括号之间插入空格
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    "editor.tabSize": 2,//指定一个tab等于多少个空格,例如此处指定4就像等于4个空格,2就等于两个空格
    "editor.detectIndentation": false, //必须指定!!否则指定的tab大小将不起效果
    "editor.formatOnSave": true,// 每次保存的时候自动格式化
    "editor.formatOnType": true, // 每次保存的时候自动格式化
    "editor.codeActionsOnSave": { // #每次保存的时候将代码按eslint格式进行修复
      "source.fixAll.eslint": true
    },
    "workbench.iconTheme": "vscode-icons", //图标主题
    "vsicons.dontShowNewVersionMessage": true,//不显示新版本提示信息
    "editor.fontSize": 18,//字体大小
    // -------------------------Operator Mono字体设置 Start-----------------------------------
    "editor.fontFamily": "Operator Mono",
    "editor.fontLigatures": true, // 这个控制是否启用字体连字,true启用,false不启用,这里选择启用
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "name": "italic font",
                "scope": [
                    "comment",
                    "keyword",
                    "storage",
                    "keyword.control.import",
                    "keyword.control.default",
                    "keyword.control.from",
                    "keyword.operator.new",
                    "keyword.control.export",
                    "keyword.control.flow",
                    "storage.type.class",
                    "storage.type.function",
                    "storage.type",
                    "storage.type.class",
                    "variable.language",
                    "variable.language.super",
                    "variable.language.this",
                    "meta.class",
                    "meta.var.expr",
                    "constant.language.null",
                    "support.type.primitive",
                    "entity.name.method.js",
                    "entity.other.attribute-name",
                    "punctuation.definition.comment",
                    "text.html.basic entity.other.attribute-name.html",
                    "text.html.basic entity.other.attribute-name",
                    "tag.decorator.js entity.name.tag.js",
                    "tag.decorator.js punctuation.definition.tag.js",
                    "source.js constant.other.object.key.js string.unquoted.label.js",
                ],
                "settings": {
                    "fontStyle": "italic",
                }
            },
        ]
    },
    "[vue]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "tabnine.experimentalAutoImports": true,
    "editor.quickSuggestions": {
      "strings": true
    }
    // -------------------------Operator Mono字体设置 End-----------------------------------
}                










