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

 vscode seting.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文档时,也对标签进行缩进(更美观)
}
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"
}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值