fix [import/named] for importing from a module which re-exports * from node_modules or commonjs module#1569
Merged
Merged
Conversation
…orts from a `node_modules` module Fixes import-js#1446.
* from a node_modules or commonjs module
* from a node_modules or commonjs module* from node_modules or commonjs module
2 similar comments
ljharb
approved these changes
Dec 12, 2019
Member
ljharb
left a comment
There was a problem hiding this comment.
Thanks, seems straightforward!
|
Looks like build checks failed. I also need this fix. When will it be in release version? Thanks a lot. |
58b5b02 to
392c6b9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1446
Based on #1447
When re-exporting
*from a commonjs module, or a module in node_modules which comes through as a commonjs module, do not error since the commonjs exports cannot be evaluated. Treat with similar logic to ignored modules or directly importing from a commonjs module.When re-exporting
*, the module is listed in dependencies instead ofreexports. There is similar logic for when re-exporting a named export, to check for a null from the exportCache, which I understand to mean an ignored or unparseable es5/commonjs module:https://github.com/benmosher/eslint-plugin-import/blob/master/src/ExportMap.js#L91
There is a todo in this location, and I'm not sure if this code satisfies that todo and it can be removed or not.
Also, when logging the value of
innerMap, I never it saw it be undefined. So it's possible thecontinueline is also no longer needed, but I am not sure.This fixes
hasDeep, but there is similar logic inhasandget:https://github.com/benmosher/eslint-plugin-import/blob/master/src/ExportMap.js#L68
https://github.com/benmosher/eslint-plugin-import/blob/master/src/ExportMap.js#L146
I'm not sure if those should get similar treatment, or if those are not relevant for this issue.