Ioinic : 3.9.0
import { Component, Input, OnInit, OnDestroy } from '@angular/core';
export class PageBottom implements OnInit, OnDestroy {
constructor(private appService: AppService) {
}
ngOnInit() {
...
}
ngOnDestroy() {
...
}
}
with tslint.json configuration:
{
"enable": true,
"rules": {
"no-duplicate-variable": true,
"no-unused-variable": [
true
]
},
"rulesDirectory": [
"node_modules/tslint-eslint-rules/dist/rules"
],
"autoFixOnSave": true
}
'OnInit' is declared but its value is never read.
'OnDestroy' is declared but its value is never read.
No errors
Looks like a duplicate of #3463
Can you try upgrading to [email protected]? That fixed a similar issue.
Updated to 2.6.1 and still the same warnings
Do you get the same errors when you enable compilerOptions.noUnusedLocals in your tsconfig.json?
yes, it looks like it's not recognizing that I have implemented OnInit.
That might be a bug in TypeScript. no-unused-variable uses TypeScript's implementation of --noUnusedLocals and --noUnusedParameters behind the scenes.
If you can narrow this down to a self-contained reproduction, I suggest reporting it in the TypeScript repository.
This is a bug for me too
TSLint version: 5.8.0
TypeScript version: 2.6.2
Running TSLint via: Node.js API
Same for me
TSLint version: 5.9.1
TypeScript version: 2.6.2
Running TSLint via: Node.js API
As ajafff mentioned, no-unused-variable directly reports TypeScript's diagnostics. Please file an issue on the TypeScript issue tracker if you're seeing these bugs.
Most helpful comment
Do you get the same errors when you enable
compilerOptions.noUnusedLocalsin your tsconfig.json?