报错背景

ESLint格式太严谨,老是报错 !

解决方案:

让ESLint自动纠正格式

1、安装ESLint

2、安装vetur

3、package.json里面有eslint配置参数

4、.eslintrc.js文件配置如下

module.exports = {root: true,parser: 'babel-eslint',parserOptions: {sourceType: 'module',"allowImportExportEverywhere": true  //ignore eslint error: 'import' and 'export' may only appear at the top level},env: {browser: true,node: true,es6: true,},extends: 'eslint:recommended',// required to lint *.vue filesplugins: ['html','vue'],// add your custom rules here//it is base on https://github.com/vuejs/eslint-config-vue'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': 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']}
}

5、设置vscode配置文件自动纠错

window电脑:文件 > 首选项 > 设置   点击右上角的{}

出现setting.json文件

{"[typescript]": {"editor.formatOnSave": true,"editor.formatOnPaste": true},"[markdown]": {"editor.formatOnSave": true,"editor.wordWrap": "on","editor.renderWhitespace": "all","editor.acceptSuggestionOnEnter": "off"},"editor.fontSize": 18}

vscode ESLint格式不正确老是报错 more than 1 blank line not allowed相关推荐

  1. python读取csv文件路径正确但报错FileNotFoundError: [Errno 2] No such file or directory

    项目场景: python读取csv文件路径正确但报错FileNotFoundError: [Errno 2] No such file or directory 问题描述: #储存调用表格.数据 #调 ...

  2. 【报错笔记】做struts项目建立jsp文件老是报错

    做struts项目建立jsp文件老是报错,所有项目都一样. 报错原因: 没有导入apache tomcat 解决方法: 点击项目名右键Build Path-Configure Build Path-A ...

  3. eslint检测node 内部模块报错解决方案

    如上图所示,eslint检测node 内部模块报错解决, 解决方案: 代码: module.exports = {"env": {"browser": true ...

  4. 多Kinect下WaitNoneUpdateAll老是报错,烦躁……

    多Kinect下WaitNoneUpdateAll老是报错,烦躁-- 有谁在做多Kinect的啊?我的参考资料如下: http://viml.nchc.org.tw/blog/paper_info.p ...

  5. 解决VScode安装Babel转码器报错:无法将“cnpm“项识别为cmdlet\函数、脚本文件或可运行程序的名称的问题

    解决VScode安装Babel转码器报错:无法将"cnpm"项识别为cmdlet\函数.脚本文件或可运行程序的名称的问题 报错结果如下: 解决方案 第一步:安装npm 点我安装np ...

  6. Mysql存储过程老是报错_mysql中看看这个存储过程老是报错,该如何处理

    mysql中看看这个存储过程老是报错 我的mysql版本是5.5.21的,下面这个存储过程是需要更加另外3张表的数据来更新strategycontracttemp中数据,但是每次更新到中途报错,先代码 ...

  7. pydicom读取头文件_pydicom读取压缩格式的DICOM图像报错的解决方案

    本文由Markdown语法编辑器编辑完成. 前言: 已知用pydicom读取一类Dicom图像时会报错,报错信息大致如下: OSError: cannot identify image file &l ...

  8. 植物大战僵尸老是报错不能运行如何解决

    植物大战僵尸老是报错不能运行如何解决 方法1 将系统默认输入法修改为ENG 点击左下角开始,点击设置,时间和语言,语言,添加首选语言,添加英语(美国) 接下来,将系统输入法更改为ENG,即任务栏右下角 ...

  9. 解决在eclipse中打开.yml文件老是报错的问题(粗暴有效)

    在eclipse中打开.yml文件老是报错 我在eclipse是装过eclipse的springboot插件的,可以支持yml文件, 但是有一点不舒服的地方在于,每次打开yml文件的时候编辑器就会报错 ...

最新文章

  1. 【iOS】控件截图、MP4格式视频流和m3u8格式视频流截取某一帧功能的实现
  2. 给新创建的用户 赋予所有的权利 *.* 查看权限 删除用户 ---------DCL用户权限管理篇...
  3. 【mycat】读写分离
  4. stl.map使用总结
  5. 列了一些自己会但是不怎么精通的编程语言和知识,做个记录,空余时间加强学习...
  6. abap--关于异常的处理
  7. 从Zero到Hero,OpenAI重磅发布深度强化学习资源
  8. 耗时6年的DK博物科普巨著,全面提升孩子的认知高度
  9. ODB——基于c++的ORM映射框架尝试(安装)
  10. 信号量、使用信号量来完成读写模型(消费者生产者模型)线程池、读写锁面试题
  11. 两个常用的Infopath Service读取域值的函数
  12. android sharedpreference 清空,Android 从SharedPreferences中存储,检索,删除和清除数据...
  13. Form的显式方式。
  14. 2014-07-22 如何成为一名合格的职业人士
  15. 轴承后缀ce和ca_轴承cc和ca与cde4有什么区别
  16. NAS存储文件权限的设置方法
  17. CrawlSpider实现微信小程序社区爬虫【python爬虫入门进阶】(18)
  18. 感性VS理性-处世之道
  19. 气液增压缸用于风扇叶铆钉铆接(产品试压)
  20. 2015小米校招技术类笔试题

热门文章

  1. 解决英伟达Jetson平台使用Python时的出现“Illegal instruction(cpre dumped)”错误
  2. Unity3D GoldMiner--GameOver
  3. WPS首行设置内容筛选
  4. app实现热更新codepush
  5. 二〇二三-三-十七——反射
  6. 免疫性属于计算机病毒特征码,基于免疫和代码重定位的计算机病毒特征码提取与检测方法.doc...
  7. 《加勒比海盗》中的一句话...
  8. 数学分析闭区间套定理_什么是区间套定理?
  9. windows10无法启动承载网络
  10. jQuery Validate 自定义校验手机号