全局安装eslint

打开终端,运行npm install eslint -g全局安装ESLint。

vscode安装插件

vscode 扩展设置

依次点击 文件 > 首选项 > 设置

{"workbench.iconTheme": "material-icon-theme","explorer.confirmDragAndDrop": false,"explorer.confirmDelete": false,//配置eslint

"eslint.autoFixOnSave": true, //启用保存时自动修复,默认只支持.js文件

"eslint.validate": ["javascript", //用eslint的规则检测js文件

{"language": "vue", //检测vue文件

"autoFix": true //为vue文件开启保存自动修复的功能

},

{"language": "html","autoFix": true},

],

}

4.项目目录里修改.eslitrc.js配置 文件,可能比较多

module.exports ={

root:true,

parserOptions: {

parser:'babel-eslint',

sourceType:'module'},

env: {

browser:true,

node:true,

es6:true,

},

extends: ['plugin:vue/recommended', 'eslint:recommended'],//add your custom rules here//it is base onhttps://github.com/vuejs/eslint-config-vue

rules: {"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","vue/html-self-closing": ["error", {"html": {"void": "never","normal": "always","component": "always"},"svg": "always","math": "always"}],'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': ["error", "always", {"null": "ignore"}],'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': 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-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': 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']

}

}

vscode 新版eslint自动修复_VSCODE 配置eslint规则和自动修复相关推荐

  1. vscode的eslint无效_VSCode配置eslint

    在Vue.js项目中,使用的是eslint检查. 而在我写完代码后,cnpm run dev运行命令...然后悲剧了,一大堆报错!╮(╯▽╰)╭ 安装插件:Vetur:这是vscode上一个vue.j ...

  2. vscode的eslint无效_vscode配置eslint自动保存功能不生效

    今天给一个项目添加eslint, 按照网上的教程,配置完就是不生效,半天没解决, 后来终于解决了, 在此总结,把一些坑分享出去. 1. vscode 扩展中安装eslint 2. eslint 扩展要 ...

  3. vscode输入vue自动_vscode配置总结可收藏/vscode用户设置大全/vue代码模板,vscodevue...

    vscode配置总结可收藏/vscode用户设置大全/vue代码模板,vscodevue ​ ​ //用户设置 { //-------- 搜索配置 -------- "search.excl ...

  4. vscode 批量重命名_vscode配置 打造性感好用的编辑器

    释放双眼,带上耳机,听听看~! vscode配置 Visual Studio Code是个牛逼的编辑器,启动非常快,完全可以用来代替其他文本文件编辑工具.又可以用来做开发,支持各种语言,相比其他IDE ...

  5. vscode python环境变量_VScode配置Python开发环境

    概念:VScode,单次运行一个脚本称为一个 task,对应的配置文件为 tasks.json: 整个文件夹或者多个文件夹视为一个工作空间,配置文件为 settings.json,调试环境的配置文件叫 ...

  6. gdb vscode 不进入断点_VScode配置MASM32运行环境(断点/运行/debug/配合emu8086(非DOSBox))...

    一.之所以不用DOSBox 不利于集成到VScode,执行代码需要新开窗口,配置繁琐.ps:而且加断点和调试复杂. 感谢masm-code插件的作者,终于可以补全啦qaq 添加关于调试的一些建议 二. ...

  7. vscode更改配置文件路径_VScode配置

    配置文件 用户设置文件 用户设置文件保存在如下目录: Window %APPDATA%\Code\User\settings.json Mac $HOME/Library/Application Su ...

  8. 关闭eslint检查2020_2020 vscode配置eslint保存后自动fix

    2020 vscode配置eslint保存后自动fix 这篇文章发布于 2019/10/12,归类于 计算机基础与开发工具 标签: vscode 保存自动fix,vscode 保存执行fix,esli ...

  9. 更新版-梳理前端开发使用eslint和prettier来检查和格式化代码问题

    更新版,之前的版本可以看这里:梳理前端开发使用eslint和prettier来检查和格式化代码问题 一.问题痛点 在团队的项目开发过程中,代码维护所占的时间比重往往大于新功能的开发.因此编写符合团队编 ...

最新文章

  1. DVWA系列之21 存储型XSS分析与利用
  2. Java之基础(1) - 编程中“为了性能”尽量要做到的一些地方
  3. hyperworks2019安装教程
  4. ssh登录慢,等待时间长的问题
  5. U5398 改数(num)
  6. WEB前端学习五 js什么是引用类型
  7. android6.0 sd卡卸载api,android6.0 用户关掉sd卡读取权限的情况下, 还能做到手机缓存么?...
  8. linux系统初级管理书,Linux系统管理基础--超级适合Linux新手的书
  9. Android application project 各个文件夹作用
  10. Soap、Http、TCP/IP 三个基本的通讯协议有什么区别?
  11. b丅151组成的充电器电路_宜家LIVBOJ 无线充电器拆解,这设计一目了然
  12. max_workers解释
  13. 高手详解SQL性能优化十条经验
  14. Unity Plastic SCM (无法托管/当前仓库地址错误/创建新项目无法托管/由于目标计算机积极无法连接)
  15. 秒杀系统设计的关键点思考
  16. Ubuntu14.04安装wineqq国际版
  17. 分类模型中准确率、敏感度、特异度的理解
  18. 英语单词记忆(词缀 / 词根)
  19. 研发管理学习笔记1-研发管理的目标是什么
  20. 【阿里Java技术进阶】官方钉群直播大全(持续更新)...

热门文章

  1. 电脑打字手指正确姿势_洞箫的演奏姿势和动作
  2. 作者:胡卫生,博士,上海交通大学教授、博士生导师。
  3. 【Git】Git提交代码到GitHub的基本操作流程
  4. 【VB.NET】VB.NET面向对象技术问题的解答
  5. 初识MongoDB(四)
  6. tp3.2部署在nginx主页正常,其他页面404问题解决方式
  7. mydate97设置时间
  8. Android 一个Activity 里面放置多个 Fragment 实现点击切换的Tab 页面效果
  9. docker~从Dockerfile到Container的过程(终于算是OK了)
  10. 指静脉屏幕说明usart hmi