1+ module . exports = {
2+ "env" : {
3+ "browser" : true ,
4+ "node" : true ,
5+ "commonjs" : true ,
6+ //启用 ES6 语法
7+ "es6" : true
8+ } ,
9+ "root" : true ,
10+ "parser" : "babel-eslint" ,
11+ "parserOptions" : {
12+ //启用 ES6 语法
13+ "ecmaVersion" : 6 ,
14+ "sourceType" : "module"
15+ } ,
16+ "extends" : [ "eslint:recommended" ] ,
17+ "rules" : {
18+ //8个空格缩进
19+ "indent" : [ "off" , 8 , { "SwitchCase" : 1 } ] ,
20+ //禁止不必要的分号
21+ "no-extra-semi" : "warn" ,
22+ //强制使用一致的换行风格
23+ "linebreak-style" : [ "warn" , "windows" ] ,
24+ //if while function 后面的{必须与if在同一行,java风格。
25+ "brace-style" : [ "warn" , "1tbs" , { "allowSingleLine" : true } ] ,
26+ //数组和对象键值对最后一个逗号, never参数:不能带末尾的逗号
27+ "comma-dangle" : [ "error" , "never" ] ,
28+ //不强制规定引号的使用
29+ "quotes" : "off" ,
30+ //强制所有控制语句使用一致的括号风格
31+ "curly" : "warn" ,
32+ //允许有console输出
33+ "no-console" : "off" ,
34+ //禁止多次声明同一变量
35+ "no-redeclare" : "warn" ,
36+ //允许出现未使用过的变量
37+ "no-unused-vars" : "off" ,
38+ //不要求在构造函数中有 super() 的调用
39+ "constructor-super" : "off" ,
40+ //允许在嵌套的块中出现function声明
41+ "no-inner-declarations" : "off" ,
42+ //强制数组方法的回调函数中有 return 语句
43+ "array-callback-return" : "error" ,
44+ //禁用未声明的变量,除非它们在 /*global */ 注释中被提到
45+ "no-undef" : "error" ,
46+ //禁止将标识符定义为受限的名字
47+ "no-shadow-restricted-names" : "error" ,
48+ //允许不必要的转义字符
49+ "no-useless-escape" : "off" ,
50+ //禁止 case 语句落空
51+ "no-fallthrough" : "warn" ,
52+ //禁止直接调用eval()
53+ "no-eval" : [ "error" , { "allowIndirect" : true } ]
54+ } ,
55+ } ;
0 commit comments