Skip to content

Forbid wildcard ("barrel") exports #331

@mcmire

Description

@mcmire

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.
  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: import-js/eslint-plugin-import#2493 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions