Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Fix flow import type #89

Closed
wants to merge 1 commit into from
Closed

Fix flow import type #89

wants to merge 1 commit into from

Conversation

jwangnz
Copy link

@jwangnz jwangnz commented May 10, 2015

import type Foo from 'foo';

with eslint 0.21.0, the code above will cause error:

error  Foo is defined but never used  no-unused-vars

@sebmck
Copy link
Contributor

sebmck commented May 10, 2015

Isn't this error correct? You need to use the Foo type somewhere?

@jwangnz
Copy link
Author

jwangnz commented May 10, 2015

@sebmck

import type Foo from 'foo';

export function bar(foo: Foo) {
  console.log(foo);
}

In the code above, type Foo is used, but eslint still complain Foo is defined but never used

@sebmck
Copy link
Contributor

sebmck commented May 10, 2015

Not sure, I'll have to think about it. I'd rather also lint type annotations if possible.

@jwangnz
Copy link
Author

jwangnz commented May 13, 2015

@sebmck Do you have any ideas about this ?

@sebmck
Copy link
Contributor

sebmck commented May 13, 2015

Ideally flow types should be retained (ie. remove this line) and ESLint internals patched to crawl the type annotations and report accurately on them.

@jwangnz
Copy link
Author

jwangnz commented May 13, 2015

@sebmck It seems like a big work to do, I'm noob on this kind of AST things.

Do you have plan to implement this ?

Or could you consider merge this for now, since there is already a line remove all the type annotations?

@jwangnz
Copy link
Author

jwangnz commented May 15, 2015

close this as @sebmck point out this may break peoples linting as some people have it setup with their testing frameworks etc.

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

Successfully merging this pull request may close these issues.

2 participants