Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[@angular-eslint/use-lifecycle-interface] doesn't correctly analyze overloaded lifecycle methods #1426

Closed
@usarskyy

Description

@usarskyy

This issue can be easily reproduced if you have two classes with inheritance. If a parent class implements OnDestroy interface and a child overloads it, @angular-eslint/use-lifecycle-interface rule will report that "Lifecycle interface 'OnDestroy' should be implemented for method 'ngOnDestroy'". But it is already implemented in the parent class.

My suggestion is to check if a lifecycle method has a modifier override and skip the check.

Versions

package version
@angular-eslint/eslint-plugin 14.0.2
@typescript-eslint/parser 5.27.1
ESLint 8.34.0
node 16.13.0
Angular CLI: 14.2.10
Node: 16.13.0
Package Manager: npm 8.19.0
OS: win32 x64

Angular: 14.2.12
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1402.10
@angular-devkit/build-angular   14.2.10
@angular-devkit/core            14.2.10
@angular-devkit/schematics      14.2.10
@angular/cdk                    14.2.7
@angular/cli                    14.2.10
@schematics/angular             14.2.10
rxjs                            7.8.0
typescript                      4.7.4
  • [x ] 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