-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.eslintrc.js
68 lines (65 loc) · 2.2 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
59
60
61
62
63
64
65
66
67
68
module.exports = {
root : true,
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:json/recommended",
],
parser : "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
rules : {
"no-undef": "off",
// 建议
"multiline-comment-style": ["error", "starred-block"],
"no-else-return" : "error",
"no-extra-boolean-cast" : "error",
"no-extra-label" : "error",
"no-extra-semi" : "error",
"no-floating-decimal" : "error",
"no-implicit-coercion" : "error",
"no-lonely-if" : "error",
"no-undef-init" : "error",
"no-unused-labels" : "error",
"prefer-arrow-callback" : "error",
"prefer-const" : "error",
"prefer-template" : "error",
curly : "error",
yoda : ["error", "always"],
"dot-notation" : "error",
// 风格
"arrow-parens" : ["error", "as-needed"],
indent : ["error", 4],
"object-curly-newline" : ["error", "always"],
"nonblock-statement-body-position": ["error", "any"],
"no-trailing-spaces" : "error",
"linebreak-style" : [1, "unix"],
"max-statements-per-line" : [
"error",
{
max: 2,
},
],
// 花括号单独一行,可读性更好
"brace-style": [
"error",
"allman",
{
allowSingleLine: true,
},
],
"key-spacing": [
"error",
{
align: "colon",
},
],
"no-multi-spaces" : "error",
semi : "error",
"semi-spacing" : "error",
"space-before-blocks" : "error",
"switch-colon-spacing" : "error",
quotes : ["error", "double"],
"object-property-newline": "error",
"no-var" : "error",
},
};