vscode seting.json配置,eslint.js配置

本文详细介绍了VSCodesetting.json配置,涵盖自动保存、代码格式化、ESLint规则、终端设置等,旨在优化开发环境,确保高效且规范的编码体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 vscode seting.json配置

{
  "security.workspace.trust.untrustedFiles": "open",
  "eslint.validate": [
    "javascriptreact",
    "typescriptreact",
    "javascript",
    "typescript",
    "html",
    "vue",
    "react"
  ],
  "search.exclude": {
    "**/node_modules": true,
    "**/dist": true
  },
  "eslint.enable": true,
  "eslint.codeAction.showDocumentation": {
    "enable": true
  }, // formatting only supports LF line endings
  "editor.codeActionsOnSave": {
    "source.fixAll": "explicit",
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "explicit"
  },
  "editor.tabSize": 2,
  "files.exclude": {
    "**/.git": true,
    "**/.svn": true,
    "**/.hg": true,
    "**/CVS": true,
    "**/.DS_Store": true,
    "**/Thumbs.db": true,
    "**/.classpath": true,
    "**/.factorypath": true,
    "**/.project": true,
    "**/.settings": true,
    "**/.byte-ide": true
  },
  "editor.tokenColorCustomizations": {
    //     "comments":注释颜色
    // "functions":函数/方法定义与引用颜色
    // "keywords":关键字颜色,如new, if, else, try等
    // "numbers":数字的颜色
    // "strings":字符串的颜色
    // "types":类型定义与引用的颜色
    // "variables":变量的颜色
    // "textMateRules":其他具体的颜色设置
    // 注释
    "comments": {
      "fontStyle": "bold", // 设置字体样式  bold 加粗 italic 斜体 underline 下划线   
      "foreground": "#fffb" // 设置字体颜色
    },
    // 关键字
    // "keywords": "#0a0", 
    // 变量名
    // "variables": {}, 
    // 字符串
    // "strings": "#e2d75dbd",
    // 函数名
    "functions": {
      "fontStyle": "bold"
    },
    // 数字
    // "numbers": "#AE81FF" 
    // 类型定义与引用的颜色
    // "types": "#AE81FF" 
    // 其他
    // "textMateRules": [
    //    {
    //        "scope": "keyword.control",//if ,else, try 等控制符
    //        "settings": {
    //            "foreground": "#C586C0"
    //        }
    //    },
    //    {
    //        "scope": "keyword.operator",//算数符
    //        "settings": {
    //            "foreground": "#f07d3b"
    //        }
    //    },
    //    {
    //        "scope": "storage.modifier",//修饰语
    //        "settings": {
    //            "foreground": "#f09090"
    //        }
    //    },
    //    {
    //        "scope": "entity.name.type.class",//类名
    //        "settings": {
    //            "foreground": "#c0526a"
    //        }
    //    },
    //    {
    //        "scope": "storage.type.primitive.java",//int和其他啥啥,忘记了
    //        "settings": {
    //            "foreground": "#c0526a"
    //        }
    //    },
    //    {
    //        "scope": "entity.name.type.interface",//接口
    //        "settings": {
    //            "foreground": "#c0526a"
    //        }
    //    },
    //    {
    //        "scope": "entity.name.namespace",//导入部分
    //        "settings": {
    //            "foreground": "#74817c"
    //        }
    //    },
    //    {
    //        "scope": "entity.name.tag",//html标签
    //        "settings": {
    //            "foreground": "#d35c5c"
    //        }
    //    }
    // ],
    // 特殊主体设置
    "[WeChat Dark]": {
      // 注释
      "comments": {
        "fontStyle": "bold", // 设置字体样式  bold 加粗 italic 斜体 underline 下划线
        "foreground": "#89d4a6" // 设置字体颜色
      },
    },
  },
  "git.autofetch": true,
  "git.enableSmartCommit": true,
  "editor.bracketPairColorization.enabled": true,
  "editor.guides.bracketPairs": "active",
  "editor.fontFamily": "'JetBrains Mono', '苹方'",
  "editor.letterSpacing": 0.5,
  "workbench.colorCustomizations": {
    // "editorError.foreground": "#fff", // 错误波浪线颜色$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    "editorError.background": "#0000", // 错误背景颜色$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    // "editorWarning.foreground": "#fff", // 警告波浪线颜色$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    "editorWarning.background": "#0000", // 警告背景颜色$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    // "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.activeBackground1": "#c1c1c1", // 缩进参考线 //   在用的
  },
  "javascript.updateImportsOnFileMove.enabled": "always",
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "fileheader.configObj": {
    "autoAdd": false // 关闭文件自动注释
  },
  // "editor.quickSuggestions": {
  // "other": true,
  // "comments": false,
  // "strings": false
  // },
  // "editor.quickSuggestionsDelay": 20,
  "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"
  ],
  "[python]": {
    "editor.formatOnType": true
  },
  "editor.stickyTabStops": true,
  // "editor.stickyScroll.maxLineCount": 5,
  "editor.accessibilitySupport": "off",
  "workbench.editor.wrapTabs": true,
  //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  /*editor*/
  "editor.cursorBlinking": "smooth", //使编辑器光标的闪烁平滑,有呼吸感****************************************************
  "editor.formatOnPaste": true, //在粘贴时格式化代码****************************************************
  "editor.formatOnType": false, //敲完一行代码自动格式化****************************************************
  "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, //在文件内容溢出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.wrapTabs": true, //编辑器标签页在空间不足时以多行显示
  // "workbench.editor.untitled.hint": "hidden", //隐藏新建无标题文件时的“选择语言?”提示(个人喜好,可以删掉此行然后Ctrl+N打开无标题新文件看看不hidden的效果)
  /*explorer*/
  // "explorer.confirmDelete": false, //删除文件时不弹出确认弹窗(因为很烦)
  "explorer.confirmDragAndDrop": false, //往左边文件资源管理器拖动东西来移动/复制时不显示确认窗口(因为很烦)
  /*search*/
  "search.followSymlinks": false, //在全屏模式下仍然显示窗口顶部菜单(没有菜单很难受)
  "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,
  "git.confirmSync": false,
  "errorLens.excludeBySource": [
    "ts(2322)",
    "eslint(no-trailing-spaces)"
  ],
  "editor.unicodeHighlight.ambiguousCharacters": false,
  "editor.wordWrap": "on",
  "editor.stickyScroll.enabled": true,
  "nebulaOni.update.restoreConfiguration": {
    "themeSettings": {
      "background": "Grey",
      "main": "Bumblebee",
      "highlight": "Ultra Violet",
      "focusBorder": "ON",
      "fontStyle": "Italic",
      "syntaxBrightness": "Normal",
      "comments": "Dark Violet",
      "favorite": "OFF"
    },
    "favoriteSettings": {
      "background": "Glacial Blue",
      "main": "Sakura",
      "highlight": "Ultra Violet",
      "focusBorder": "ON",
      "fontStyle": "Italic",
      "comments": "Dark Magenta",
      "favorite": "Nebula Oni (Pegasus)"
    }
  },
  "[nginx]": {
    "editor.defaultFormatter": "raynigon.nginx-formatter"
  },
  "chatgpt.lang": "cn",
  "[scss]": {
    "editor.defaultFormatter": "sibiraj-s.vscode-scss-formatter"
  },
  "typescript.updateImportsOnFileMove.enabled": "always",
  "files.associations": {
    "*.json": "jsonc",
    ".env*": "shellscript",
    "*.cjson": "jsonc",
    "*.wxss": "css",
    "*.wxs": "javascript",
    "*.ttss": "css",
    "*.sjs": "javascript",
    "*.ttml": "ttml",
    "*.wxml": "ttml",
    "*.sk": "ttml"
  },
  "emmet.includeLanguages": {
    "sjs": "javascript"
  },
  "minapp-vscode.disableAutoConfig": true,
  "[css]": {
    "editor.defaultFormatter": "sibiraj-s.vscode-scss-formatter"
  },
  "wxcloud.containerDebug.appid": "wxc019d9c7e2263053",
  "wxcloud.containerDebug.cliKey": "AAQ9G7sEAAABAAAAAAA4uH4T0aPnGsV2Uoz5ZCAAAAAraAdzKm8i8JwFJ68cDOJBtIHsmv3F8e00LCv7f+tYvrNCJRcwiSknE+SS/1mdK2AgJPYptEY8xtyNMqTh2Pi9XZplcWRLnwoMF2QAn6CobX6ozTK+92P9z7+eRdxUstE5Mc83jgsGROFCq2o7AgQoHUmLBOiA",
  "wxcloud.containerDebug.VPC ProxyTargetEnvID": "prod-3g9oxbmecd292de8",
  "[dockerfile]": {
    "editor.defaultFormatter": "ms-azuretools.vscode-docker"
  },
  "bookmarks.saveBookmarksInProject": true,
  "gitlens.views.stashes.files.layout": "list",
  "editor.inlineSuggest.showToolbar": "always",
  "gitlens.ai.experimental.provider": "openai",
  "gitlens.ai.experimental.openai.model": "gpt-3.5-turbo",
  "gitlens.graph.layout": "editor",
  "git.openRepositoryInParentFolders": "always",
  "powermode.enabled": true,
  "powermode.shake.intensity": 0,
  // --------------------------------------------------------------------------------------------------------------------------------------------------
  // --------------------------------------------------------------------------------------------------------------------------------------------------
  // // 以下程序用于格式化Vue项目,其他项目可以根据原理一通百通。
  // // 设置保存时格式化。只用于用于格式化css/less程序 打开会影响自定义eslint
  // // "editor.formatOnSave": true,
  // // 关闭js/ts的默认format,统一用eslint进行格式化(tslint已经不维护了,所以转eslint吧)
  // // "javascript.format.enable": false,
  // // "typescript.format.enable": false,
  // // 关闭vetur的js/ts/html的formatter。html用eslint-plugin-vue格式化。
  // // js/ts程序用eslint,防止vetur中的prettier与eslint格式化冲突
  // "vetur.format.defaultFormatter.html": "none",
  // "vetur.format.defaultFormatter.js": "none",
  // "vetur.format.defaultFormatter.ts": "none",
  // "volar.format.defaultFormatter.html": "none",
  // "volar.format.defaultFormatter.js": "none",
  // "volar.format.defaultFormatter.ts": "none",
  // // 开启eslint自动修复js/ts/jsx/tsx功能
  "eslint.format.enable": true,
  // // 设置js的formatter为eslint
  "[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  // "[typescript]": {
  //   "editor.defaultFormatter": "dbaeumer.vscode-eslint"
  // },
  // // "[scss]": {
  // //   "editor.defaultFormatter": "sibiraj-s.vscode-scss-formatter"
  // // },
  // "[json]": {
  //   "editor.defaultFormatter": "vscode.json-language-features"
  // },
  // // jsonc是有注释的json
  // "[jsonc]": {
  //   "editor.defaultFormatter": "vscode.json-language-features"
  // },
  // "eslint.codeActionsOnSave.mode": "problems",
  // // "eslint.validate": [
  // //   "typescript",
  // //   "javascript",
  // //   "javascriptreact",
  // //   "typescriptreact",
  // // ],
  // // 将json文件识别为jsonc格式
  // // "files.associations": {
  // //   "*.json": "jsonc",
  // // }
  "[typescriptreact]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "[typescript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "files.autoSave": "afterDelay",
  // "autoDayNightThemeSwitcher.nightTheme": "Nebula Oni (Pegasus)",
  "autoDayNightThemeSwitcher.nightTheme": "Nebula Oni (Hourglass)",
  "autoDayNightThemeSwitcher.autoToggleTimeNightBegin": "18:30",
  "autoimport.showNotifications": true,
  "breadcrumbs.enabled": false,
  "editor.minimap.enabled": false,
  "workbench.editorAssociations": {
    "*.docx": "default"
  },
  "vetur.validation.template": false,
  "diffEditor.ignoreTrimWhitespace": true,
  "redhat.telemetry.enabled": true,
  "terminal.integrated.env.windows": {},
  "console-ninja.featureSet": "Community",
  "lowlight-block.rules": [
    "LOG",
    "console.log"
  ],
  "powermode.combo.counterEnabled": "hide",
  "powermode.combo.counterSize": 0,
  "security.workspace.trust.enabled": false,
  "vue.server.hybridMode": true,
  "github.copilot.editor.enableAutoCompletions": true,
  "window.confirmBeforeClose": "always",
  "docwriter.language": "Chinese",
  "Key Promoter.ignoredCommands": [
    "workbench.getCodeExchangeProxyEndpoints",
    "editor.action.clipboardPasteAction",
    "undo",
    "redo",
    "editor.action.trimTrailingWhitespace",
    "workbench.action.quickOpen",
    "editor.action.clipboardCopyAction"
  ],
  "[csharp]": {
    "editor.defaultFormatter": "ms-dotnettools.csharp"
  },
  "tabnine.experimentalAutoImports": true,
  "editor.inlineSuggest.suppressSuggestions": true,
  "cody.autocomplete.advanced.accessToken": "sgp_fd1b4edb60bf82b8_114a2a0bdb2a10f4c7160b1a00d934fb8fc99cec",
  "tomjs.reload.text": "♻️重启VS",
  "baidu.comate.privateService": "",
  "baidu.comate.username": "EEXXGG",
  "codingcopilot.enableAutoCompletions": true,
  "baidu.comate.license": "a926fec3-0529-481b-9b9a-2684a7513617",
  "Lingma.cloudModelAutoTriggerGenerateLength": "disable",
  "Lingma.localMachineModel": false,
  "autoDayNightThemeSwitcher.dayTheme": "WeChat Dark",
  "Codegeex.EnableExtension": false,
  "Codegeex.Privacy": false,
  "[jsonc]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "workbench.colorTheme": "WeChat Dark",
  "window.autoDetectColorScheme": true,
  "workbench.preferredDarkColorTheme": "Nebula Oni (Pegasus)",
  "workbench.preferredLightColorTheme": "WeChat Dark",
  "codingcopilot.enableCompletionLanguage": {
    "scminput": false,
    "csharp": false
  },
  "workbench.sideBar.location": "right",
  // "[typescriptreact]": {
  //   "editor.defaultFormatter": "dbaeumer.vscode-eslint"
  // },
  // "editor.defaultFormatter": "dbaeumer.vscode-eslint",
  // "omnisharp.useGlobalMono": "always",
  // "[csharp]": {
  //   "editor.defaultFormatter": "csharpier.csharpier-vscode"
  // },
}
rules: {
    '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': [2, 'never'],
    'comma-spacing': [2, {
      'before': false,
      'after': true
    }],
    'comma-style': [2, 'last'],
    'constructor-super': 2,
    'curly': [2, 'multi-line'],
    'dot-location': [2, 'property'],
    'eol-last': 2,
    'eqeqeq': [2, 'allow-null'],
    'generator-star-spacing': [2, {
      'before': true,
      'after': true
    }],
    'handle-callback-err': [2, '^(err|error)$'],
    'indent': [2, 2, {
      'SwitchCase': 1
    }],
    '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': 2,
    'no-array-constructor': 2,
    'no-caller': 2,
    'no-console': 'off',
    'no-class-assign': 2,
    'no-cond-assign': 2,
    'no-const-assign': 2,
    'no-control-regex': 2,
    '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': 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-irregular-whitespace': 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': 3
    }],
    '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': 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-unsafe-finally': 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': [2, 'never'],
    'semi-spacing': [2, {
      'before': false,
      'after': true
    }],
    'space-before-blocks': [2, 'always'],
    'space-before-function-paren': [2, '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': 2,
    'valid-typeof': 2,
    'wrap-iife': [2, 'any'],
    'yield-star-spacing': [2, 'both'],
    'yoda': [2, 'never'],
    'prefer-const': 2,
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
    'object-curly-spacing': [2, 'always', {
      objectsInObjects: false
    }],
    'array-bracket-spacing': [2, 'never'],
    // 自定义规则~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // 自定义规则~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // 自定义规则~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // 自定义规则~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'no-console': (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'uat' || process.env.NODE_ENV === 'ipuat') ? 'warn' : 'off',
    'no-debugger': (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'uat' || process.env.NODE_ENV === 'ipuat') ? 'warn' : 'off',
    'accessor-pairs': 2,
    'block-spacing': [2, 'always'],
    'comma-dangle': [0, 'never'],
    'comma-style': [2, 'last'],
    'constructor-super': 2,
    'dot-location': [2, 'property'],
    'eol-last': 2,
    'handle-callback-err': [2, '^(err|error)$'],
    // 'jsx-quotes': [2, 'prefer-single'], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'jsx-quotes': [0], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    quotes: [0], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    semi: [0], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'new-parens': 2,
    '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': 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-irregular-whitespace': 2,
    'no-iterator': 2,
    'no-label-var': 2,
    'no-lone-blocks': 2,
    'no-mixed-spaces-and-tabs': 2,
    'no-multi-spaces': 2,//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'no-multi-str': 2,
    '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': 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-unreachable': 2,
    'no-unsafe-finally': 2,
    '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,
    'padded-blocks': [2, 'never'],
    // 'space-before-blocks': [2, 'always'], //~~~~~~~~~~~~~~~~~~~~~
    'space-before-blocks': [0],
    // 'space-before-function-paren': [2, 'never'], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'space-before-function-paren': [0],
    'space-in-parens': [2, 'never'],
    'space-infix-ops': 2,
    'template-curly-spacing': [2, 'never'],
    'use-isnan': 2,
    'valid-typeof': 2,
    'wrap-iife': [2, 'any'],
    'yield-star-spacing': [2, 'both'],
    'prefer-const': 2,
    'object-curly-spacing': [2, 'always', {
      objectsInObjects: false
    }],
    'array-bracket-spacing': [2, 'never'],
    'vue/multi-word-component-names': [0], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'vue/html-self-closing': [0], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'vue/attribute-hyphenation': [0], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'eslintspace-before-blocks': [0], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    '@typescript-eslint/no-empty-function': [0], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // '@typescript-eslint/ban-types': [0], // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // 'key-spacing': [2, { /*  "align": "value", */"align": "colon", /* "mode": "minimum" */ }], // 对象对齐
    "indent": [2, 2],//缩进风格 // ~~~~~~~~~~~
    "no-use-before-define": ["error", { "variables": true }] // ~~~~~~~~~~~~~~
  }

//console语法报错
"no-console": false

packge.json 

// packge.json npm格式化指令
// vs必须安装tslint dev插件
// 控制台执行以下指令生成tslint.json文件:

tslint init 

"scripts": {
    "tslint": "tslint -p tsconfig.json",
    "tslint-fix": "tslint --fix -p tsconfig.json"
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值