eslint-plugin-import: import/export - Multiple exports triggered when duplication isn't relevant
I get the error Multiple exports of name 'List'
from both lines of components/pages/index.js
in following example:
// components/pages/index.js
export * as Messages from "./messages";
export * as Users from "./users";
// components/pages/messages/index.js
export List from "./list";
export Show from "./show";
// components/pages/users/index.js
export Edit from "./edit";
export List from "./list";
// components/pages/messages/list.js => React Component
// components/pages/messages/show.js => React Component
// components/pages/users/edit.js => React Component
// components/pages/users/list.js => React Component
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 this
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 18 (11 by maintainers)
I started to attempt a fix today and ran into an issue with the current
ecmaVersion
being too old for the syntax. But after I updated that, I found out the issue has already been fixed! Potentially here. Below is a test specifically for it that I can add, but I don’t know if there are any further repercussions for updating theecmaVersion
Long story short, this is fixed on version 2.22.0. Thanks @ljharb!
Also ran into this issue with the following code:
Both the following imported files contain an
EventType
export, and should be referenced asWorkerPhoneCreated.EventType
andWorkerPhoneUpdated.EventType
respectively and so I think this “multiple exports” error is a false positive if I’ve understood correctly.