esase
1
Hello, recently I have updated my ionic project, but now I see a lot of warnings like this:
[17:03:08] tslint: src/shared/components/avatar/index.ts, line: 1
’ChangeDetectorRef’ is declared but never used.
L1: import { Component, Input, ChangeDetectionStrategy, ChangeDetectorRef, OnInit, OnDestroy } from '@angular/co
L2: import { DataStore } from 'js-data';
But I use that import:
/**
- Constructor
*/
constructor(
private events: Events,
private api: DataStore,
private ref: ChangeDetectorRef)
{
The questions is why ionic thinks that it not used import?
2 Likes
The warning is generated by the tslint
run of the build process by @ionic/app-scripts
, not Ionic Framework directly.
First: Does this affect your app or is it just a jslint warning?
Post your ionic info
output please.
esase
4
Maybe I have wrong ts configs?
tsconfig:
{
“compilerOptions”: {
“allowSyntheticDefaultImports”: true,
“declaration”: false,
“emitDecoratorMetadata”: true,
“experimentalDecorators”: true,
“lib”: [
“dom”,
“es2017”
],
“module”: “es2015”,
“moduleResolution”: “node”,
“sourceMap”: true,
“target”: “es5”,
“baseUrl”: “src”,
“paths”: {
“assets/": [ "assets/” ],
“pages/": [ "pages/” ],
“services/": [ "services/” ],
“shared/": [ "shared/” ]
}
},
“include”: [
“src/**/*.ts”
],
“exclude”: [
“node_modules”
],
“compileOnSave”: false,
“atom”: {
“rewriteTsconfig”: false
}
}
tslint.json:
{
“rules”: {
“no-duplicate-variable”: true,
“no-unused-variable”: [
true,
{
“ignore-pattern”: “Page$”
}
]
},
“rulesDirectory”: [
“node_modules/tslint-eslint-rules/dist/rules”
]
}
Compare it to the default ones: https://github.com/ionic-team/ionic2-app-base
Also post your ionic info
output and package.json please.
yannbf
6
I am having the same issue. It seems like this was caused by the recent appscripts release. Apparently they are working to fix that, though.
Is there an issue already to link to?
yannbf
8
Not that I know of. I found one but seems to be just one of the issues: