-
-
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/export - Multiple exports triggered when duplication isn't relevant #1704
Comments
When you say "the code works", do you mean, in native browser or node ESM, or in babel/typescript? |
In other words, I believe the spec requires this to be a syntax error, because you have two exports that conflict. Babel might paper over this by silently choosing the last one, but that doesn't mean it's valid. |
Oh yeah, my bad. I'm using babel and I think the specific relevant plugin is I think that might change the context of how it works, but do they conflict? With that plugin I can access both |
Also in case it's not clear, the commented out portions above are meant to denote individual files. They're not all in one file |
The example works without syntax error in node ESM. The |
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#export-star-as-namespace-syntax // ts
export * as Messages from "./messages";
export * as Users from "./users";
// js
exports.Messages = require("./messages");
exports.Users = require("./users"); Using |
Ah, very true - This definitely seems like a bug. |
@ljharb can you remove typescript label since |
Also ran into this issue with the following code: export * as WorkerPhoneCreated from './phone/created';
export * as WorkerPhoneUpdated from './phone/updated'; Both the following imported files contain an |
I agree; that should be addressed. |
@ljharb any updates on this? I just ran into this recently. |
@lifeiscontent no; nobody's sent a PR yet and I haven't had the time. One would be welcome :-) |
I started to attempt a fix today and ran into an issue with the current
Long story short, this is fixed on version 2.22.0. Thanks @ljharb! |
No problem; the ecmaVersion can be changed on a per-test basis :-) I've adapted your diff into a commit, thanks! |
Still getting this error on v 2.23.4
-> import/export: Multiple exports of name 'f'. |
@ftaiolivista that is legit error. not a bug in |
I think the export overloading is ammisible by ECMASCRIPT (see this answer https://stackoverflow.com/questions/66533367/import-export-name-collision-resolution ) Maybe eslint could give an optionable error that can ben disabled by config? |
@ftaiolivista i agree; could you file a new issue for that? |
I get the error
Multiple exports of name 'List'
from both lines ofcomponents/pages/index.js
in following example:I understand that if I get it once, I'll get it twice, but I don't think it should be happening at all. The code itself works when I access my components (
Pages.Users.List
) leading me to believe this is a bug in the rule. I also made sure to update to the latest version (2.20.1) before submitting thisThe text was updated successfully, but these errors were encountered: