Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-unused-vars / use-flow-type does not consider "TypeParameterInstantiation" nodes #385

Open
leebyron opened this issue Feb 11, 2019 · 2 comments

Comments

@leebyron
Copy link

commented Feb 11, 2019

use-flow-type doesn't seem to consider "TypeParameterInstantiation" nodes (flow docs examples)

// Reports:
// 'TestType' is defined but never used  no-unused-vars
// Despite being used directly below
type TestType = string

const x = testTypeParam<TestType>("test")

function testTypeParam<T>(in: T): T {
  return in
}
@leebyron

This comment has been minimized.

Copy link
Author

commented Feb 12, 2019

From a bit of debugging, I think this might not be an issue with the code here (but it is possible to work around here) but instead with eslint's AST traversal not visiting TypeParameterInstantiation nodes, since those nodes have a params property of type Array<GenericTypeAnnotation> and GenericTypeAnnotation is being properly visited by use-flow-type.

@pnevyk

This comment has been minimized.

Copy link
Contributor

commented Feb 12, 2019

Thanks for reporting. It is planned to move the responsibility for handling no-unused-vars for Flow types directly in babel-eslint parser. For more details, see this issue. I missed this bit, so it's good to know that this should be implemented as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.