-
-
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
[import/named] fails to track deep exports when re-exporting from a module in node_modules #1446
Comments
We have the same problem, and I started poking around. Not entirely familiar with the code, but it seems to be the module is ignored due the unambiguous check. When importing the node_module module, it gets the compiled es5 source code, which fails the unambiguous test. So hasDeep has a null innerMap, and returns no exports, so the import is not found. It seems possibly to be a similar condition to #1460. We have gotten some modules do work with Using Kent's repo, here is the log output:
|
I think this is because the final outputs are commonjs: https://unpkg.com/eslint-plugin-import@2.19.1/lib/index.js |
Looking at our project, most everything in node_modules is skipped because of ignore rules, but when it's ignored, it appears to just silently accept whatever I import without checking. In Kents repo, and for dependencies where you have a local file re-exporting from node_modules, it gets the es5 from node_modules, and reports the re-exports as failures because it doesn't parse es5 even though the exports are in there. So named cannot accurately determine if an import is valid or not, but for ignored modules it silently accepts anything, but for re-exported unparseable es5 it reports a failure. Should it detect the condition where you are re-exporting es5 and also just silently accept any import from that file? |
Here's a reproduction: https://github.com/kentcdodds/eslint-export-named-issue
I'm not sure why this is an issue, but like I said, it appears to only happen when you re-export from a
node_modules
module. Seems to work fine if you re-export from one of your own files.The text was updated successfully, but these errors were encountered: