Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

[1.3.12] Wrong lint warning when import is only use as declaration #1074

Open
peterpeterparker opened this issue Jul 2, 2017 · 17 comments
Open

Comments

@peterpeterparker
Copy link

Short description of the problem:

With app-scripts 1.3.12, when an import is only use as declaration, tslint will display this import as never used

What behavior are you expecting?

No warning

Steps to reproduce:

  1. See code example
  2. Run ionic serve
  3. Access the page in the browser so tslint will be called

Code

import {Slides} from 'ionic-angular';

@Component({
    templateUrl: 'test.html',
    selector: 'test'
 })
 export class TestPage  {
    @ViewChildren('mySlider') private slides: QueryList<Slides>;
}

** tslint output **

[11:34:13] tslint: src/pages/test.ts, line: 5 'Slides' is declared but never used.

L5: import {Slides} from 'ionic-angular';

Which @ionic/app-scripts version are you using?

1.3.12

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.1 
Gulp CLI         : CLI version 1.2.2 Local version 3.9.1
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.12
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-gulp          : 1.0.1
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3 ios 4.4.0
Ionic Framework                 : ionic-angular 3.5.0

System:

Node       : v8.1.3
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b 
ios-deploy : 1.9.0 
ios-sim    : 5.0.13 
npm        : 5.0.4 
@sfabriece
Copy link

slightly related i'm getting linting error where I've disabled linting with comment

// tslint:disable has no effect

@mburger81
Copy link
Contributor

Same issue here

@chilloutman
Copy link

Duplicate of #1052, where the same issue was already occurring on 1.3.8.

@chilloutman chilloutman marked this as a duplicate of #1052 Jul 18, 2017
@rodneyjoyce
Copy link

Another example:

import { Pipe, PipeTransform } from '@angular/core';
@Pipe({  name: 'bookingStatusForRating' })
export class BookingStatusForRatingPipe implements PipeTransform {

results in " 'PipeTransform' is declared but never used." when it clearly is.

@LufoX11
Copy link

LufoX11 commented Aug 5, 2017

I'm facing this issue as well. In my case, I've upgraded from [email protected] to (current) latest [email protected]. If someone, in Ionic stuff, need a live example, I can provide you with the entire project. Thanks.

@rroque6428
Copy link

Also a problem for me. I just updated the Ionic scripts today and got lots of ' ... is declared but never used.' for imports that are actually being used. Really annoying. But the build works normally.

My env:

    @ionic/cli-plugin-ionic-angular : 1.4.1
    @ionic/cli-utils                : 1.7.0
    ionic (Ionic CLI)               : 3.7.0

global packages:

    Cordova CLI : 6.5.0

local packages:

    @ionic/app-scripts        : 2.1.3
    @ionic/cli-plugin-cordova : 1.4.1
    Cordova Platforms         : android 6.1.2
    Ionic Framework           : ionic-angular 3.6.0

System:

    Android SDK Tools : 25.2.5
    Node              : v6.9.1
    OS                : Windows 8.1
    npm               : 4.1.1

@lostdev
Copy link

lostdev commented Aug 11, 2017

I've got the same issue as @rroque6428 above, but I'm on 3.7.0.

Ionic info:

cli packages: (C:\git\mobile\node_modules)

    @ionic/cli-plugin-cordova       : 1.6.2
    @ionic/cli-plugin-ionic-angular : 1.4.1
    @ionic/cli-utils                : 1.7.0
    ionic (Ionic CLI)               : 3.7.0

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : android 6.2.3 ios 4.3.1
    Ionic Framework    : ionic-angular 3.6.0

System:

    Android SDK Tools : 25.2.5
    Node              : v6.10.3
    OS                : Windows 8.1
    npm               : 3.10.8

@bollatialfredo
Copy link

Same issue as @lostdev @rroque6428 @peterpeterparker.

cli packages: (//node_modules)

    @ionic/cli-plugin-cordova       : 1.6.1
    @ionic/cli-plugin-ionic-angular : 1.4.1
    @ionic/cli-utils                : 1.7.0
    ionic (Ionic CLI)               : 3.7.0

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 1.3.12
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.0.1

System:

    Node : v6.11.2
    OS   : Linux 4.10
    npm  : 3.10.10 

@pishonx
Copy link

pishonx commented Sep 4, 2017

strange, I also just updated my dependencies, now my app does not work anymore :/
Same issue here:

cli packages: (/Users/pichonx/Development/tendbe/tb-mobile/node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

local packages:

@ionic/app-scripts : 2.1.0
Ionic Framework    : ionic-angular 3.5.3

System:

Node : v6.9.1
npm  : 3.10.8 
OS   : macOS Sierra

does sombody have found something yet?

@rroque6428
Copy link

Solved. Check #1052

In short: just remove 'src/declarations.d.ts' file (refer to the above thread for details)

@peterpeterparker
Copy link
Author

peterpeterparker commented Sep 6, 2017

Thx @rroque6428 but the issue you listed doesn't solve this issue.

My project already doesn't contains any declarations.d.ts

The issue is therefore still open.

@arfaWong
Copy link

Thx @rroque6428 the issue you listed did solve this issue.

@mburger81
Copy link
Contributor

not sure if removing the file is the right solution, we need the declaration file because we import third part javascript files.

@alawneh0
Copy link

alawneh0 commented Jan 2, 2018

is the problem solved for anyone ?

@shahriar
Copy link

shahriar commented Jan 6, 2018

Here is the solution
#1052 (comment)

@jgerstle
Copy link

jgerstle commented Jan 10, 2018

Removing declarations.d.ts didn't help me either. It seems like this issue is supposed to be fixed in newer typescript versions, but I am still having issues even with ts 1.5.3: palantir/tslint#2470

@ArezooK
Copy link

ArezooK commented Feb 20, 2018

I also have this issue and deleting the declaration.d.ts file removed some of the false positive warnings I have but not all of them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests