# no-private-imports

Call another module through its supported entries. Importing private implementation
couples callers to details that the owning module must be free to change.

```ts
// Valid external interface
import '@snagbadger/capture';
// Invalid cross-module implementation access
import '../../capture/src/internal/recording.js';
// Valid within the owning module
import './internal/recording.js';
```

The error identifies the owning module and its supported entries. Static imports,
type imports, named/star re-exports, literal dynamic imports, import types, and
TypeScript import-equals declarations are checked. Resolution uses the importing
file's nearest tsconfig (including paths/extends) and TypeScript's actual resolver;
workspace names map to the source entries in `tooling/architecture/policy.mts`.
Relative unresolved paths into private trees are rejected too. There is no fixer
or suggestion: replacing a private import with a public one can change behavior.

Computed dynamic paths cannot be resolved by this rule. The repository graph check
owns such edges and the broader supported-entry, loading, and dependency policy.
This rule is intentionally not a general unresolved-import checker.

## Maintaining rules

Use the pinned `@typescript-eslint/utils` RuleCreator for typed metadata, AST
listeners, and message IDs. Add the rule to `tooling/eslint/index.mts`, enable it
as an error in `eslint.config.mjs`, and provide documentation here. First check
whether an enabled upstream rule already covers the behavior reliably.

Add valid and invalid regression cases to a `*.test.mts` suite using the official
`@typescript-eslint/rule-tester`. Resolver cases must create real isolated files
and tsconfig aliases, not mock path matching. Assert diagnostic IDs and `output:
null` for rules without safe fixes; any future fix needs explicit output tests.
The Node test runner executes these tooling tests without changing the module or
browser harness. Run `pnpm test:rules`, then `pnpm verify`. Prototypes use exactly
the same configuration and severity as other source.

Authoring references: [custom rules](https://typescript-eslint.io/developers/custom-rules/)
and [RuleTester](https://typescript-eslint.io/packages/rule-tester/).
