Skip to content

Resolve more imports for hidden coupling #47

Open

Description

@typeweaver

Hidden coupling (#17) is conservative: when codeheat cannot tell, imports is null, and some real links are read only at module level. These follow-ups would turn more null into an answer, or make an answer more precise. None of them produces a false none today, except where noted.

  • Binding-level resolution. A type alias or an exported expression that names one binding of a barrel hands on the whole barrel. That inflates both (on angular/angular, 14 → 130) and hides real hidden coupling between barrel members.
  • tsconfig paths/baseUrl and # subpath imports. These resolve to null today. Reading tsconfig.json and package.json#imports would resolve them.
  • createRequire aliases. const req = createRequire(import.meta.url); req('./x') is not seen as a require.
  • Root package self-import. Importing the root package by its own name gives null.
  • Alias, then mutation. const Exported = Form; Form.Item = Item; export default Exported; gives a false none, because bindings are snapshots.
  • Compiled re-exports via getters. Object.defineProperty(exports, "x", { get: () => m.x }) (tsc/Babel output) gives a false none. This only matters when build output is tracked.
  • Object.assign(config, …) onto an exported const. Only module.exports and exports are recognised as targets, so this gives a false none.
  • Type-parameter shadowing. In type U<X> = X[], X still counts as a reference to an import named X. That can give a false "imported", never a false none.

Done when: each item is either fixed with a test or explicitly declined in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions