-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtslint.js
217 lines (216 loc) · 7.69 KB
/
tslint.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
const path = require("path");
const fs = require("fs");
module.exports = {
extends: [
"tslint:latest",
"tslint-config-standard",
"vrsource-tslint-rules",
"tslint-consistent-codestyle",
"tslint-eslint-rules",
"tslint-microsoft-contrib/latest",
"tslint-sonarts",
"rxjs-tslint-rules",
"tslint-no-unused-expression-chai",
"tslint-config-prettier"
],
rulesDirectory: [
path.join(path.dirname(require.resolve("vrsource-tslint-rules")), "rules"),
path.dirname(require.resolve("rxjs-tslint")),
path.dirname(require.resolve("tslint-microsoft-contrib"))
],
rules: {
//tslint-microsoft-contrib
"underscore-consistent-invocation": [true, {style: "static"}],
"non-literal-fs-path": false,
"no-null-keyword": false,
"prefer-type-cast": true,
"no-angle-bracket-type-assertion": false,
"interface-over-type-literal": false,
"array-type": [true, "array"],
"object-literal-sort-keys": [
true,
"ignore-case",
"locale-compare",
"shorthand-first"
],
//vrsource-tslint-rules
"conditional-expression-parens": true,
"ext-variable-name": [
true,
["class", "pascal"],
["interface", "pascal", {regex: "^I.*$"}],
["parameter", "camel", "allow-leading-underscore"],
["property", "static", "camel", {regex: "^s.*$"}],
["property", "private", "camel", "require-leading-underscore"],
["property", "protected", "camel", "allow-leading-underscore"],
["variable", "local", "snake"],
["variable", "const", "upper"],
["variable", "camel", {regex: "^g.*$"}],
["method", "private", "camel", "require-leading-underscore"],
["method", "protected", "camel", "allow-leading-underscore"],
["function", "camel"],
["default", "camel"]
],
"literal-spacing": [
true,
{
array: ["always"],
object: ["never"],
import: ["always"]
}
],
//tslint-eslint-rules
"no-constant-condition": true,
"no-control-regex": true,
"no-duplicate-case": true,
"no-empty-character-class": true,
"no-ex-assign": true,
"no-extra-boolean-cast": true,
"no-extra-semi": true,
"no-inner-declarations": true,
"no-invalid-regexp": true,
"no-irregular-whitespace": true,
"no-regex-spaces": true,
"no-sparse-arrays": true,
"no-unexpected-multiline": true,
"valid-jsdoc": [true],
"valid-typeof": true,
"no-multi-spaces": true,
"handle-callback-err": true,
"brace-style": true,
"ter-no-proto": true,
"ter-no-script-url": true,
"ter-no-self-compare": true,
"ter-newline-after-var": [true, "always"],
//tslint-consistent-codestyle
"const-parameters": true,
"early-exit": [true, { "ignore-constructor": true }],
"ext-curly": true,
"no-as-type-assertion": true,
"no-accessor-recursion": true,
"no-collapsible-if": true,
"no-else-after-return": [true, "allow-else-if"],
"no-return-undefined": true,
"no-static-this": true,
"no-unnecessary-else": true,
"no-unused": true,
"no-var-before-return": true,
"object-shorthand-properties-first": true,
"parameter-properties": true,
"prefer-const-enum": true,
//rxjs-tslint-rules
"rxjs-no-create": false,
"rxjs-no-do": true,
"rxjs-no-tap": true,
"rxjs-no-unsafe-switchmap": {severity: "error"},
"rxjs-no-internal": true,
"rxjs-ban-observables": {severity: "error"},
"rxjs-no-unsafe-first": true,
"rxjs-collapse-imports": true,
"rxjs-pipeable-operators-only": true,
"rxjs-no-static-observable-methods": true,
"rxjs-proper-imports": true,
"rxjs-prefer-observer": true,
"rxjs-no-nested-subscribe": true,
"rxjs-prefer-async-pipe": true,
"rxjs-no-subclass": { "severity": "error" },
"rxjs-no-ignored-notifier": true,
"rxjs-no-ignored-replay-buffer": true,
"rxjs-no-exposed-subjects": true,
"rxjs-suffix-subjects": true,
"rxjs-no-connectable": true,
"rxjs-no-ignored-observable": true,
"rxjs-no-async-subscribe": true,
"rxjs-no-ignored-subscription": false,
"rxjs-no-explicit-generics": true,
//sonar
"parameters-max-number": [true, 10],
"no-big-function": false,
"no-empty-array": true,
"no-try-promise": true,
"arguments-order": true,
"bool-param-default": false,
"max-switch-cases": true,
"no-alphabetical-sort": true,
"no-nested-switch": true,
"no-useless-catch": true,
"prefer-type-guard": true,
//kushki
"no-unsafe-any": false,
curly: false,
"chai-vague-errors": false,
"variable-name": false,
"no-submodule-imports": false,
"match-default-export-name": false,
"export-name": false,
"no-implicit-dependencies": [
true,
"dev",
['@sendgrid/helpers'].concat(Object.keys(
JSON.parse(
fs
.readFileSync(path.resolve(`${process.cwd()}/tsconfig.json`))
.toString()
).compilerOptions.paths
).map(path => {
const index = path.lastIndexOf("/");
if (index !== -1) return path.substr(0, index);
return path;
}))
],
"no-unnecessary-class": ["allow-empty-class", "allow-static-only"],
"no-void-expression": ["ignore-arrow-function-shorthand"],
"arrow-return-shorthand": [true, "multiline"],
"function-name": false,
"no-suspicious-comment": false,
"file-name-casing": [true, "pascal-case"],
"switch-final-break": [true, "always"],
"prefer-while": true,
"comment-format": [
true,
"check-space",
"check-uppercase",
{"ignore-words": ["istanbul", "prettier-ignore", "jscpd"]}
],
"no-empty": true,
"promise-function-async": true,
"member-ordering": [
true,
{
order: [
"public-static-field",
"public-instance-field",
"private-static-field",
"private-instance-field",
"public-constructor",
"private-constructor",
"public-instance-method",
"protected-instance-method",
"private-instance-method"
]
}
],
"no-import-side-effect": [
true,
{
"ignore-module":
"(string.padstart|string.padend|reflect-metadata|source-map-support/register|@kushki/pidcrypt/(\\w|/)+)$"
}
],
"max-func-body-length": [
true,
{
"func-body-length": 100,
"func-expression-body-length": 10,
"arrow-body-length": 75,
"method-body-length": 150,
"ctor-body-length": 50,
"ignore-comments": true,
"ignore-parameters-to-function-regex":
"^describe|it|beforeEach|afterEach|before|after$"
}
],
"max-union-size": [true, 4],
"no-any": true
}
};