MetaMask / MetaMask/eslint-config
Forbid wildcard ("barrel") exports
- Dominant language
- JavaScript
- Stars
- 12
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
When developing and maintaining a package, it is critical to understand what modules are being exported.
There are a couple ways to do this:
1. Add a test for the entrypoint of the package (`index.ts`), [like for `utils`](https://github.com/MetaMask/utils/blob/fb9440203099538670a4af95da16265f878f2cc9/src/index.test.ts).
2. Be explicit about which modules are being exported in the entrypoint.
I am proposing that we follow the second route as it is simpler. This would mean banning wildcard exports.
No ESLint rule exists per se to forbid wildcard exports, but evidently you can use `no-restricted-syntax` as a workaround as described here: https://github.com/import-js/eslint-plugin-import/issues/2493#issuecomment-1465462298
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by inspecting the package's ESLint configuration and the `index.ts` entrypoint, then compare the `no-restricted-syntax` workaround with the linked ESLint discussion. Done means the configuration rejects wildcard exports while allowing explicit exports, with the behavior verified by the relevant lint check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100