Skip to content
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

False "Multiple exports of name" error when two "export * as ..." contain same name [import/export] #2289

Open
butterybread opened this issue Nov 4, 2021 · 3 comments

Comments

@butterybread
Copy link

butterybread commented Nov 4, 2021

The issue I am having seems related to #1834
That specific issue is fixed. But I am having the same issue when using an extra level of indirection.
TypeScript does not seem to have a problem with the added level. So I guess this plugin should allow it...?

Scenario described in #1834

./A/A1.ts

export type X = "A1";

./A/A2.ts

export type X = "A2";

./A/index.ts

export * as A1 from "./A1";
export * as A2 from "./A2";

In this scenario, as described in #1834 there would be an error Multiple exports of name 'X'.
There is no error. This is fixed.

My scenario

I have the same files as above. With the following added:
./B/B.ts

export type X = "B";

./B/index.ts

export * as B from "./B";

./index.ts

export * from "./A";
export * from "./B";

Now I get the same error (Multiple exports of name 'X') again for both lines in ./index.ts.

Having added this extra level of indirection with the index.ts files seems to mess up something.

As the original problem, this error can also be avoided by doing:

./index.ts

import { A1, A2 } from "./A";
import { B } from "./B";
export { A1, A2, B };

versions

"eslint": "^7.32.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-import-resolver-webpack": "^0.13.2",
"eslint-plugin-import": "^2.25.2",
"typescript": "^4.4.4",
@ljharb
Copy link
Member

ljharb commented Nov 5, 2021

Yes, I agree this should work for export.

However, I think export type is something we should always be ignoring, since typescript can check that.

@darrenvong
Copy link

Not sure how much this helps, but this issue was fixed for me from 2.25.2 up to 2.28.2 using eslint 8. 2.29.0 onwards is where I'm seeing the same issue again

@ljharb
Copy link
Member

ljharb commented Feb 5, 2024

@darrenvong that's very strange that it would be fixed and then regress. Thanks for the data point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants