vscode设置,eslint保存自动格式化,tslint.json配置

{
  "security.workspace.trust.untrustedFiles": "open",
  "eslint.validate": [
    "javascriptreact",
    "typescriptreact"
  ],
  "eslint.codeAction.showDocumentation": {
    "enable": true
  }, // formatting only supports LF line endings
  "eslint.alwaysShowStatus": true,
  "editor.codeActionsOnSave": {
    "source.fixAll": true,
    "source.fixAll.eslint": true,
    "source.fixAll.tslint": true,
    "eslint.autoFixOnSave": true
  },
  "files.autoSave": "onFocusChange",
  "editor.tabSize": 2,
  "files.exclude": {
    "**/.classpath": true,
    "**/.project": true,
    "**/.settings": true,
    "**/.factorypath": true
  },
  "editor.tokenColorCustomizations": {
    "comments": {
      "fontStyle": "bold", // 设置字体样式  bold 加粗 italic 斜体 underline 下划线
      "foreground": "#b6b6b6" // 设置字体颜色
    }, // 注释
    // "keywords": "#0a0", // 关键字
    // "variables": {}, // 变量名
    // "strings": "#e2d75dbd", // 字符串
    "functions": {
      "fontStyle": "bold",
    }, // 函数名
    // "numbers": "#AE81FF" // 数字
  },
  "git.autofetch": "all",
  "git.enableSmartCommit": true,
  "editor.bracketPairColorization.enabled": true,
  "editor.guides.bracketPairs": "active",
  "editor.fontFamily": "'JetBrains Mono', '苹方'",
  "editor.letterSpacing": 0.5,
  "workbench.colorCustomizations": {
    // "foreground": "#75a478", // 侧边栏字体颜色
    "editor.background": "#273945", // 编辑区颜色$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    // "editor.background": "#151515", // 编辑区颜色$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    // "editor.background": "#272822", // 编辑区颜色$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*****************************
    // "sideBar.background": "#2d2e27", // 侧边栏区颜色****************************************暗色monokai
    // "sideBar.background": "#dddddd", // 侧边栏区颜色****************************************亮色monokai
    // "terminal.background": "#1e1f1c", // 终端区颜色****************************************
    // "activityBar.background":"#272822",// //	活动栏背景色****************************************
    // "activityBar.foreground":"#75a478",// //	活动栏前景色(例如用于图标)
    // "editor.background":"#1d2329",// //	编辑器背景颜色****************************************
    // "editor.foreground":"#75a478",// //	编辑器默认前景色
    // "editor.findMatchBackground":"#75a478",// //	当前搜索匹配项的颜色
    // "editor.findMatchHighlightBackground":"#75a478",// //	其他搜索匹配项的颜色
    // "editor.lineHighlightBackground":"#75a478",// //	光标所在行高亮文本的背景颜色
    // "editor.selectionBackground":"#75a478",// //	编辑器所选内容的颜色
    // "editor.selectionHighlightBackground":"#75a478",// //	与所选内容具有相同内容的区域颜色
    // "editor.rangeHighlightBackground":"#75a478",// //	突出显示范围的背景颜色,例如 "Quick Open" 和“查找”功能
    // "editorBracketMatch.background":"#75a478",// //	匹配括号的背景色
    // "editorCursor.foreground":"#75a478",// //	编辑器光标颜色
    // "editorGutter.background":"#1e1f1c",// //	编辑器导航线的背景色,导航线包括边缘符号和行号****************************************
    // "editorLineNumber.foreground":"#75a478",// //	编辑器行号颜色
    // "sideBar.background":"#75a478",// //	侧边栏背景色
    // "sideBar.foreground":"#75a478",// //	侧边栏前景色
    // "sideBarSectionHeader.background":"#272822",// //	侧边栏节标题的背景颜色****************************************
    // "statusBar.background":"#414339",// //	标准状态栏背景色****************************************
    // "statusBar.noFolderBackground":"#75a478",// //	没有打开文件夹时状态栏的背景色
    // "statusBar.debuggingBackground":"#75a478",// //	调试程序时状态栏的背景色
    // "tab.activeBackground":"#75a478",// //	活动选项卡的背景色
    // "tab.activeForeground":"#75a478",// //	活动组中活动选项卡的前景色
    // "tab.inactiveBackground":"#75a478",// //	非活动选项卡的背景色
    // "tab.inactiveForeground":"#75a478",// //	活动组中非活动选项卡的前景色
    //Ts内联样式****************************************************************************
    "inlineparameters.annotationBackground": "#00000000",
    //go内联样式****************************************************************************
    //  "editorInlayHint.background": "#ff0000",
    "editorInlayHint.foreground": "#888",
    "editorInlayHint.parameterBackground": "#00000000",
    //  "editorInlayHint.parameterForeground": "#ff0000",
    //  "editorInlayHint.typeBackground": "#ff0000",
    //  "editorInlayHint.typeForeground": "#ff0000",
    // "editorIndentGuide.background": "#686666", // 缩进参考线
    "editorIndentGuide.activeBackground": "#c1c1c1", // 缩进参考线
  },
  "javascript.updateImportsOnFileMove.enabled": "always",
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "fileheader.configObj": {
    "autoAdd": false, // 关闭文件自动注释
  },
  "editor.quickSuggestions": {
    "strings": true
  },
  "go.toolsManagement.autoUpdate": true,
  "typescript.tsdk": "node_modules/typescript/lib",
  "diffEditor.maxComputationTime": 0,
  "[vue]": {
    "editor.defaultFormatter": "Vue.volar"
  },
  "window.commandCenter": true,
  "html.format.wrapAttributes": "force-expand-multiline",
  "blockhighlight.background": [
    "120",
    "120",
    "120",
    ".05"
  ],
  "diffEditor.ignoreTrimWhitespace": false,
  "editor.minimap.enabled": false,
  "[python]": {},
  "editor.stickyScroll.enabled": true,
  "editor.stickyTabStops": true,
  "editor.stickyScroll.maxLineCount": 10,
  "tabnine.experimentalAutoImports": true,
  "boot-java.rewrite.reconcile": true,
  "commentTranslate.hover.variable": true,
  "redhat.telemetry.enabled": true,
  "xml.symbols.maxItemsComputed": 50000000000,
  "editor.accessibilitySupport": "off",
  "[sql]": {
    "editor.defaultFormatter": "mtxr.sqltools"
  },
  "workbench.editor.wrapTabs": true,
  "workbench.colorTheme": "Cobalt2",
  "commentTranslate.multiLineMerge": true,
  "commentTranslate.targetLanguage": "zh-CN",
  "commentTranslate.source": "Youdao",
  //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  /*editor*/
  "editor.cursorBlinking": "smooth", //使编辑器光标的闪烁平滑,有呼吸感****************************************************
  "editor.formatOnPaste": true, //在粘贴时格式化代码****************************************************
  "editor.formatOnType": true, //敲完一行代码自动格式化****************************************************
  "editor.smoothScrolling": true, //使编辑器滚动变平滑****************************************************
  "editor.tabCompletion": "on", //启用Tab补全
  // "editor.fontFamily": "'Jetbrains Mono', '思源黑体'", //字体设置,个人喜欢Jetbrains Mono作英文字体,思源黑体作中文字体
  "editor.fontLigatures": true, //启用字体连字************************************************************
  "editor.detectIndentation": false, //不基于文件内容选择缩进用制表符还是空格
  /*
  因为有时候VSCode的判断是错误的
  */
  "editor.insertSpaces": true, //敲下Tab键时插入4个空格而不是制表符
  "editor.copyWithSyntaxHighlighting": false, //复制代码时复制纯文本而不是连语法高亮都复制了
  "editor.suggest.snippetsPreventQuickSuggestions": false, //这个开不开效果好像都一样,据说是因为一个bug,建议关掉
  // "editor.stickyTabStops": true, //在缩进上移动光标时四个空格一组来移动,就仿佛它们是制表符(\t)一样
  // "editor.wordBasedSuggestions": false, //关闭基于文件中单词来联想的功能(语言自带的联想就够了,开了这个会导致用vscode写MarkDown时的中文引号异常联想)
  "editor.linkedEditing": true, //html标签自动重命名(喜大普奔!终于不需要Auto Rename Tag插件了!)
  "editor.wordWrap": "on", //在文件内容溢出vscode显示区域时自动折行
  "editor.cursorSmoothCaretAnimation": "on", //让光标移动、插入变得平滑******************************************************************
  "editor.renderControlCharacters": true, //编辑器中显示不可见的控制字符
  "editor.renderWhitespace": "boundary", //除了两个单词之间用于分隔单词的一个空格,以一个小灰点的样子使空格可见********************************
  /*terminal*/
  // "terminal.integrated.defaultProfile.windows": "Command Prompt", //将终端设为cmd,个人比较喜欢cmd作为终端
  "terminal.integrated.cursorBlinking": true, //终端光标闪烁
  "terminal.integrated.rightClickBehavior": "default", //在终端中右键时显示菜单而不是粘贴(个人喜好)
  /*files*/
  "files.autoGuessEncoding": true, //让VScode自动猜源代码文件的编码格式
  // "files.autoSave": "onFocusChange", //在编辑器失去焦点时自动保存,这使自动保存近乎达到“无感知”的体验
  // "files.exclude": { //隐藏一些碍眼的文件夹
  //   "**/.git": true,
  //   "**/.svn": true,
  //   "**/.hg": true,
  //   "**/CVS": true,
  //   "**/.DS_Store": true,
  //   "**/tmp": true,
  //   "**/node_modules": true,
  //   "**/bower_components": true
  // },
  "files.watcherExclude": { //不索引一些不必要索引的大文件夹以减少内存和CPU消耗******************************************************************
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/**": true,
    "**/tmp/**": true,
    "**/bower_components/**": true,
    "**/dist/**": true
  },
  /*workbench*/
  "workbench.list.smoothScrolling": true, //使文件列表滚动变平滑******************************************************************
  "workbench.editor.enablePreview": false, //打开文件时不是“预览”模式,即在编辑一个文件时打开编辑另一个文件不会覆盖当前编辑的文件而是新建一个标签页
  // "workbench.editor.wrapTabs": true, //编辑器标签页在空间不足时以多行显示
  // "workbench.editor.untitled.hint": "hidden", //隐藏新建无标题文件时的“选择语言?”提示(个人喜好,可以删掉此行然后Ctrl+N打开无标题新文件看看不hidden的效果)
  /*explorer*/
  // "explorer.confirmDelete": false, //删除文件时不弹出确认弹窗(因为很烦)
  "explorer.confirmDragAndDrop": false, //往左边文件资源管理器拖动东西来移动/复制时不显示确认窗口(因为很烦)
  /*search*/
  "search.followSymlinks": false, //据说可以减少vscode的CPU和内存占用******************************************************************
  /*window*/
  "window.menuBarVisibility": "visible", //在全屏模式下仍然显示窗口顶部菜单(没有菜单很难受)
  "window.dialogStyle": "custom", //使用更具有VSCode的UI风格的弹窗提示(更美观)******************************************************************
  /*debug*/
  "debug.internalConsoleOptions": "openOnSessionStart", //每次调试都打开调试控制台,方便调试
  "debug.showBreakpointsInOverviewRuler": true, //在滚动条标尺上显示断点的位置,便于查找断点的位置
  "debug.toolBarLocation": "docked", //固定调试时工具条的位置,防止遮挡代码内容(个人喜好)
  "debug.saveBeforeStart": "nonUntitledEditorsInActiveGroup", //在启动调试会话前保存除了无标题文档以外的文档(毕竟你创建了无标题文档就说明你根本没有想保存它的意思(至少我是这样的。))
  "debug.onTaskErrors": "showErrors", //预启动任务出错后显示错误,并不启动调试
  /*html*/
  "html.format.indentHandlebars": true //在写包含形如{{xxx}}的标签的html文档时,也对标签进行缩进(更美观)
}

tslint

{
  "defaultSeverity": "error",
  "extends": [
    "tslint:recommended"
  ],
  "jsRules": {},
  // "rules": {
  // }
  "rules": {
    // 必须使用单引号,jsx 中必须使用双引号
    "quotemark": [
      true,
      "single",
      "jsx-single",
      // "jsx-double",
      "avoid-template",
      "avoid-escape"
    ],
    //禁止使用console.log()
    "no-console": false,
    "no-debugger":false,
    // 禁止行尾有空格
    "no-trailing-whitespace": true,
    // 禁止使用特殊空白符(比如全角空格)
    "no-irregular-whitespace": true,
    "vue/max-attributes-per-line": [
      2,
      {
        "singleline": 10,
        "multiline": {
          "max": 1,
          "allowFirstLine": false
        }
      }
    ],
    "vue/singleline-html-element-content-newline": "off",
    "vue/multiline-html-element-content-newline": "off",
    "vue/name-property-casing": [
      "error",
      "PascalCase"
    ],
    "vue/no-v-html": "off",
    "accessor-pairs": 2,
    "arrow-spacing": [
      2,
      {
        "before": true,
        "after": true
      }
    ],
    "block-spacing": [
      2,
      "always"
    ],
    "brace-style": [
      2,
      "1tbs",
      {
        "allowSingleLine": true
      }
    ],
    "camelcase": [
      0,
      {
        "properties": "always"
      }
    ],
    "comma-dangle": [
      0,
      "never"
    ],
    "comma-spacing": [
      2,
      {
        "before": false,
        "after": true
      }
    ],
    "comma-style": [
      2,
      "last"
    ],
    "constructor-super": 2,
    "curly": [
      true,
      "as-needed"
    ],
    "dot-location": [
      2,
      "property"
    ],
    "eol-last": 2,
    "eqeqeq": [
      "error",
      "always",
      {
        "null": "ignore"
      }
    ],
    "generator-star-spacing": [
      2,
      {
        "before": true,
        "after": true
      }
    ],
    "handle-callback-err": [
      2,
      "^(err|error)$"
    ],
    "indent": [
      true,
      "spaces",
      2
    ],
    "jsx-quotes": [
      2,
      "prefer-single"
    ],
    "key-spacing": [
      2,
      {
        "beforeColon": false,
        "afterColon": true
      }
    ],
    "keyword-spacing": [
      2,
      {
        "before": true,
        "after": true
      }
    ],
    "new-cap": [
      2,
      {
        "newIsCap": true,
        "capIsNew": false
      }
    ],
    "new-parens": true,
    "no-array-constructor": 2,
    "no-caller": 2,
    "no-class-assign": 2,
    "no-cond-assign": 2,
    "no-const-assign": 2,
    "no-control-regex": 0,
    "no-delete-var": 2,
    "no-dupe-args": 2,
    "no-dupe-class-members": 2,
    "no-dupe-keys": 2,
    "no-duplicate-case": 2,
    "no-empty-character-class": 2,
    "no-empty-pattern": 2,
    "no-eval": true,
    "no-ex-assign": 2,
    "no-extend-native": 2,
    "no-extra-bind": 2,
    "no-extra-boolean-cast": 2,
    "no-extra-parens": [
      2,
      "functions"
    ],
    "no-fallthrough": 2,
    "no-floating-decimal": 2,
    "no-func-assign": 2,
    "no-implied-eval": 2,
    "no-inner-declarations": [
      2,
      "functions"
    ],
    "no-invalid-regexp": 2,
    "no-iterator": 2,
    "no-label-var": 2,
    "no-labels": [
      2,
      {
        "allowLoop": false,
        "allowSwitch": false
      }
    ],
    "no-lone-blocks": 2,
    "no-mixed-spaces-and-tabs": 2,
    "no-multi-spaces": 2,
    "no-multi-str": 2,
    "no-multiple-empty-lines": [
      2,
      {
        "max": 1
      }
    ],
    "no-native-reassign": 2,
    "no-negated-in-lhs": 2,
    "no-new-object": 2,
    "no-new-require": 2,
    "no-new-symbol": 2,
    "no-new-wrappers": 2,
    "no-obj-calls": 2,
    "no-octal": 2,
    "no-octal-escape": 2,
    "no-path-concat": 2,
    "no-proto": 2,
    "no-redeclare": 2,
    "no-regex-spaces": 2,
    "no-return-assign": [
      2,
      "except-parens"
    ],
    "no-self-assign": 2,
    "no-self-compare": 2,
    "no-sequences": 2,
    "no-shadow-restricted-names": 2,
    "no-spaced-func": 2,
    "no-sparse-arrays": true,
    "no-this-before-super": 2,
    "no-throw-literal": 2,
    "no-trailing-spaces": 2,
    "no-undef": 2,
    "no-undef-init": 2,
    "no-unexpected-multiline": 2,
    "no-unmodified-loop-condition": 2,
    "no-unneeded-ternary": [
      2,
      {
        "defaultAssignment": false
      }
    ],
    "no-unreachable": 2,
    "no-unsafe-finally": true,
    "no-unused-vars": [
      2,
      {
        "vars": "all",
        "args": "none"
      }
    ],
    "no-useless-call": 2,
    "no-useless-computed-key": 2,
    "no-useless-constructor": 2,
    "no-useless-escape": 0,
    "no-whitespace-before-property": 2,
    "no-with": 2,
    "one-var": [
      2,
      {
        "initialized": "never"
      }
    ],
    "operator-linebreak": [
      2,
      "after",
      {
        "overrides": {
          "?": "before",
          ":": "before"
        }
      }
    ],
    "padded-blocks": [
      2,
      "never"
    ],
    "quotes": [
      2,
      "single",
      {
        "avoidEscape": true,
        "allowTemplateLiterals": true
      }
    ],
    "semi": [
      0,
      "never"
    ],
    "semi-spacing": [
      2,
      {
        "before": false,
        "after": true
      }
    ],
    "space-before-blocks": [
      2,
      "always"
    ],
    "space-before-function-paren": [
      true,
      {
        "anonymous": "never",
        "named": "never",
        "asyncArrow": "never"
      }
    ],
    "space-in-parens": [
      2,
      "never"
    ],
    "space-infix-ops": 2,
    "space-unary-ops": [
      2,
      {
        "words": true,
        "nonwords": false
      }
    ],
    "spaced-comment": [
      2,
      "always",
      {
        "markers": [
          "global",
          "globals",
          "eslint",
          "eslint-disable",
          "*package",
          "!",
          ","
        ]
      }
    ],
    "template-curly-spacing": [
      2,
      "never"
    ],
    "use-isnan": true,
    "valid-typeof": 2,
    "wrap-iife": [
      2,
      "any"
    ],
    "yield-star-spacing": [
      2,
      "both"
    ],
    "yoda": [
      2,
      "never"
    ],
    "prefer-const": true,
    "object-curly-spacing": [
      2,
      "always",
      {
        "objectsInObjects": false
      }
    ],
    "array-bracket-spacing": [
      2,
      "never"
    ]
  }
}

 vscode

//console语法报错
"no-console": false
// packge.json npm格式化指令
// vs必须安装tslint dev插件
// 控制台执行以下指令生成tslint.json文件:

tslint init 

"scripts": {
    "tslint": "tslint -p tsconfig.json",
    "tslint-fix": "tslint --fix -p tsconfig.json"
}
{
  "defaultSeverity": "error",
  "extends": [
    "tslint:recommended"
  ],
  "jsRules": {
    // 禁止给类的构造函数的参数添加修饰符
    "no-parameter-properties": false,
    // 禁止使用 debugger
    "no-debugger": false,
    // 禁止行尾有空格
    "no-trailing-whitespace": false,
    // 禁止无用的表达式
    "no-unused-expression": true,
    // 定义过的变量必须使用
    "no-unused-variable": true,
    // 变量必须先定义后使用
    "no-use-before-declare": true,
    // 禁止使用 var
    "no-var-keyword": true,
    // 必须使用 === 或 !==,禁止使用 == 或 !=,与 null 比较时除外
    "triple-equals": true,
    // 指定类成员的排序规则
    "member-ordering": false,
    // 禁止将 this 赋值给其他变量,除非是解构赋值
    "no-this-assignment": [
      false,
      {
        "allowed-names": [
          "^self$",
          "^that$"
        ],
        "allow-destructuring": true
      }
    ],
    // 必须使用箭头函数,除非是单独的函数声明或是命名函数
    "only-arrow-functions": [
      true,
      "allow-declarations",
      "allow-named-functions"
    ],
    // 禁止出现空代码块,允许 catch 是空代码块
    "no-empty": [
      true,
      "allow-empty-catch"
    ],
    // 禁止无用的类型断言
    "no-unnecessary-type-assertion": true,
    // 使用 return; 而不是 return undefined;
    "return-undefined": true,
    // 禁止对 array 使用 for in 循环
    "no-for-in-array": true,
    "comment-format": [
      true,
      "check-space"
    ],
    // 单行注释格式化规则
    // 定义函数时如果用到了覆写,则必须将覆写的函数写到一起
    "adjacent-overload-signatures": true,
    // 禁止对函数的参数重新赋值
    "no-parameter-reassignment": true,
    // if 后面必须有 {,除非是单行 if
    "curly": [
      true,
      "ignore-same-line"
    ],
    // for in 内部必须有 hasOwnProperty
    "forin": true,
    // 禁止在分支条件判断中有赋值操作
    "no-conditional-assignment": true,
    // 禁止使用 new 来生成 String, Number 或 Boolean
    "no-construct": true,
    // 禁止 super 在一个构造函数中出现两次
    "no-duplicate-super": true,
    // 禁止在 switch 语句中出现重复测试表达式的 case
    "no-duplicate-switch-case": true,
    // 禁止出现重复的变量定义或函数参数名
    "no-duplicate-variable": [
      true,
      "check-parameters"
    ],
    // 禁止使用 eval
    "no-eval": true,
    // 禁止对对象字面量进行类型断言(断言成 any 是允许的)
    "no-object-literal-type-assertion": true,
    // 禁止没必要的 return await
    "no-return-await": true,
    // 禁止在数组中出现连续的逗号,如 let foo = [,,]
    "no-sparse-arrays": true,
    // 禁止 throw 字符串,必须 throw 一个 Error 对象
    "no-string-throw": true,
    // switch 的 case 必须 return 或 break
    "no-switch-case-fall-through": true,
    // 使用实例的方法时,必须 bind 到实例上
    "no-unbound-method": [
      true,
      "ignore-static"
    ],
    // 使用 { ...foo, bar: 1 } 代替 Object.assign({}, foo, { bar: 1 })
    // 前者的类型检查更完善
    "prefer-object-spread": true,
    // parseInt 必须传入第二个参数
    "radix": true,
    // 必须使用 isNaN(foo) 而不是 foo === NaN
    "use-isnan": true,
    //
    //
    // 可维护性
    // 这些规则可以增加代码的可维护性
    //
    // 禁止函数的循环复杂度超过 20,https://en.wikipedia.org/wiki/Cyclomatic_complexity
    "cyclomatic-complexity": [
      true,
      20
    ],
    // 禁止使用废弃(被标识了 @deprecated)的 API
    "deprecation": true,
    // 一个缩进必须用四个空格替代
    "indent": [
      true,
      "spaces",
      4
    ],
    // 禁止出现重复的 import
    "no-duplicate-imports": true,
    // 禁止一个文件中出现多个相同的 namespace
    "no-mergeable-namespace": true,
    // 文件类型必须时 utf-8
    "encoding": true,
    // import 语句中,关键字之间的间距必须是一个空格
    "import-spacing": true,
    // 接口可以 implement extend 和 merge
    "interface-over-type-literal": true,
    // new 后面只必须有一个空格
    "new-parens": true,
    // 类型断言必须使用 as Type,禁止使用 
    //  容易被理解为 jsx
    "no-angle-bracket-type-assertion": true,
    // 禁止连续超过三行空行
    "no-consecutive-blank-lines": [
      true,
      3
    ],
    // 禁止使用特殊空白符(比如全角空格)
    "no-irregular-whitespace": true,
    // 禁止使用 JSDoc,因为 TypeScirpt 已经包含了大部分功能
    "no-redundant-jsdoc": true,
    // 禁止使用三斜杠引入类型定义文件
    "no-reference-import": true,
    // 禁止变量定义时赋值为 undefined
    "no-unnecessary-initializer": true,
    // 小数必须以 0. 开头,禁止以 . 开头,并且不能以 0 结尾
    "number-literal-format": true,
    // 必须使用 a = {b} 而不是 a = {b: b}
    "object-literal-shorthand": true,
    // 变量申明必须每行一个,for 循环的初始条件中除外
    "one-variable-per-declaration": [
      true,
      "ignore-for-loop"
    ],
    // if 后的 { 禁止换行
    "one-line": true,
    // 必须使用单引号,jsx 中必须使用双引号
    "quotemark": [
      true,
      "single",
      "jsx-double",
      // "jsx-double",
      "avoid-template",
      "avoid-escape"
    ],
    // 行尾必须有分号
    "semicolon": [
      true,
      "always",
      "ignore-interfaces"
    ],
    // 函数名前必须有空格
    "space-before-function-paren": [
      true,
      {
        "anonymous": "always",
        "named": "always",
        "asyncArrow": "always"
      }
    ],
    // 括号内首尾禁止有空格
    "space-within-parens": [
      true,
      0
    ],
    // 禁止 finally 内出现 return, continue, break, throw 等
    // finally 会比 catch 先执行
    "no-unsafe-finally": true,
    "vue/max-attributes-per-line": [
      2,
      {
        "singleline": 10,
        "multiline": {
          "max": 1,
          "allowFirstLine": false
        }
      }
    ],
    "vue/singleline-html-element-content-newline": "off",
    "vue/multiline-html-element-content-newline": "off",
    "vue/name-property-casing": [
      "error",
      "PascalCase"
    ],
    "vue/no-v-html": "off",
    "accessor-pairs": 2,
    "arrow-spacing": [
      2,
      {
        "before": true,
        "after": true
      }
    ],
    "block-spacing": [
      2,
      "always"
    ],
    "brace-style": [
      2,
      "1tbs",
      {
        "allowSingleLine": true
      }
    ],
    "camelcase": [
      0,
      {
        "properties": "always"
      }
    ],
    "comma-dangle": [
      0,
      "never"
    ],
    "comma-spacing": [
      2,
      {
        "before": false,
        "after": true
      }
    ],
    "comma-style": [
      2,
      "last"
    ],
    "constructor-super": 2,
    "dot-location": [
      2,
      "property"
    ],
    "eol-last": 2,
    "eqeqeq": [
      "error",
      "always",
      {
        "null": "ignore"
      }
    ],
    "generator-star-spacing": [
      2,
      {
        "before": true,
        "after": true
      }
    ],
    "handle-callback-err": [
      2,
      "^(err|error)$"
    ],
    "jsx-quotes": [
      2,
      "prefer-single"
    ],
    "key-spacing": [
      2,
      {
        "beforeColon": false,
        "afterColon": true
      }
    ],
    "keyword-spacing": [
      2,
      {
        "before": true,
        "after": true
      }
    ],
    "new-cap": [
      2,
      {
        "newIsCap": true,
        "capIsNew": false
      }
    ],
    "no-array-constructor": 2,
    "no-caller": 2,
    "no-console": false,
    "no-class-assign": 2,
    "no-cond-assign": 2,
    "no-const-assign": 2,
    "no-control-regex": 0,
    "no-delete-var": 2,
    "no-dupe-args": 2,
    "no-dupe-class-members": 2,
    "no-dupe-keys": 2,
    "no-duplicate-case": 2,
    "no-empty-character-class": 2,
    "no-empty-pattern": 2,
    "no-ex-assign": 2,
    "no-extend-native": 2,
    "no-extra-bind": 2,
    "no-extra-boolean-cast": 2,
    "no-extra-parens": [
      2,
      "functions"
    ],
    "no-fallthrough": 2,
    "no-floating-decimal": 2,
    "no-func-assign": 2,
    "no-implied-eval": 2,
    "no-inner-declarations": [
      2,
      "functions"
    ],
    "no-invalid-regexp": 2,
    "no-iterator": 2,
    "no-label-var": 2,
    "no-labels": [
      2,
      {
        "allowLoop": false,
        "allowSwitch": false
      }
    ],
    "no-lone-blocks": 2,
    "no-mixed-spaces-and-tabs": 2,
    "no-multi-spaces": 2,
    "no-multi-str": 2,
    "no-multiple-empty-lines": [
      2,
      {
        "max": 1
      }
    ],
    "no-native-reassign": 2,
    "no-negated-in-lhs": 2,
    "no-new-object": 2,
    "no-new-require": 2,
    "no-new-symbol": 2,
    "no-new-wrappers": 2,
    "no-obj-calls": 2,
    "no-octal": 2,
    "no-octal-escape": 2,
    "no-path-concat": 2,
    "no-proto": 2,
    "no-redeclare": 2,
    "no-regex-spaces": 2,
    "no-return-assign": [
      2,
      "except-parens"
    ],
    "no-self-assign": 2,
    "no-self-compare": 2,
    "no-sequences": 2,
    "no-shadow-restricted-names": 2,
    "no-spaced-func": 2,
    "no-this-before-super": 2,
    "no-throw-literal": 2,
    "no-trailing-spaces": 2,
    "no-undef": 2,
    "no-undef-init": 2,
    "no-unexpected-multiline": 2,
    "no-unmodified-loop-condition": 2,
    "no-unneeded-ternary": [
      2,
      {
        "defaultAssignment": false
      }
    ],
    "no-unreachable": 2,
    "no-unused-vars": [
      2,
      {
        "vars": "all",
        "args": "none"
      }
    ],
    "no-useless-call": 2,
    "no-useless-computed-key": 2,
    "no-useless-constructor": 2,
    "no-useless-escape": 0,
    "no-whitespace-before-property": 2,
    "no-with": 2,
    "one-var": [
      2,
      {
        "initialized": "never"
      }
    ],
    "operator-linebreak": [
      2,
      "after",
      {
        "overrides": {
          "?": "before",
          ":": "before"
        }
      }
    ],
    "padded-blocks": [
      2,
      "never"
    ],
    "quotes": [
      2,
      "single",
      {
        "avoidEscape": true,
        "allowTemplateLiterals": true
      }
    ],
    "semi": [
      0,
      "never"
    ],
    "semi-spacing": [
      2,
      {
        "before": false,
        "after": true
      }
    ],
    "space-before-blocks": [
      2,
      "always"
    ],
    "space-in-parens": [
      2,
      "never"
    ],
    "space-infix-ops": 2,
    "space-unary-ops": [
      2,
      {
        "words": true,
        "nonwords": false
      }
    ],
    "spaced-comment": [
      2,
      "always",
      {
        "markers": [
          "global",
          "globals",
          "eslint",
          "eslint-disable",
          "*package",
          "!",
          ","
        ]
      }
    ],
    "template-curly-spacing": [
      2,
      "never"
    ],
    "valid-typeof": 2,
    "wrap-iife": [
      2,
      "any"
    ],
    "yield-star-spacing": [
      2,
      "both"
    ],
    "yoda": [
      2,
      "never"
    ],
    "prefer-const": true,
    "object-curly-spacing": [
      2,
      "always",
      {
        "objectsInObjects": false
      }
    ],
    "array-bracket-spacing": [
      2,
      "never"
    ]
  },
  "rules": {},
  "rulesDirectory": []
}

你可能感兴趣的:(json,vscode)