Skip to content

[use-lifecycle-interface] False positive when class extends class which implements lifecycle interface #866

@amitbeck

Description

@amitbeck

Description and reproduction of the issue

{
  "extends": [
    "plugin:@angular-eslint/recommended"
  ],
  "plugins": ["@typescript-eslint", "@angular-eslint"],
}
// your repro code case
@Directive()
export class FoobarBase implements OnDestroy {
  // ...

  ngOnDestroy(): void {
    /* some base logic here */
  }
}

@Component({...})
export class FoobarComponent extends FoobarBase {
  // ...

  ngOnDestroy(): void { // doesn't work with `override` neither
    super.ngOnDestroy();

    /* some concrete logic here */
  }
}

Versions

package version
@angular-eslint/eslint-plugin 12.7.0
@typescript-eslint/parser 4.28.5
ESLint 7.26.0
node 16.13.1
# Please run `npx ng version` in your project and paste the full output here:

Angular CLI: 12.2.13
Node: 16.13.1 (Unsupported)
Package Manager: npm 8.1.2
OS: darwin x64

Angular: 12.2.13
... animations, cdk, cdk-experimental, cli, common, compiler
... compiler-cli, core, forms, language-service, localize
... material, platform-browser, platform-browser-dynamic, router
... service-worker, upgrade

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.13
@angular-devkit/build-angular   12.2.13
@angular-devkit/core            12.2.13
@angular-devkit/schematics      12.2.13
@schematics/angular             12.2.13
rxjs                            6.5.5
typescript                      4.3.5
    
Warning: The current version of Node (16.13.1) is not supported by Angular.
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest supported version of the packages and checked my ng version output per the instructions given here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-pluginAngular-specific TypeScript rulestriageThis issue needs to be looked at and categorized by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions