import-js/eslint-plugin-import

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

Fechada

#2.289 aberto em 4 de nov. de 2021

 (3 comentários) (2 reações) (0 responsável)JavaScript (1.550 forks)batch import
bughelp wanted

Métricas do repositório

Stars
 (5.940 estrelas)
Métricas de merge de PR
 (Mesclagem média 138d 22h) (3 fundiu PRs em 30d)

Description

The issue I am having seems related to https://github.com/import-js/eslint-plugin-import/issues/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 https://github.com/import-js/eslint-plugin-import/issues/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 https://github.com/import-js/eslint-plugin-import/issues/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",

Guia do colaborador