-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fixed flow types imports #1106
Fixed flow types imports #1106
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/rules/named.js
Outdated
@@ -30,6 +30,9 @@ module.exports = { | |||
node.specifiers.forEach(function (im) { | |||
if (im.type !== type) return | |||
|
|||
// ignore type imports | |||
if(im.importKind === 'type') return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after if
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a test that
import { type MyOpaqueType, MyMissingClass } from "./flowtypes"
reports for only MyMissingClass
?
is this
if not, would like to get it out of there as your change seems more targeted and sufficient on its own. |
@benmosher Added the requested test. |
🙄 |
Hey @benmosher, could you take another look at this one when you get a chance? Would love to see it merged 🙂 |
Does this work when there are comments in imported module like:
bar.js:
? |
@bstuff not sure; can you file a new issue if it doesn’t work? |
@bstuff it should :) |
#1057 has fixed #921 for the basic case, in which an import is the only thing imported from a specific file.
Sometimes types and functions/classes need to be imported from the same file. This PR fixes also that specific instance:
I have added some tests for all these cases
Fixes #1115.