Maybe enable `strict-boolean-expressions`
https://typescript-eslint.io/rules/strict-boolean-expressions
Together with https://github.com/matrix-org/matrix-js-sdk/issues/2120 and https://github.com/matrix-org/matrix-js-sdk/issues/2121, this'd do with all truthiness/falsiness checks, and requires these to be explicitly checked by themselves.
Why?
This would remove truthy/falsy expressions, such as;
let num: number | undefined = 0;
if (num) {
console.log('num is defined');
}
These assertions may be difficult to follow, and also catch a lot more than just nullability; the above branch would never pass, 0 is falsy.
Instead, this lint would enforce the following;
let num: number | undefined = 0;
if (num !== undefined) { // or `!= null`, as `undefined == null`
console.log('num is defined');
}
This would enable a ton more correctness in the code, and help subtle edgecases around falsifiable non-undefined values.