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

False positive prefer-angular-composition with unsubscribe in super class #119

Open
apeeters opened this issue Oct 12, 2020 · 1 comment

Comments

@apeeters
Copy link

apeeters commented Oct 12, 2020

The following code snippet does proper unsubscribe handling in ngOnDestroy but results in a false positive lint error.

@Component({
  selector: "superclass-composed-component",
  template: "<span>{{ value }}</span>"
})
export class SuperclassComposedComponent extends UnsubscribeOnDestroy implements OnInit {
  value: string;
  ngOnInit() {
    this.subscription.add(of("foo").subscribe(value => this.value = value));
  }
}

abstract class UnsubscribeOnDestroy implements OnDestroy {
  subscription = new Subscription();
  ngOnDestroy() {
    this.subscription.unsubscribe();
  }
}
@apeeters apeeters changed the title False positive prefer-angular-composition false positive with unsubscribe in super class False positive prefer-angular-composition with unsubscribe in super class Oct 12, 2020
@cartant
Copy link
Owner

cartant commented Oct 12, 2020

Same response as here: #113 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants