Skip to content

TS-MODU0001 · star_reexport_surface

Count the wholesale re-exports that turn a module’s internals into its public API.

This is a deterministic rule for typescript. Read its implementation.

Count export * declarations in one module. Each one publishes everything the file it names happens to export, now and after every future edit. A helper added for one caller becomes part of the module’s contract the moment it is exported, and no reviewer sees that happen. The module then cannot be refactored safely, because nobody knows which of its internals somebody outside came to depend on.

A barrel that names its exports states a contract. A barrel that stars them states a wish.

Each finding names one wholesale re-export and the module it publishes, counted against the named exports beside it so a reader can see how much of the surface is stated and how much is inherited. The repair is a choice, since naming the exports and declaring the barrel a real public API are both real answers. The value is the number of wholesale re-exports.

A package root that deliberately re-publishes a subpackage is a real public API and belongs in a project’s exclusions. A generated index is regenerated rather than edited, so a project excludes the generator’s output instead of the generator.

export * from './UserService';
export * from './internal/userValidation';
export { UserService } from './services/UserService';
export type { UserDTO } from './dto/UserDTO';
  • Cites “TypeScript documentation”, handbook, modules and re-exports. Open reference
  • Cites “typescript-eslint documentation”, no-restricted-imports and module boundary guidance. Open reference
  • Cites “eslint-plugin-boundaries documentation”, declaring allowed import directions. Open reference