Closed alwonder closed 2 years ago
I think we could make this change without introducing the acceptObjectProperties
option. That is, checking for a call via a member expression would be sensible default behaviour - as calls made via namespaced imports are represented as member expressions.
ATM - i.e. without your change - this wouldn't behave the way it should:
import * as rxjs from "rxjs";
rxjs.of(null)
.pipe(
rxjs.takeUntil(rxjs.NEVER),
rxjs.tap(() => {}),
)
.subscribe(() => {});
So your change is more of a general fix, I think.
Yes, I think you're right. In that case, I'll delete the option.
Your change should be in 4.0.4 - which has just been published.
Great, thanks!
Motivation
I wanted to add the rule for the custom
takeUntilDestroy
operator in our working project. The operator is the method of an angular component, which fires whenngOnDestroy
is called. But I stumbled upon the issue that the rule ignores my method:Solution
I added the new option
acceptObjectProperties
(false
by default) which allows adding not only functions but object properties and class members. So with this config:eslint would highlight the problem method: