Hi, I believe there's an error with the no-unused-variable when not using with this.
You can see my example in Angular with constructor when I'm not using this;
@Component({
})
class MyComponent {
constructor(private myService: MyService) {
myService.method(); // works on TS but fail on tslint
// this.myService.method(); // tslint pass
}
}
with tslint.json configuration:
{
"rules": {
"no-unused-variable": true
}
}
Property 'myService' is declared but never used.
Should pass
The behavior is correct. The private modifier creates a property with the same name as the parameter.
You're only using the parameter and not the property. Hence the error message Property myService is declared but never used.
Most helpful comment
The behavior is correct. The
privatemodifier creates a property with the same name as the parameter.You're only using the parameter and not the property. Hence the error message
Property myService is declared but never used.