Skip to content

refactor(ts): split packages/ts/src clean at one_function_per_file max_lines = 9 #1055

Closed

Description

@thekevinbot

Step under #1053 (census + wave plan) and #1020 (tracker). Lane T, packages/ts.

Main is clean at max_lines = 12 (PR #1051 takes the config there). The next rung is 9. Measured on a clean clone of origin/main at b2c4651 with the config rewritten to 9 and npx -y testing-conventions@0.0.111:

packages/ts/src/resolve-config-extensions.ts:88: `resolveConfigsExtensionSpecs` runs 11 lines, and `loadExtensionEntries` already holds this file
packages/ts/src/resolve-extension.ts:81: `resolveExtensionPath` runs 11 lines, and `resolvePackage` already holds this file
error: 2 function(s) sharing a file with another function over the 9-line threshold

Two violations, two files. In both cases the module's named export is the flagged function and the holder is a private helper, so the fix keeps the export in place and moves the helper out.

Scope

  • resolve-extension.ts: move resolvePackage (and platformSuffixes, its only caller's helper, to avoid an import cycle) into resolve-package.ts. resolveExtensionPath and isBareName stay.
  • resolve-config-extensions.ts: move loadExtensionEntries (and the Toml type alias it needs) into load-extension-entries.ts. Both resolveConfigExtensionSpecs and resolveConfigsExtensionSpecs stay.
  • Colocated tests move with the code; new resolve-package.test.ts and load-extension-entries.test.ts.

Out of scope

No config change. Per #1053 invariant 1, a split PR never touches a max_lines line — the ratchet to 9 ships separately once every lane is clean at 9.

No behaviour change, no public API change (neither symbol is exported from index.ts), so no PARITY.md update and no migration fragment.

Activity

  1. self-assigned this
    on Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions