Skip to content
This repository was archived by the owner on Dec 4, 2022. It is now read-only.

Commit 0bb6412

Browse files
authored
feat(core): update rules tslint@5.18.0 (#50)
1 parent 0f96d95 commit 0bb6412

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ If you have questions, comments or suggestions, just create an issue on this rep
3030
these rules with new insights, experiences and remarks in alignment with the updates on [TSLint] and [codelyzer].
3131

3232
**Note**: The following set of rules depend on:
33-
- [TSLint] v5.17.0
33+
- [TSLint] v5.18.0
3434
- [codelyzer] v5.0.0
3535

3636
## Table of contents:
@@ -138,7 +138,12 @@ A sample configuration is shown below, where `tslint.json` lives adjacent to you
138138

139139
- Member **overloads** should be **consecutive**.
140140
```json
141-
"adjacent-overload-signatures": true
141+
"adjacent-overload-signatures": [
142+
true,
143+
{
144+
"ignore-accessors": true,
145+
}
146+
]
142147
```
143148

144149
- *Always prefer* **unifying any two overloads** into one, by using a **union** or an **optional/rest parameter**.
@@ -295,6 +300,11 @@ them is allowed by TypeScript*).
295300
"await-promise": true
296301
```
297302

303+
- Functions marked **`async`** must contain an **`await`** or **`return`** statement
304+
```json
305+
"no-async-without-await": true
306+
```
307+
298308
- *Do not use* the **unnecessary** **`return await`**.
299309
```json
300310
"no-return-await": true
@@ -517,6 +527,17 @@ them is allowed by TypeScript*).
517527
]
518528
```
519529

530+
- Using **comparison operators** (`>`, `>=`, `<=`, `<`) to compare *non-numbers* should be **avoided**.
531+
```json
532+
"strict-comparisons": [
533+
true,
534+
{
535+
"allow-object-equal-comparison": true,
536+
"allow-string-order-comparison": false
537+
}
538+
]
539+
```
540+
520541
- *Always prefer* explicit **`+= 1`** and **`-= 1`** *pre-unary* **operators** over **`++i`** and **`--i`**.
521542
```json
522543
"increment-decrement": [

tslint.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
"variables-before-functions"
1818
],
1919
"prefer-readonly": true,
20-
"adjacent-overload-signatures": true,
20+
"adjacent-overload-signatures": [
21+
true,
22+
{
23+
"ignore-accessors": true
24+
}
25+
],
2126
"unified-signatures": true,
2227
"prefer-function-over-method": [
2328
true,
@@ -57,6 +62,7 @@
5762
"unnecessary-bind": true,
5863
"promise-function-async": true,
5964
"await-promise": true,
65+
"no-async-without-await": true,
6066
"no-return-await": true,
6167
"no-floating-promises": true,
6268
"prefer-const": true,
@@ -137,6 +143,13 @@
137143
true,
138144
"allow-null-check"
139145
],
146+
"strict-comparisons": [
147+
true,
148+
{
149+
"allow-object-equal-comparison": true,
150+
"allow-string-order-comparison": false
151+
}
152+
],
140153
"increment-decrement": [
141154
true,
142155
"allow-post"
@@ -158,7 +171,7 @@
158171
{
159172
"allow-else-if": true
160173
}
161-
]
174+
],
162175
"strict-boolean-expressions": [
163176
true,
164177
"allow-undefined-union",

0 commit comments

Comments
 (0)