Skip to content

build: lint with Oxlint - #989

Merged
allisonmahmood merged 2 commits into
mainfrom
build/oxlint
Oct 29, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
build/oxlint

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What changed

pnpm lint and new patch repos now lint with Oxlint instead of ESLint and typescript-eslint. typescript-eslint needs TypeScript 6's JavaScript API, which TypeScript 7 doesn't ship, so this is the first step of the TypeScript 7 move (#985). Oxlint checks the same rules, including the type-aware no-floating-promises, in a third of the time.

Part of #985 (step 1 of 5).

Look at

  • .oxlintrc.json ports eslint.config.js rule for rule. It turns on Oxlint's correctness set, plus the recommended-set rules that set lacks, then the repo's own. Oxlint's correctness set also holds type-aware rules ESLint never ran here. They found 186 problems, so they stay off until Lint: work through Oxlint's correctness rules ESLint never ran #988 works through them. Rust regexes have no lookahead, so the CLI's import boundaries are gitignore-style groups: @patchy/**, then !@patchy/api and so on, plus any .. segment except ../package.json. no-unused-vars keeps typescript-eslint's strictness: no _ exemption, and a value read only through typeof counts as unused.
  • Proof the ported rules fire. Throwaway files broke each rule:
    • Restricted imports are caught in the CLI and in the local-runtime files (@patchy/auth, ../../core/...).
    • The allowed imports stay clean (@patchy/api, @patchy/core/look, ../package.json).
    • no-explicit-any, process.env, no-console, patchy/namespace-service-imports and patchy/no-manual-effect-runtime-in-tests each fire.
    • no-floating-promises fires in package source and tests, scripts/, test/, lint/ and root configs. Those files have no package tsconfig.json, so they lost no type-aware coverage.
  • The patch scaffold. Tiers 1 and 2 get one oxlint devDependency and an .oxlintrc.json instead of three ESLint packages and eslint.config.js. They keep the same three rules: hook order, exhaustive deps, and Preact through patchy/preact. On the packed e2e's lint probe, the scaffolded config reports all 8 forbidden imports, rules-of-hooks and exhaustive-deps, and leaves useQuery without deps alone.
pnpm lint, uncached, 16 cores ESLint Oxlint
Wall time, median of 3 38.3 s 12.0 s
Peak memory 3.5 GB 2.6 GB

How it was verified

  • pnpm lint and pnpm typecheck:tests pass, and pnpm format:check is clean.
  • lint/rules.test.ts passes (18 cases) on Oxlint's RuleTester.
  • initProject.test.ts, cliRepoPublish.test.ts and the offline tier 1 init in cliRepo.test.ts pass against the offline registry, which now packs oxlint.
  • pnpm test:packed-cli-e2e passes locally against a real server. It covers a tier 1 init that installs Oxlint from npm, pnpm lint, and the lint probe.
  • Not run locally: the other suites, which CI runs.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

Existing patch repos keep their ESLint setup. Lint is builder-owned, and dev and publish never load it. Only patchy init writes the new config.

  • What does a revert leave behind? Patch repos created in between keep an Oxlint config that their own pnpm lint still runs. Nothing on the server changes.
  • Does the release before it still work with that? Yes.

Made by Claude Opus 5.5 (Claude Code in T3 Code); reviewed by GPT 6.1 Sol.

ESLint and typescript-eslint need TypeScript 6's JavaScript API, which
TypeScript 7 doesn't ship. Oxlint runs the same checks natively, with its
type-aware rules from oxlint-tsgolint (typescript-go).

- .oxlintrc.json ports eslint.config.js: Oxlint's correctness set plus the
  rules ESLint's and typescript-eslint's recommended sets added, no-console,
  process.env, no-explicit-any, no-floating-promises and the CLI's import
  boundaries. Rust regexes have no lookahead, so the boundaries are
  gitignore-style groups. Correctness rules ESLint never ran stay off until
  #988.
- The repo's rules move from eslint/ to lint/ and load as an Oxlint JS
  plugin; rules.test.ts runs on Oxlint's RuleTester.
- New tier 1 and 2 patch repos lint with Oxlint: the same hooks and Preact
  import rules in .oxlintrc.json, one oxlint devDependency instead of three
  ESLint packages. The offline registry and the packed e2e probe follow.

Part of #985.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:l 501-1,000 changed lines labels Oct 28, 2026
Review of the port found three places it was looser than ESLint:

- `../**` let `./../x`, `a/../b` and a bare `..` through the CLI and
  local-runtime import boundaries, and dropped the local runtime's
  `../package.json` exception. Both now match any `..` segment except
  `../package.json`, as the old regexes did.
- Oxlint's default no-unused-vars exempts `_`-prefixed names and values
  read only through `typeof`; typescript-eslint reported both.
- no-array-constructor, in typescript-eslint's recommended set, is
  pedantic in Oxlint, so correctness never turned it on.

Lint scope also leaves out .jsx again, and labeler gives .oxlintrc.json
area:ci, as *.config.js gave eslint.config.js.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review (GPT 6.1 Sol, xhigh) and what changed. All fixed in 03e94e9:

  1. Parent imports could slip past the boundaries. ../** let ./../x, a/../b and a bare .. through. The local-runtime override had also lost its ../package.json exception. Both now use ["**/../**", "**/..", "!../package.json"]. Probes: ./../../auth/..., ./zz/../../core/..., .. and ../../package.json are refused, while ../package.json and ./zz/local.js pass, in the CLI and in devMembers.ts.
  2. no-unused-vars was laxer than typescript-eslint. Oxlint's default exempts _unused and values read only through typeof. It's now ["error", { "reportVarsOnlyUsedAsTypes": true }], and both probes fire.
  3. no-array-constructor was missing. Oxlint files it under pedantic, so it's added explicitly. Array(), Array(1, 2) and new Array(1, 2) fire.
  4. Lint scope. .jsx is ignored again, so pnpm lint stays TypeScript-only as with ESLint.
  5. Labeler. .oxlintrc.json now gets area:ci.

pnpm lint stays clean on the repo with the stricter settings.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 03e94e9a8d2888c43b5e4cf35d812ec70a388276 (base 2f9f7c1a795d66f776b9b5c3c2ff94da7a3ef41b) on fresh packed-CLI synthetic fixtures and disposable server/Postgres, by GPT 6.1 Sol in the Codex harness through T3 Code. Linux, Node 26.12.1, pnpm 12.15.0. Fetched pull/989/head, checked out detached in a separate acceptance checkout, installed with the frozen lockfile, and confirmed a clean tree before and after testing. I did not author this PR.

Done means

This accepts step 1 of #985, the lint/scaffold swap, against the PR's claims. The parent issue's TypeScript 7 compiler and publish gate belong to later steps.

  • Workspace lint and enforcement: passed. Clean pnpm lint exited 0. Throwaway violations made the actual pnpm lint --format json exit 1: six forbidden CLI imports (including embedded parent traversal, bare .., and the wrong package metadata), process.env, explicit any, console calls, _unused, a value used only through typeof, array construction, and all three custom Effect rules. Floating promises were rejected in a package test, scripts/, lint/, and a root config. Allowed @patchy/api, @patchy/core/look, and ../package.json imports exited 0. All probes were deleted.
  • Custom rules and scaffold/repo suites: passed, 73 tests across lint/rules.test.ts, initProject.test.ts, cliRepo.test.ts, and cliRepoPublish.test.ts. This includes both tier 1/2 scaffold generation and the offline registry path.
  • Fresh packed tier 1 repo: passed. Packed CLI init --tier 1 installed with a fresh pnpm store and metadata cache; pnpm typecheck and pnpm lint passed. The scaffold rejected all eight React/Preact imports, conditional hook calls, and missing effect dependencies; a valid useQuery without a dependency array passed.
  • Existing ESLint repo compatibility: passed. An acceptance-only copy of the packed e2e flow replaced the freshly tested repo's lint metadata with the base commit's ESLint config, dependency declarations, and eslint . script, and removed .oxlintrc.json. A fail-if-loaded sentinel made accidental ESLint config loading observable. Local dev, browser interaction, hosted publish/update, lifecycle, and refresh passed; the ESLint config and package manifest remained byte-for-byte unchanged. This checks that dev/publish do not load or gate on builder-owned lint; it does not claim to rerun ESLint itself.
Inline command evidence
pnpm lint
exit 0

pnpm lint --format json   # temporary violations
exit 1
CLI: 6 x eslint(no-restricted-imports)
source: eslint(no-restricted-properties), typescript(no-explicit-any),
        eslint(no-console), eslint(no-unused-vars), eslint(no-array-constructor),
        patchy(namespace-service-imports), patchy(no-inline-schema-compile)
test: patchy(no-manual-effect-runtime-in-tests), typescript(no-floating-promises)
scripts / lint / root config: typescript(no-floating-promises)
allowed CLI imports: exit 0

pnpm exec vitest run lint/rules.test.ts packages/patchy/src/initProject.test.ts \
  packages/patchy/src/cliRepo.test.ts packages/patchy/src/cliRepoPublish.test.ts
Test Files  4 passed (4)
     Tests  73 passed (73)

node .local/acceptance-packed.mjs   # packed-cli-e2e plus the compatibility assertions above
[acceptance-989] PASS: fresh packed tier 1 init, typecheck, lint, allowed useQuery, forbidden imports and hook checks
[acceptance-989] PASS: legacy ESLint config and package manifest preserved byte for byte
[acceptance-989] PASS: existing ESLint repo local dev, hosted publish, discovery, lifecycle and description sync
[packed-cli-e2e] PASS: complete packed CLI real-server contract
exit 0

The acceptance-only harness and probes were kept outside tracked files; no PR code was changed. Heavy suites ran sequentially under the shared machine lock. The packed harness tore down its server, Postgres, browsers, and patch dev session; pnpm dev down was also run in the acceptance checkout.

Golden journeys

  • Log a machine in: passed in packed synthetic fixtures, including browser confirmation, whoami, logout, and server-side key revocation.
  • Publish a page, share/unshare, and reverse lifecycle: passed in packed fixtures, including public/company doors, owner refusal, delete, forced retire, restore, and rollback.
  • Use a tier 1 tool: passed for local and hosted generated-app reads/writes, persisted rows, and local/hosted data isolation. The exact two-person live-sync scenario was not rerun.

Rollback answers: match the diff. A revert leaves newly created patch repos with builder-owned Oxlint metadata and their own lint dependency. Dev/publish do not consume that metadata. No migration, retained-data change, server/API/runtime contract, or infrastructure change requires one-way. CI's rollback-rehearsal passed.

Not run

  • Exact team/brightline sign-in and portal search/open journeys, Jordan/Priya live sync, tier 2 deal/spend interactions, and invitation/join/revoke/reactivation: no auth, portal, runtime, or membership implementation changes in this diff. The focused packed flow exercises the scaffold's affected builder journey instead.
  • Full local pnpm verify, local Clerk/live integration suites, and a new performance benchmark: focused acceptance ran the relevant suites and behavior probes; broader coverage is left to CI. No real external account or production instance was touched.

Notes

  • At the final CI snapshot, lint, browser, both CLI smoke jobs, tier2 smoke, release tarball, all three platform installs, Postgres concurrency, Clerk, Pidgeon, rollback rehearsal, and Node 22 tests passed. Node 24/26 tests and the informational Attio live check were still running; no reported check had failed. See CI. This is an acceptance result for the named head, not a merge-readiness claim.
  • The intentionally disabled additional Oxlint correctness rules are tracked by Lint: work through Oxlint's correctness rules ESLint never ran #988. The tested ported rules still fire.
  • Applicable mirrored surfaces were CLI scaffolding/docs and lint/test/verification wiring. Wire/API, product vocabulary, migrations, company resources, served pages, reverse-state implementations, and package layout are unchanged.

@allisonmahmood
allisonmahmood merged commit 1341e12 into main Oct 29, 2026
23 checks passed
@allisonmahmood
allisonmahmood deleted the build/oxlint branch October 29, 2026 09:45
allisonmahmood added a commit that referenced this pull request Oct 29, 2026
## What changed

The `patchy` CLI no longer bundles TypeScript to read patch repos, which
makes it a third smaller. TypeScript 7 ships no JavaScript API, so this
is the next step of the move (#985). `@babel/parser` reads patch sources
instead, and the repo's own compiler answers what only it knows.

Part of #985 (step 2 of 5). Stacked on #989.

## Look at

- **`patchy add` / `patchy remove` (`editUses.ts`)** splice one entry
into `uses` instead of reprinting the whole object through TypeScript's
printer, which reflowed indentation and dropped or moved comments. The
new entry goes after everything that follows the last entry, on a line
of its own when the object ends on one. Every comment stays with the
entry it follows, and removal keeps every comment not on the removed
entry's own lines. Adding then removing an alias gives back the file
byte for byte, LF or CRLF, with one exception: a one-line object of
spaces, `{ }`, comes back as `{}`, as it does on main. The existing
one-line output is unchanged: `uses: { "analytics": { kind: "posthog",
handle: "product" } }`. A config that doesn't parse is refused at the
line Babel stopped on. `editUses.test.ts` covers each layout, a sweep of
commented layouts, the refusals and the lines they name. Acceptance's
runs drove most of this: see the verdicts and replies below.
- **The `agent/` typecheck warning (`serverModules.ts`)** asks the
repo's own compiler for its file list with `tsc --showConfig`. That
gives `include`, `exclude` and `extends` the meaning they have for `pnpm
typecheck`, on TypeScript 6 or 7, instead of re-implementing them.
- **The import check (`pageImports.ts`)** reads each file as Vite would.
TypeScript with decorators parses with JSX outside `.ts`. Inline HTML
scripts parse as plain JavaScript, classic or module, and data blocks
such as JSON and import maps are skipped. Every existing form keeps its
test: type-only imports and exports, import-equals, `require`,
`require?.()` and `import.defer`. One deliberate tightening: the server
graph refuses `import.defer()` as it already refused `import()`, because
both load a module at run time.

| CLI release | main | this PR |
|---|---|---|
| Tarball | 35.1 MB | 22.4 MB |
| `dist/index.js` | 13.9 MB | 3.7 MB |
| `dist/dev.js` | 16.8 MB | 6.6 MB |

## How it was verified

- `editUses.test.ts`, `pageImports.test.ts`, `serverModules.test.ts`
(the warning now runs the linked compiler), `packagePin.test.ts` and
`ManagedProject.test.ts` pass: 151 tests. A local generator over 1,057
`uses` layouts, with LF and CRLF, checks the editor's invariants:
comments stay with their entries through add and remove, output parses,
and add then remove gives back the original bytes except `{ }`. It finds
no failures.
- `tsc` on the CLI and `pnpm typecheck:tests` pass, and `pnpm lint` is
clean.
- The full `packages/patchy` suite passed 595 of 618 locally. The rest
failed on a loaded shared machine (load average about 17), where a stray
`GET /` reached the tests' localhost stub servers. The same files fail
identically on #989's head without this change, and #989's CI ran them
green. CI on this head is the oracle.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

`patchy add` and `remove` write the same declarations into the same
place, and now leave the rest of the file alone. A server bundle with
`import.defer()` was already outside the contract ("closed modules
without dynamic imports").

- **What does a revert leave behind?** Nothing. Configs edited in
between are ordinary TypeScript.
- **Does the release before it still work with that?** Yes.

Made by Claude Opus 5.5 (Claude Code in T3 Code); reviewed by GPT 6.1
Sol.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Oct 29, 2026
… 7 (#1046)

## What changed

This adds release 22's What's new entry, written from `a2d1331`. It
covers everything merged since release 21's `through` (`f30d8fe`), and
sets the `patchy` release to `0.22.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`. With this release, patch repos move to TypeScript
7 and Oxlint, and Patchy's crypto runs through one Effect service.

| Change | PRs |
| --- | --- |
| Improved: Your agent checks patches several times faster. New repos
use TypeScript 7 and Oxlint, the patchy download is a third smaller, and
an existing repo's next publish asks it to move over | #989, #994,
#1009, #1010 |
| Behind the scenes: Patchy itself builds with TypeScript 7 and Oxlint |
#989, #1009 |
| Behind the scenes: Encryption, signing and ids go through one place,
with tests proving stored values still open | #1000, #1041, #1042 |

One merged PR gets no line: #971 is release 21's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`. It tells builders that their next
publish of an existing repo will ask them to move to TypeScript 7, and
that live patches keep working. That's the one behaviour change people
will meet.
- **Rollback safety, from the live commit `2f9f7c1` (release 21) to
`a2d1331`:**
- No PR in the range is labelled `one-way`, and none has a migration or
an infrastructure change.
- Every stored format is unchanged: ids, tokens, digests, sealed
credentials, file handles and index names. The crypto PRs prove this
with known-answer tests.
- #1010 is Breaking for builders: publishing a TypeScript 6 repo is
refused, with the command to fix it. A rollback lifts that refusal, and
doesn't strand anyone.
  - `rollback-rehearsal` passed on every landed head.

**Rollback line:** If this release misbehaves, roll back to `2f9f7c1`
(release 21).

## How it was verified

- **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and
`schemas.test.ts` pass (21 tests), and prettier passes on the changed
files.
- **The stack.** All seven PRs were Sol-reviewed with every finding
fixed, and each got an acceptance PASS or PASS with notes. Each landed
after a rebase onto `main` that left it unchanged (range-diff `=`), with
all 12 required checks passing. #1000's one red run was the known Fleet
flake #1012, and it passed on rerun.
- **Deploy state.** The live commit, pinned from `/healthz/deep`, is
`2f9f7c1` (release 21). The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

Text and version numbers only. The `0.22.0` bump tells CLIs and patch
repos installed before this deploy to upgrade, as every release does.

- **What does a revert leave behind?** Nothing.
- **Does the release before it still work with that?** Yes.

Made by Claude Opus 5.5 (Claude Code in T3 Code).

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:l 501-1,000 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant