-
Notifications
You must be signed in to change notification settings - Fork 1
/
whitespace.js
200 lines (184 loc) · 4.85 KB
/
whitespace.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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
"use strict";
/**
* Rules that enforce whitespace conventions
*/
module.exports = {
rules: {
/**
* Enforces vertical alignment.
*
* @see https://palantir.github.io/tslint/rules/align/
*/
align: {
severity: "default",
options: [
"parameters",
"statements",
"elements",
"members"
]
},
/**
* Enforces UTF-8 file encoding.
*
* @see https://palantir.github.io/tslint/rules/encoding/
*/
encoding: true,
/**
* Ensures the file ends with a newline.
*
* @see https://palantir.github.io/tslint/rules/eofline/
*/
eofline: true,
/**
* Ensures proper spacing between import statement keywords
*
* @see https://palantir.github.io/tslint/rules/import-spacing/
*/
"import-spacing": true,
/**
* Enforces indentation with tabs or spaces.
*
* @see https://palantir.github.io/tslint/rules/indent/
*/
indent: {
severity: "default",
options: ["spaces", 2]
},
/**
* Enforces a consistent linebreak style.
*
* @see https://palantir.github.io/tslint/rules/linebreak-style/
*/
"linebreak-style": {
severity: "default",
options: ["LF"],
},
/**
* Enforces blank line before return when not the only line in the block.
*
* @see https://palantir.github.io/tslint/rules/newline-before-return/
*
* This rule is disabled because a blank line isn't necessary for very short blocks (2 or 3 lines).
* I wish this rule had an option for the number of lines in the block.
*/
"newline-before-return": false,
/**
* Requires that chained method calls be broken apart onto separate lines.
*
* @see https://palantir.github.io/tslint/rules/newline-per-chained-call/
*
* This rule is disabled because simple chains look better on one line.
* (e.g. "name.trim().toLowerCase()")
*/
"newline-per-chained-call": false,
/**
* Disallows one or more blank lines in a row.
*
* @see https://palantir.github.io/tslint/rules/no-consecutive-blank-lines/
*/
"no-consecutive-blank-lines": {
severity: "default",
options: [2]
},
/**
* Disallow irregular whitespace within a file, including strings and comments.
*
* @see https://palantir.github.io/tslint/rules/no-irregular-whitespace/
*/
"no-irregular-whitespace": true,
/**
* Disallows trailing whitespace at the end of a line.
*
* @see https://palantir.github.io/tslint/rules/no-trailing-whitespace/
*/
"no-trailing-whitespace": {
severity: "default",
options: [
"ignore-template-strings",
],
},
/**
* Requires the specified tokens to be on the same line as the expression preceding them.
*
* @see https://palantir.github.io/tslint/rules/one-line/
*/
"one-line": {
severity: "default",
options: [
"check-open-brace",
"check-whitespace"
]
},
/**
* Require or disallow a space before function parenthesis
*
* @see https://palantir.github.io/tslint/rules/space-before-function-paren/
*/
"space-before-function-paren": {
severity: "default",
options: [
{
anonymous: "never",
asyncArrow: "always",
method: "never",
named: "never",
constructor: "never",
}
]
},
/**
* Enforces spaces within parentheses or disallow them. Empty parentheses () are always allowed.
*
* @see https://palantir.github.io/tslint/rules/space-within-parens/
*/
"space-within-parens": {
severity: "default",
options: [0]
},
/**
* Requires or disallows whitespace for type definitions.
*
* @see https://palantir.github.io/tslint/rules/typedef-whitespace/
*/
"typedef-whitespace": {
severity: "default",
options: [
{
"call-signature": "nospace",
"index-signature": "nospace",
parameter: "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
},
{
"call-signature": "onespace",
"index-signature": "onespace",
parameter: "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
]
},
/**
* Enforces whitespace style conventions.
*
* @see https://palantir.github.io/tslint/rules/whitespace/
*/
whitespace: {
severity: "default",
options: [
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-preblock",
"check-type-operator",
"check-rest-spread"
]
},
}
};