'Typescript/Angular/ESlint: no-unused-vars for constructor params [duplicate]
I have the following code snippet on my typescript class from angular project (v13):
import { Component } from '@angular/core';
import { MyService } from 'service';
@Component({
selector: 'app-example',
templateUrl: './example.component.html'
})
export class ExampleComponent {
constructor(
private myService: MyService
) {}
getUsers() {
this.myService.getUsers().subscribe(response => {
// do something;
})
}
}
I run the project with ESlint version 7.26.0 and extended the following plugins:
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"eslint:recommended"
the lint error I got when running ng lint is:
'mySerive' is defined but never used no-unused-vars
Obviously, myService is being used on my class.
Is that an expected behaviour or how to fix this issue?
PS: I don't want to disable the rule.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
