cartant / rxjs-tslint-rules

TSLint rules for RxJS
https://cartant.github.io/rxjs-tslint-rules/
MIT License
371 stars 22 forks source link

Whitelist class property in rxjs-finnish based on decorator #111

Closed klemenoslaj closed 4 years ago

klemenoslaj commented 4 years ago

Currently we have a whitelist of rxjs-finnish rule based on names and types. I wonder if it would be possible to whitelist a class property based on the presence of a decorator?

Use case: In Angular some fields are decorated with @Output and it would be super strange for these fields to have $ suffix.

cartant commented 4 years ago

My understanding was that @Output properties have the EventEmitter type, so the type-based whitelist should suffice. Is that not the case?

klemenoslaj commented 4 years ago

My understanding was that @Output properties have the EventEmitter type, so the type-based whitelist should suffice. Is that not the case?

That is true and while not considered best practice I saw often people use Subject or a piped Observable as an output. In this case we cannot limit to the type.

I actually use it sometimes, because it makes my code a bit cleaner.

cartant commented 4 years ago

I'm not keen on encouraging or supporting something that's not best practice, so no, I'm not inclined to extend the rule's options in this way.

Anyone who has a problem with this can use a TSLint comment to ignore that line, etc.

https://palantir.github.io/tslint/usage/rule-flags/