ngneat / until-destroy

🦊 RxJS operator that unsubscribe from observables on destroy
https://netbasal.com/
MIT License
1.74k stars 100 forks source link

eslint rule to check decorator present #197

Closed tidou44 closed 2 years ago

tidou44 commented 2 years ago

Hello I have been using until-destroy for a few months and I find this library very useful. However, sometimes I use untilDestroyed(this) and forget to add the @until-destroy() decorator, which gives a runtime error. Is there a way (eslint rule for example) to ensure that the decorator is present in all components using until-destroyed(this)?

arturovt commented 2 years ago

Nope, this is not possible. There're many ways of using the decorator. It can decorate a directive that is placed in a different file, a component can extend the directive, and untilDestroyed is used within this component. Considering the ESLint rule, that would've given an error (because AST is available only per file), but the usage is actually correct.