-
Notifications
You must be signed in to change notification settings - Fork 2
/
tslint.json
147 lines (147 loc) · 5.66 KB
/
tslint.json
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{
"extends": ["tslint:latest", "tslint-eslint-rules"],
"linterOptions": {
"exclude": [
"node_modules",
"*.d.ts"
]
},
"rules": {
"adjacent-overload-signatures": true,
"align": [true, "members", "parameters", "statements"],
"array-bracket-spacing": [true, "never", {"singleValue": false, "objectsInArrays": true, "arraysInArrays": true} ], // 设置在括号内使用空格风格
"arrow-parens": [true, "ban-single-arg-parens"],
"await-promise": [true, "Thenable"], // Warns for an awaited value that is not a Promise.
"ban-comma-operator": true,
"block-spacing": [true, "always"], // 强制在单行代码块中使用一致的空格
"brace-style": [true, "stroustrup", { "allowSingleLine": true }], // 大括号风格要求
"comment-format": [true, "check-space", {"ignore-words": ["-", "+"]}], // 强制在注释中 // 或 /* 使用一致的空格
"curly": [true, "ignore-same-line"], // 要求遵循大括号约定
"eofline": true,
"forin": false,
"import-blacklist": [
true
],
"indent": [true, "spaces", 2],
"interface-name": [ true, "never-prefix" ],
"linebreak-style": [true , "LF" ],
"max-classes-per-file": [ true, 10 ],
"max-line-length": [true, 120],
"member-access": [ false ],
"member-ordering": [true, {"order": [
"public-static-field",
"protected-static-field",
"private-static-field",
"public-instance-field",
"protected-instance-field",
"private-instance-field",
"public-constructor",
"public-instance-method",
"protected-instance-method",
"private-instance-method"
]}],
"no-arg": true,
"no-angle-bracket-type-assertion": false,
"no-consecutive-blank-lines": [true, 4], // 多个空行控制
"no-console": [ true, "dir", "log", "warn" ],
"no-construct": true, // 禁止对 String,Number 和 Boolean 使用 new 操作符
"no-control-regex": true,
"no-duplicate-variable": true,
"no-duplicate-imports": true, // 禁止单个模块多次导入
"no-duplicate-switch-case": true,
"no-empty": false, // 禁止空块语句
"no-extra-semi": true,
"no-eval": true,
"no-implicit-dependencies": [true, "dev"],
"no-multi-spaces": [ true, { "exceptions": { "PropertyAssignment": true, "VariableDeclaration": false } } ] , // 禁止出现多个空格
"no-object-literal-type-assertion": false,
"no-parameter-reassignment": false, // 禁止参数变量重新赋值
"no-return-await": true,
"no-reference": true, // Disallows /// <reference path=> imports (use ES6-style imports instead).
"no-shadowed-variable": [
true,
{
"class": true,
"enum": true,
"function": true,
"interface": true,
"namespace": true,
"typeAlias": true,
"typeParameter": true
}
],
"no-string-throw": true,
"no-submodule-imports": [true,
"rxjs",
"@angular/platform-browser",
"source-map-support/register"
],
"no-this-assignment": [true, {"allowed-names": ["^self$"], "allow-destructuring": true}],
"no-trailing-whitespace": [true, "ignore-comments"], // 禁用行尾空白
"no-unnecessary-initializer": true, // 禁止变量赋值为 undefined
"no-unused-expression": [true, "allow-fast-null-checks"],
"no-unnecessary-type-assertion": false,
"no-use-before-declare": true, // 禁止在变量定义之前使用它们
"no-var-keyword": true, // 要求使用 let 或 const 而不是 var
"no-var-requires": true, // Disallows the use of require statements except in import statements.
"object-curly-spacing": [true, "always"], // 强制在大括号中使用一致的空格
"object-literal-shorthand": [true],
"object-literal-sort-keys": false,
"one-line": [true, "check-open-brace", "check-whitespace"],
"ordered-imports": [
true,
{
"grouped-imports": true,
"import-sources-order": "lowercase-last",
"named-imports-order": "lowercase-first"
}
],
"prefer-for-of": true,
"quotemark": [true, "single", "avoid-escape", "avoid-template"],
"radix": true,
"semicolon": [true, "never"],
"space-before-function-paren": [
true,
{"anonymous": "never", "named": "never"}
],
"ter-arrow-spacing": [true, { "before": true, "after": true }], // 要求箭头函数的箭头之前或之后有空格
"ter-func-call-spacing": [true, "never"], // disallow spacing between function identifiers and their invocations
"ter-indent": [true, 2,
{
"SwitchCase": 1
}
],
"ter-no-irregular-whitespace": true, // 禁止不规则的空白
"trailing-comma": [true,
{
"multiline": {
"arrays": "always",
"exports": "always",
"imports": "always",
"functions": "always",
"objects": "always",
"typeLiterals": "always"
},
"singleline": "never",
"esSpecCompliant": true
}
], // 当最后一个元素或属性与闭括号 ] 或 右大括号 在 不同的行时,要求使用拖尾逗号;当在 同一行时,禁止使用拖尾逗号
"triple-equals": true,
"use-isnan": true, // 要求使用 isNaN() 检查 NaN
"valid-typeof": true, // 强制 typeof 表达式与有效的字符串进行比较
"variable-name": [true, "ban-keywords", "allow-leading-underscore"],
"whitespace": {
"options": [true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-rest-spread",
"check-type",
"check-typecast",
"check-type-operator",
"check-preblock"]
}
}
}