eshint的配置


{
    "strict"   : "implied", //文件里面使用"use strict"
    "undef"    : true,  //查找未定义变量
    "unused"   : "vars",  //禁止定义变量不使用
    "latedef"  : "nofunc", //变量定义前禁止使用
    "newcap"   : true, //首字母大写的函数(类),强制使用new
    "nonbsp"   : true, //禁止"non-breaking whitespace"
    "boss"     : false, //不允许if, for, while语句中使用赋值
    "forin"    : true, //要求所有 for in循环过滤对象的item
    "nonew"    : true, //禁止使用构造器
    "sub"      : true, //允许中括号形式访问属性
    "bitwise"  : true, //禁止位运算符
    "curly"    : true, //循环或者条件语句必须使用花括号包围
    "noarg"    : true, //禁止使用这个选项 arguments.caller和 arguments.callee
    "nocomma"  : false, //允许使用逗号操作符
    "notypeof" : true, //检查无效 typeof操作符的值
    "lastsemic": true, //检查一行代码最后声明后面的分号是否遗漏
    "validthis": true, //在非构造器函数中使用 this
    "withstmt" : true, //检查with使用声明
    "shadow"   : true, //"inner" 只检查是否在相同的作用域重复定义;"outer" 检查外部作用域;false 与inne一样;true 允许变量覆盖
    "expr"     : true, //允许应该出现赋值或函数调用的地方使用表达式
    
    "camelcase": true, //驼峰命名
    "asi"      : false, //不允许缺失分号
    "debug"    : false, //不允许debugger
    "evil"     : true, //禁止使用eval
    "loopfunc" : true, //禁止内部循环
    "freeze"   : true, //禁止复写原生对象

    "eqeqeq"   : true, //使用===和!==
    "laxbreak" : true, //换行

    "nonstandard"  : true, //非标准但广泛采用的全局变量,如escape,unescape等
    "quotmark"     : "single", //只能使用单引号
    //"-W041"      : false,
    "funcscope"    : true, //禁止从外部访问内部声明的变量
    "trailing"     : true, //禁止行尾空格
    "smarttabs"    : false, //不允许混合tab和space排版
    "maxparams"    : 6, //这个选项允许您设置每个函数的形参最大数量
    "maxdepth"     : 9, //设置代码最大嵌套深度
    "maxstatements": 60, //设置语句允许的最大声明数

    "node"         : true,
    "browser"      : true,
    "jquery"       : true,

    "esversion"    : 6,

    "globals"  : {
        "resizeImg": true,
        "loadingImg": true,
        "resizeParent": true,
        "changeMoneyFormat": true,
        "changePhoneFormat": true,
        "format_number": true,
        "format_money": true,
        "changeDistanceFormat": true,
        "viewport": true
    }      
}

原文地址:https://www.cnblogs.com/lakeInHeart/p/7615814.html