mightyiam/eslint-config-love

Safety of calling unbound methods

Opened this issue · 2 comments

Apparently, TypeScript, even in strict mode, couldn't care less about the type of this while calling an unbound method.

The only way to enforce such safety is to enforce declaration of this in functions where this is used.

And yet, I don't see such a rule in typescript-eslint.

Another option is the [unbound-method](https://typescript-eslint.io/rules/unbound-method) lint rule. But it doesn't allow having unbound methods, which could be valid, albeit somewhat strange.

We have follow-up discussion on discord for no-unsafe-* check

And that would require also modification in unbound-method rule to exclude this: <with type>