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

Flow types used in explicit type arguments in function calls are reported as not being used #644

Closed
rubennorte opened this issue Jul 5, 2018 · 3 comments · Fixed by babel/babel#8273 or #650

Comments

@rubennorte
Copy link
Contributor

Given the following code:

type Type = string;

function identity<T>(val: T): T {
  return val;
}

const foo = identity<Type>('foo');

Type is being reported as not being used by ESLint. Identifiers used inside explicit type arguments in function calls should be visited and not reported as unused.

existentialism pushed a commit to babel/babel that referenced this issue Jul 5, 2018
| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | Fixes #8272 <!-- remove the (`) quotes to link the issues -->
| Patch: Bug Fix?          | Yes
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

The visitor for `typeArguments` in function calls wasn't set in the definition, so type annotations added there weren't visited.

This is required to fix babel/babel-eslint#644
@rubennorte
Copy link
Contributor Author

This is not fixed yet. We still have to wait for the Babel release and merge #645.

@TrySound
Copy link

@rubennorte I started get this message upgrade to babel 7 and babel-eslint 9. With rc versions it worked well.

@TrySound
Copy link

Sorry, it's because one of my transitive dependency wasn't updated. Reinstall helped.

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