mirror of
https://github.com/vector-im/element-web.git
synced 2026-01-08 10:01:50 +01:00
Remove the code style rule about casts to bool
This commit is contained in:
parent
29bd206f85
commit
67401eeb27
@ -113,17 +113,6 @@ Unless otherwise specified, the following applies to all code:
|
||||
}
|
||||
```
|
||||
|
||||
14. Explicitly cast to a boolean, rather than relying on implicit truthiness of non-boolean values:
|
||||
|
||||
```typescript
|
||||
const isRealUser = !!userId && ...;
|
||||
// ... or ...
|
||||
const isRealUser = Boolean(userId) && ...;
|
||||
|
||||
// but *not*:
|
||||
const isRealUser = userId && ...; // invalid implicit cast
|
||||
```
|
||||
|
||||
15. Use `switch` statements when checking against more than a few enum-like values.
|
||||
16. Use `const` for constants, `let` for mutability.
|
||||
17. Describe types exhaustively (ensure noImplictAny would pass).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user