jshint常用检查规则

curly: true/false
参数为true时 循环和条件语句必须放在{}中 /默认false

eqeqeq: true/false
参数为true时 在比较时必须使用===和!== /默认为true

forin: true/false
参数为true时 不允许forin在没有hasOwnProperty时使用 /默认为false

immed:true/false
参数为true时 不允许匿名函数立即执行,即匿名函数必须用()括起来

(function() {
   // body 
}());

默认为flase

newcap: true/false
参数为true时 构造函数首字母必须大写/默认为false

noempty: true/false
参数为true时 不允许使用空函数

undef:true/false
参数为true时 所有局部变量必须先声明后才能使用

unused: true/false
参数为ture时 不允许变量声明后不使用

asi:true/false
参数为true时 语句结束不能缺失/默认为true

boss: true/false
参数为true时 允许在for/if/while中使用“=”赋值操作

evil:true/false
参数为true时 允许使用eval方法

eqnull: true/false
参数为true时 允许使用==null

quotmark: true/false/single/double
true:检查一致性
false:不检查
single:必须全是单引号
double:必须全是双引号

freeze: true/false
参数为true时 不允许复写原生对象的原型/默认为false

trailing: true/false
参数为true时 不允许行尾空格/默认为false

funcscope: true/false
参数为true时 允许在控制体内定义变量而在外部使用/默认为true

function test() {
    if (true) {
        var x = 0;
    }

    x += 1; 
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值