I've read the tslint rules here and while it looks like the typedef rule's call-signature
option is what I want, it doesn't complain about the lack of a return type.
Anyone know the rule (f one exists) to enforce return types on class methods?
TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.
no-empty-interface - Forbids empty interfaces. no-for-in - Ban the usage of for…in statements. no-import-side-effect - Avoid import statements with side-effect. TS Only Has Fixer. no-inferrable-types - Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.
You can suppress TSLint rules for the current file and even for the current line. WebStorm automatically generates disable comments in the format /* tslint:disable:<rule name> or // tslint:disable-next-line:<rule name> and places them on top of the file or above the current line respectively.
Turns out this can be done via:
"typedef": [ true, "call-signature", "property-declaration" ]
More info: https://palantir.github.io/tslint/rules/typedef/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With