/
.eslintrc.js
58 lines (58 loc) · 1.66 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// https://eslint.org/docs/rules/
module.exports = {
"env": {
"browser": true,
// "es6": true, // 自动启动新的es6全局变量
"node": true
},
"extends": "eslint:recommended", // 启用推荐的规则
// "extends": "standard",
"parserOptions": {
"ecmaVersion": 2015, // 支持的ecmascript版本 6/2015, 不自动启动新的es6全局变量
"sourceType": "module",
// "ecmaFeatures": {
// "jsx": true
// } // 启用支持jsx
},
"rules": {
// 缩进
"indent": [
"error", 4
],
"linebreak-style": [ // 强制使用一致的换行风格
"error",
// "windows" // 强制使用windows换行符 \r\n
],
// 引号
"quotes": [
1,
"single"
],
// 分号结尾
"semi": [
"error",
"always"
],
"no-unused-vars": [2, {
// 允许声明未使用变量
"vars": "local",
// 参数不检查
"args": "none"
}],
// 最大空行100
"no-multiple-empty-lines": [0, { "max": 100 }],
"no-mixed-spaces-and-tabs": [0],
//不能使用console
"no-console": 'off',
//未定义变量不能使用: 0/off 关闭 1 提示 2报错
"no-undef": 0,
//一行结束后面不要有空格
"no-trailing-spaces": 1,
//强制驼峰法命名
"camelcase": 2,
//对象字面量项尾不能有逗号
"comma-dangle": [2, "never"],
//this别名
"consistent-this": [2, "that"],
}
};