【eslint】规则配置解析

以下规则转载自:http://www.cnblogs.com/nklong/p/7233631.html

“no-alert”: 0,//禁止使用alert confirm prompt

“no-array-constructor”: 2,//禁止使用数组构造器

“no-bitwise”: 0,//禁止使用按位运算符

“no-caller”: 1,//禁止使用arguments.caller或arguments.callee

“no-catch-shadow”: 2,//禁止catch子句参数与外部作用域变量同名

“no-class-assign”: 2,//禁止给类赋值

“no-cond-assign”: 2,//禁止在条件表达式中使用赋值语句

“no-console”: 2,//禁止使用console

“no-const-assign”: 2,//禁止修改const声明的变量

“no-constant-condition”: 2,//禁止在条件中使用常量表达式 if(true) if(1)

“no-continue”: 0,//禁止使用continue

“no-control-regex”: 2,//禁止在正则表达式中使用控制字符

“no-debugger”: 2,//禁止使用debugger

“no-delete-var”: 2,//不能对var声明的变量使用delete操作符

“no-div-regex”: 1,//不能使用看起来像除法的正则表达式/=foo/

“no-dupe-keys”: 2,//在创建对象字面量时不允许键重复 {a:1,a:1}

“no-dupe-args”: 2,//函数参数不能重复

“no-duplicate-case”: 2,//switch中的case标签不能重复

“no-else-return”: 2,//如果if语句里面有return,后面不能跟else语句

“no-empty”: 2,//块语句中的内容不能为空
“no-implicit-coercion”: 1,//禁止隐式转换

“no-implied-eval”: 2,//禁止使用隐式eval

“no-inline-comments”: 0,//禁止行内备注

“no-inner-declarations”: [2, “functions”],//禁止在块语句中使用声明(变量或函数)

“no-invalid-regexp”: 2,//禁止无效的正则表达式

“no-invalid-this”: 2,//禁止无效的this,只能用在构造器,类,对象字面量

“no-irregular-whitespace”: 2,//不能有不规则的空格

“no-iterator”: 2,//禁止使用iterator 属性

“no-label-var”: 2,//label名不能与var声明的变量名相同

“no-labels”: 2,//禁止标签声明

“no-lone-blocks”: 2,//禁止不必要的嵌套块

“no-lonely-if”: 2,//禁止else语句内只有if语句

“no-loop-func”: 1,//禁止在循环中使用函数(如果没有引用外部变量不形成闭包就可以)
“no-mixed-requires”: [0, false],//声明时不能混用声明类型

“no-mixed-spaces-and-tabs”: [2, false],//禁止混用tab和空格

“linebreak-style”: [0, “windows”],//换行风格

“no-multi-spaces”: 1,//不能用多余的空格

“no-multi-str”: 2,//字符串不能用\换行

“no-multiple-empty-lines”: [1, {“max”: 2}],//空行最多不能超过2行

“no-native-reassign”: 2,//不能重写native对象

“no-negated-in-lhs”: 2,//in 操作符的左边不能有!

“no-nested-ternary”: 0,//禁止使用嵌套的三目运算

“no-new”: 1,//禁止在使用new构造一个实例后不赋值

“no-new-func”: 1,//禁止使用new Function

“no-new-object”: 2,//禁止使用new Object()

“no-new-require”: 2,//禁止使用new require
“no-ternary”: 0,//禁止使用三目运算符

“no-trailing-spaces”: 1,//一行结束后面不要有空格

“no-this-before-super”: 0,//在调用super()之前不能使用this或super

“no-throw-literal”: 2,//禁止抛出字面量错误 throw “error”;

“no-undef”: 1,//不能有未定义的变量

“no-undef-init”: 2,//变量初始化时不能直接给它赋值为undefined

“no-undefined”: 2,//不能使用undefined

“no-unexpected-multiline”: 2,//避免多行表达式

“no-underscore-dangle”: 1,//标识符不能以_开头或结尾

“no-unneeded-ternary”: 2,//禁止不必要的嵌套 var isYes = answer === 1 ? true : false;

“no-unreachable”: 2,//不能有无法执行的代码

“no-unused-expressions”: 2,//禁止无用的表达式

“no-unused-vars”: [2, {“vars”: “all”, “args”: “after-used”}],//不能有声明后未被使用的变量或参数
“object-shorthand”: 0,//强制对象字面量缩写语法

“one-var”: 1,//连续声明

“operator-assignment”: [0, “always”],//赋值运算符 += -=什么的

“operator-linebreak”: [2, “after”],//换行时运算符在行尾还是行首

“padded-blocks”: 0,//块语句内行首行尾是否要空行

“prefer-const”: 0,//首选const

“prefer-spread”: 0,//首选展开运算

“prefer-reflect”: 0,//首选Reflect的方法

“quotes”: [1, “single”],//引号类型 “ “” ”

“quote-props”:[2, “always”],//对象字面量中的属性名是否强制双引号

“radix”: 2,//parseInt必须指定第二个参数

“id-match”: 0,//命名检测

“require-yield”: 0,//生成器函数必须有yield

你可能感兴趣的:(【eslint】规则配置解析)