Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for untilDestroyed alias in rxjs-no-unsafe-takeuntil #112

Closed
shaungrady opened this issue Dec 22, 2019 · 8 comments
Closed

Support for untilDestroyed alias in rxjs-no-unsafe-takeuntil #112

shaungrady opened this issue Dec 22, 2019 · 8 comments

Comments

@shaungrady
Copy link

The untilDestroy library is a fairly popular and convenient way of implementing the takeUntil unsubscription pattern for the Angular component lifecycle with minimal effort.

It would be nice to leverage the rxjs-no-unsafe-takeuntil rule with the untilDestroyed operator.

@shaungrady shaungrady changed the title Support for takeUntil alias in rxjs-no-unsafe-takeuntil Support for untilDestroyed alias in rxjs-no-unsafe-takeuntil Dec 22, 2019
@cartant
Copy link
Owner

cartant commented Dec 22, 2019

That sounds like a reasonable request. It should be pretty easy to implement. I've added it to my list of things to do over the next few days.

@cartant
Copy link
Owner

cartant commented Dec 22, 2019

Published in 4.28.0.

@cartant cartant closed this as completed Dec 22, 2019
@shaungrady
Copy link
Author

Thanks for the quick implementation @cartant! 🍺

@spitfjre
Copy link

spitfjre commented Mar 3, 2020

@shaungrady Did you test this?

Because after following the documentation, this does still get ingored:

{
	"extends": ["@mysvg/tslint-config", "rxjs-tslint-rules"],
	"rules": {
		"rxjs-no-unsafe-takeuntil": {
			"options": [{ "alias": ["untilDestroyed"] }],
			"severity": "error"
		},
		"rxjs-prefer-angular-takeuntil": {
			"options": [{ "alias": ["untilDestroyed"] }],
			"severity": "error"
		}
	}
}

@shaungrady
Copy link
Author

@spitfjre No, I lost track of this during the holidays… @cartant it appears that the alias functionality doesn't work correctly.

@cartant
Copy link
Owner

cartant commented Mar 3, 2020

doesn't work correctly

What does this mean? In the context of this test, which, AFAICT, passes:

https://github.com/cartant/rxjs-tslint-rules/tree/master/test/v6/fixtures/no-unsafe-takeuntil/alias

@shaungrady
Copy link
Author

Ahh, I apologize. @spitfjre the problem is that rxjs-prefer-angular-takeuntil doesn't support aliases like rxjs-no-unsafe-takeuntil does, so untilDestroyed subscriptions will always fail the rxjs-prefer-angular-takeuntil rule.

@cartant
Copy link
Owner

cartant commented Mar 4, 2020

This sounds like a separate issue. Again, I find myself pointing out that commenting on closed issues is something to be discouraged.

Save others' time and open a new issue with a minimal reproduction and reference the issue upon which you would have otherwise commented.

Repository owner locked as resolved and limited conversation to collaborators Mar 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants