Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

[no-unused-vars] false positive with import used in type #90

Closed
wesleymostien opened this issue Nov 5, 2017 · 9 comments
Closed

[no-unused-vars] false positive with import used in type #90

wesleymostien opened this issue Nov 5, 2017 · 9 comments
Labels
bug/incomplete rule unable to reproduce bugs that are unable to reproduce in master

Comments

@wesleymostien
Copy link

screen shot 2017-11-05 at 11 53 30

As you can see in the screenshot, eslint reports an error on 'webpack' while it is used in a type notation.

@macklinu
Copy link
Collaborator

I added the following test locally as a valid test case, and all tests passed:

diff --git a/tests/lib/rules/no-unused-vars.js b/tests/lib/rules/no-unused-vars.js
index c470d3c..0bfc682 100644
--- a/tests/lib/rules/no-unused-vars.js
+++ b/tests/lib/rules/no-unused-vars.js
@@ -316,6 +316,13 @@ import { Another } from 'some';
 interface A extends Nullable<SomeOther> {
     do(a: Nullable<Another>);
 }
+        `,
+        `
+import * as webpack from 'webpack';
+
+const webpackConfig: webpack.Configuration = {};
+
+return webpackConfig;
         `
     ],
 

Nothing in that snippet is being reported as unused. Are you still experiencing this issue with the latest version of eslint-plugin-typescript, and if so, could you please include your ESLint config?

@bradzacher bradzacher added bug/incomplete rule unable to reproduce bugs that are unable to reproduce in master labels Nov 16, 2018
@bradzacher bradzacher changed the title typescript/no-unused-vars : false positive ? [no-unused-vars] false positive with import used in type Nov 16, 2018
@bradzacher
Copy link
Owner

closing as we are unable to reproduce, and there has been no response from OP.

@JPeer264
Copy link

I wanted to create a new issue with the exact same title. Maybe it is better to post it here?

// next line is an error
import { HTMLAttributes } from 'react';

type SomeType = HTMLAttributes<HTMLButtonElement>;

@bradzacher
Copy link
Owner

Check your parser version.
Plugin version 0.14.0 only supports up to parser v17 (i think it was 17?)

@JPeer264
Copy link

Oh. I am currently on v21. So with the plugin version v1 the current parser should be supported right?

@bradzacher
Copy link
Owner

Yes. With the v1 release we have made it possible for us to control the parser version to help prevent mismatches.
And we have upgraded and handled the changes introduced in parser v21.

We're close to the v1 release!

@eddiemonge
Copy link

How close?

@bradzacher
Copy link
Owner

bradzacher commented Jan 5, 2019

Have a look at the pinned 1.0.0 issue (#151). You can try out the RC now.

@armano2
Copy link
Contributor

armano2 commented Jan 5, 2019

there are still some errors in no-unused-vars and so on, we need new release of parser :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/incomplete rule unable to reproduce bugs that are unable to reproduce in master
Projects
None yet
Development

No branches or pull requests

6 participants