eslint-plugin-rxjs
eslint-plugin-rxjs copied to clipboard
rxjs-no-unsafe-takeuntil
Hello, could you help me? what am I doing wrong in this situation?
https://github.com/Tinkoff/taiga-ui/blob/main/projects/addon-mobile/directives/ripple/ripple.directive.ts#L103
taiga-ui kit have some code
start$
.pipe(
mergeMap(ripple => {
const animationEndOn$ = typedFromEvent(ripple, 'animationend');
return race(
timer(TOUCH_MOVE_DELAY).pipe(mapTo(false)),
touchEnd$.pipe(mapTo(true)),
).pipe(
take(1),
takeUntil(touchMove$), // here
tap(() => {
renderer.setStyle(
ripple,
'background',
this.tuiRipple || null,
);
renderer.appendChild(nativeElement, ripple);
}),
switchMap(isTap =>
isTap
? animationEndOn$
: race<unknown>(
touchEnd$.pipe(switchMapTo(animationEndOn$)),
animationEndOn$.pipe(switchMapTo(touchEnd$)),
),
),
mapTo(ripple),
);
}),
takeUntil(destroy$),
)
takeUntil(touchMove$)
but this line should not move, however the linter considers it an error, what should I do?
tap
, switchMap
and mapTo
can come before but not after takeUntil
.
A list of what can be after takeUntil
can be found here:
https://github.com/cartant/eslint-plugin-rxjs/blob/main/source/rules/no-unsafe-takeuntil.ts