vue-cli3关闭eslint语法检测

  1. 在项目根目录创建vue.config.js文件。
module.exports = {
  lintOnSave: false,
  devServer: {
      overlay: {
          warning: false,
          errors: false
      }
  }
}


eslint常见报错:


  1. 文件末尾存在空行(eol-last):Too many blank lines at the end of file.Max of 0 allowed

  2. 缺少分号(‘semi’: [‘error’,’always’]) :Missing semicolon

  3. 函数关键字后面缺少空格 :Missing space before function parentheses

  4. 字符串没有使用单引号(’quotes’: [1, ’single’]) :String must use singlequote

  5. 缩进错误 : Expected indentation of 2 spaces but found 4

  6. 没有使用全等(eqeqeq) : Expected ’ === ’ and instaed saw ‘==’

  7. 导入组件却没有使用 : ‘seller’ is defined but never used

  8. new了一个对象却没有赋值给某个常量(可以在该实例前添加此代码/eslint-disable

  9. no-new/忽略ESLint的检查): Do not user’new’ for side effects

  10. 超过一行空白行(no-multiple-empty-lines):More than 1 blank line not allowed

  11. 注释符 // 后面缩进错误(lines-around-comment): Expected space or tab after
    ‘//’ in comment

  12. 模块导入没有放在顶部:Import in body of module; reorder to top

  13. 前面缺少空格:Missing space before

  14. 已定义但是没有使用:‘scope’ is defined but never used


**************************************************************************************************************************************




规则的含义:


“off” or 0 - 关闭(禁用)规则 
“warn” or 1 - 将规则视为一个警告(并不会导致检查不通过) 
“error” or 2 - 将规则视为一个错误 (退出码为1,检查不通过) 


常用规则: 
Possible Errors 可能的错误或逻辑错误 
no-cond-assign 禁止条件表达式中出现模棱两可的赋值操作符 
no-console 禁用console 
no-constant-condition 禁止在条件中使用常量表达式 
no-debugger 禁用 debugger 
no-dupe-args 禁止 function 定义中出现重名参数 
no-dupe-keys 禁止对象字面量中出现重复的 key 
no-duplicate-case 禁止出现重复的 case 标签 
no-empty 禁止出现空语句块 
no-ex-assign 禁止对 catch 子句的参数重新赋值 
no-extra-boolean-cast 禁止不必要的布尔转换 
no-extra-parens 禁止不必要的括号 
no-extra-semi 禁止不必要的分号 
no-func-assign 禁止对 function 声明重新赋值 
no-inner-declarations 禁止在嵌套的块中出现变量声明或 function 声明 
no-irregular-whitespace 禁止在字符串和注释之外不规则的空白 
no-obj-calls 禁止把全局对象作为函数调用 
no-sparse-arrays 禁用稀疏数组 
no-prototype-builtins 禁止直接使用Object.prototypes 的内置属性 
no-unexpected-multiline 禁止出现令人困惑的多行表达式 
no-unreachable 禁止在return、throw、continue 和 break语句之后出现不可达代码 
use-isnan 要求使用 isNaN() 检查 NaN 
valid-typeof 强制 typeof 表达式与有效的字符串进行比较 


 

转:https://blog.csdn.net/wron_path/article/details/104655844

转:https://blog.csdn.net/weixin_33831196/article/details/86030209?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-2.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-2.control

原文地址:https://www.cnblogs.com/ygyy/p/14206801.html