Skip to content

build: suncalc 2, TypeScript 7, bun 1.4.2, and oxlint in place of ESLint - #30

Merged
mdugue merged 7 commits into
mainfrom
claude/stoic-mccarthy-2nyk67
Sep 21, 2026
Merged

mdugue merged 7 commits into
mainfrom
claude/stoic-mccarthy-2nyk67

Conversation

@mdugue

@mdugue mdugue commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Executes plans/013, re-researched against the registry on 2026-09-21 — several of its conclusions had moved, and three things it listed as blocked turned out not to be.

suncalc 1.9 → 2.0.2

2.0 is ESM with named exports, reports degrees instead of radians, and measures azimuth north-based clockwise where 1.x measured it from south toward west. A mechanical import fix would have compiled and shipped the sun rotated 180°, so lib/city/sun.ts flips both horizontal signs:

east:  -cos(alt)*sin(az_south)  ->  cos(alt)*sin(az_north)
north: -cos(alt)*cos(az_south)  ->  cos(alt)*cos(az_north)

Verified two ways rather than trusting the unit tests alone:

  • Equivalence: replayed both formulas over 360 sampled instants at Dresden — max deviation 1.0e-15. The rewrite is the same vector.
  • What genuinely changed: 2.0 applies atmospheric refraction, so the sun sits up to 0.70° higher near the horizon. That is an accuracy gain for golden-hour lighting and low-sun shadow length.

@types/suncalc is dropped (suncalc ships its own). The pin stays exact: a silent float here rotates the sun rather than failing.

TypeScript 7 — and why ESLint had to go

TypeScript 7.0.2, the native compiler. bun typecheck 7.8s → 1.6s, next build's type pass 8.4s → 2.4s, and both run the same TS 7, so there is still exactly one type-checking authority.

The catch is what the TS 7 npm package is: per-platform native binaries plus a tsc launcher. It ships no lib/typescript.js — the classic JS compiler API is gone. typescript-eslint consumes that API and does not merely warn, it crashes before ESLint can load its config (Cannot read properties of undefined (reading 'Cjs')). No typescript-eslint channel, canary included, accepts typescript >=7.

So oxlint replaces ESLint. It carries its own Rust parser and no TypeScript dependency, so it cannot hit that wall.

Coverage: all but one of the 86 rules

Checked rule by rule against the 86 rules eslint-config-next had enabled here. Exactly one has no equivalent anywhere: @next/next/no-location-assign-relative-destination — and nothing in the repo calls location.assign.

Everything else is covered, by oxlint (all 21 Next.js rules, jsx-a11y, the React-Compiler-era react rules that matter under reactCompiler: true) or by biome, verified by probing real violations rather than matching names: useHookAtTopLevel, useExhaustiveDependencies, noTsIgnore, noVar, useConst, noExplicitAny, noNamespace, noBannedTypes, noArguments, noUnusedVariables.

Auditing pitfall worth knowing (it caught me out — see commit c01a746): oxlint --print-config lists only the enabled rules, and oxlint's default is the correctness category alone. The full catalogue is 653 rules (--print-config -D all). A first pass measured against the enabled set and wrongly reported four rules as missing; react/rules-of-hooks, react/display-name, react/no-unescaped-entities, react/jsx-no-comment-textnodes and import/no-anonymous-default-export all exist and are simply off by default. .oxlintrc.json now names them explicitly, and rules-of-hooks + no-unescaped-entities were re-probed against a deliberate violation to confirm they fire from the config alone.

@typescript/typescript6 (the shim providing the old JS API) was also built and does work — but it delivers TS 7 only as an extra CLI beside TS 6, with three typescript packages in the tree. oxlint was the preferred route.

oxfmt is not part of this PR, but not because it would cause churn — measured, it would reformat zero of the 140 source/config files (both it and biome are Prettier-compatible), touching only package.json key order and six markdown files. It is deferred because this PR already swaps the type checker, the linter and the runtime, and because dropping biome would give up CSS linting (app/globals.css), which oxlint does not do at all. That is its own decision, for its own PR.

Dropping ESLint takes the install from 703 packages to 502, and bun run verify from ~10s to 2.2s.

bun 1.4.2

packageManager: bun@1.4.2 covers build and run: all four CI jobs read it via setup-bun's bun-version-file, and Vercel reads the same field. It also closes the standing skew with @types/bun (already on ^1.4.2).

Validated on a real 1.4.2 install rather than assumed — that was the only reason plan 013 held it back. bun.lock does not change at all under 1.4.2, so --frozen-lockfile keeps working with no lockfile-format churn to review.

Other dependency work

  • Biome 2.5.0 → 2.5.14.
  • --max-warnings=0 gates lint (now on oxlint).
  • geotiff → devDependencies (build-only importer); @types/proj4 removed (deprecated stub).
  • n8ao / postprocessing / three-mesh-bvh pinned exactly, as AGENTS.md already claimed.
  • types/three-mesh-bvh.d.ts deleted — the package declares the same module 'three' augmentation itself and more completely (it covers BatchedMesh).
  • tsconfig target ES2017 → ES2022. allowJs deliberately kept: next build rewrites the file to put it back, so removing it (as plan 013 proposed) dirties the tree on every build.
  • .vscode/settings.json drops js/ts.tsdk.path — TS 7 ships no tsserver at that path.

CI actions

  • actions/checkout v6 → v7. v7 refuses to check out fork PR code under pull_request_target/workflow_run. Confirmed a no-op here — ci.yml runs on pull_request/push, and pr-title.yml (the only pull_request_target workflow) never checks out.
  • actions/cache v5 → v6. v6.1.0 carries Backport: Handle cache write error due to RO token actions/toolkit#2435, handling a cache write failing on a read-only token — exactly the e2e job's case on fork PRs.
  • Dependabot npm budget 5 → 10; next/lint-and-format groups lose eslint*, gain oxlint.

Still held back (blockers recorded in plans/README.md)

Why not
ultracite 7.12.0 Enables ~10 new rule families → 451 violations. Biome 2.5.14 on its own is clean (verified), so this is a style refactor, not a dependency bump. (Note: all 451 come from its biome preset, so a later move to oxfmt+oxlint would dissolve this blocker.)
n8ao 2.0.1 Ships no types and changes SSAO output; AGENTS.md requires the --headed snapshot harness on a real GPU.
postprocessing 7 alpha/beta only.

Verification

  • bun run verify — green (2.2s)
  • bun install --frozen-lockfile under bun 1.4.2 — green, lockfile unchanged
  • bun run build — green, idempotent w.r.t. tsconfig.json
  • bun test lib/city/sun.test.ts — 6/6, plus the 360-instant equivalence check
  • bun run test:e2e locally — 9/9 (3.3 min) on the final TS 7 + oxlint config, including renders buildings, terrain and shadows, which drives the sun rig through the real scene
  • CI green on c01a746 — Lint, Typecheck, Unit, E2E, Conventional Commits and the Vercel preview deploy

🤖 Generated with Claude Code

https://claude.ai/code/session_01K4oDM5mtBbAtyPEZg9vKy8

suncalc 1.9 -> 2.0.2 is the breaking one. 2.0 is ESM with named exports,
reports degrees instead of radians, and measures azimuth north-based
clockwise where 1.x measured it from south toward west. A mechanical
import fix would have compiled and shipped the sun rotated 180 degrees,
so lib/city/sun.ts flips both horizontal signs to match:

    east:  -cos(alt)*sin(az_south)  ->  cos(alt)*sin(az_north)
    north: -cos(alt)*cos(az_south)  ->  cos(alt)*cos(az_north)

Checked against 1.9 over 360 sampled instants at Dresden: max deviation
1.0e-15, i.e. the rewrite is the same vector. What does change is that
2.0 applies atmospheric refraction, so the sun sits up to 0.70 deg
higher near the horizon (negligible when it is high) - a real accuracy
gain for golden-hour lighting and low-sun shadow length. suncalc now
ships its own types, so @types/suncalc is gone; the pin stays exact
because a silent float here rotates the sun rather than failing.
sun.test.ts gains a midwinter-noon case and narrows the now-nullable
sunrise.

Also:
- Drop @typescript/native-preview and run `tsc --noEmit`. It was a
  frozen July daily build of the TS 7 preview, so three compilers
  checked this repo and a green `verify` did not predict a green build.
  One compiler now serves typecheck, `next build` and ESLint's typed
  rules; it costs ~8 s. TS 7 stays out until typescript-eslint accepts
  it (peer `typescript <6.1.0`).
- ESLint 9.39.4 -> 9.39.5 and Biome 2.5.0 -> 2.5.14 (clean, verified).
  ultracite stays at 7.8.3: 7.12.0 enables ~10 new rule families for
  451 violations, which is a style refactor, not a dependency bump.
- `eslint --max-warnings=0` now gates lint. The count was already 0.
- geotiff moves to devDependencies (only scripts/prepare-data.ts imports
  it, at build time); @types/proj4 goes (a deprecated stub - proj4 ships
  its own types); n8ao/postprocessing/three-mesh-bvh get the exact pins
  AGENTS.md already claimed for the three.js stack.
- Delete types/three-mesh-bvh.d.ts: the package declares the same
  `module 'three'` augmentation itself, and more completely (it covers
  BatchedMesh too). skipLibCheck was hiding the disagreement.
- tsconfig target ES2017 -> ES2022. allowJs stays: `next build` rewrites
  the file to put it back, so removing it dirties the tree every build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K4oDM5mtBbAtyPEZg9vKy8
actions/checkout v6 -> v7. The headline change is that v7 refuses to
check out fork PR code under `pull_request_target` / `workflow_run` by
default (the "pwn request" class). That is a no-op for us and safe to
take: ci.yml only runs on `pull_request` / `push`, and pr-title.yml -
the one `pull_request_target` workflow - never checks out at all. What
we get is the ESM migration and the dependency security fixes.

actions/cache v5 -> v6. ESM plus updated toolkit; v6.1.0 carries
actions/toolkit#2435, which handles a cache write failing on a
read-only token instead of warning. That is exactly the e2e job's case
on fork PRs, where both the .next/cache and Playwright-browser saves
run with a read-only token.

upload-artifact (v7), setup-bun (v2) and action-semantic-pull-request
(v6) are already on their latest majors.

Dependabot's npm budget goes 5 -> 10. Superseded PRs hold a slot until
someone closes them, so at 5 a single stale major starves every other
group - which is how Biome, ultracite, ESLint and @types/node sat
still since June.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K4oDM5mtBbAtyPEZg9vKy8
.mcp.json ran `npx -y next-devtools-mcp@latest` on every session: an
unpinned package fetched outside the lockfile, invisible to Dependabot
and `bun audit`, and against the pinning convention the neighbouring
shadcn entry already follows. Pinned to 0.4.0 (current).

.claude/settings.json is committed, so its allowlist applies to every
agent in the repo. Dropped `Bash(node -e ' *)` and `Bash(python3 -)`,
which pre-approve running arbitrary code, and five
`Bash(node shoot.mjs ...)` grants for a file that no longer exists.
Replaced two single-use literals with the patterns they were reaching
for (`extract-*.sh`, `ogrinfo`). 22 entries -> 15. Anyone who wants the
interpreter grants back can put them in the untracked
settings.local.json.

skills-lock.json locked `next-best-practices` and
`next-cache-components` from vercel-labs/next-skills; neither is
installed under .agents/skills/. Lock and tree now agree at 13 each.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K4oDM5mtBbAtyPEZg9vKy8
Each deferral gets its blocker so the next run does not re-derive it:
ultracite 7.12 (451 violations across ~10 newly enabled rule families -
Biome 2.5.14 alone is clean, so it is a style decision), ESLint 10
(three eslint-config-next plugins still cap their peer at ^9;
typescript-eslint 8.70 does now accept ^10), TypeScript 7
(typescript-eslint peers `<6.1.0`), n8ao 2 (no types, and it changes
SSAO output, which AGENTS.md says needs the --headed harness on a real
GPU), and bun 1.4.2 (needs a machine on that version to regenerate the
lockfile). postprocessing 7 is alpha/beta only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K4oDM5mtBbAtyPEZg9vKy8
@vercel

vercel Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
bridge Ready Ready Preview Sep 21, 2026 9:37am UTC

Request Review

`packageManager` drove both halves: CI reads it through setup-bun's
`bun-version-file`, and it is the runtime every script here runs on
(`bun test`, `scripts/prepare-data.ts`), so one pin covers build and run.

It also closes the skew with `@types/bun`, which has been on ^1.4.2 while
the runtime sat at 1.3.11.

Validated on a real 1.4.2 install rather than assumed - that was the only
reason plan 013 held this back. `bun install --frozen-lockfile` is clean
and `bun.lock` does not change at all under 1.4.2, so CI's frozen install
keeps working and there is no lockfile-format churn to review. `verify`
(lint + typecheck + 149 unit tests) and `next build` both pass on it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K4oDM5mtBbAtyPEZg9vKy8
TypeScript 7.0.2 is the native compiler. `bun typecheck` drops 7.8s ->
1.6s and `next build`'s type pass 8.4s -> 2.4s, and both now run the
same TS 7, so there is still exactly one type-checking authority.

The catch is what the TS 7 npm package *is*: per-platform native
binaries plus a `tsc` launcher. It ships no `lib/typescript.js`, so the
classic JS compiler API is gone. typescript-eslint consumes that API and
does not merely warn - it crashes before ESLint can even load its config
(`Cannot read properties of undefined (reading 'Cjs')`), and no
typescript-eslint channel, canary included, accepts `typescript >=7`.

So ESLint goes and oxlint takes over. oxlint carries its own Rust parser
and no TypeScript dependency at all, so it cannot hit that wall.

Coverage was checked rule by rule, not assumed. Of the 86 rules
`eslint-config-next` had enabled here, oxlint covers 61 - including all
21 Next.js rules, jsx-a11y, and the React-Compiler-era react rules that
matter with `reactCompiler: true`. Biome (already in the gate via
ultracite) covers the remainder, verified by probing real violations:
rules-of-hooks -> useHookAtTopLevel, exhaustive-deps ->
useExhaustiveDependencies, plus noTsIgnore, noVar, useConst,
noExplicitAny, noNamespace, noBannedTypes, noArguments,
noUnusedVariables.

Four low-severity rules land nowhere and are called out in AGENTS.md:
react/display-name, react/no-unescaped-entities,
import/no-anonymous-default-export and
@next/next/no-location-assign-relative-destination. The last has no
current exposure - nothing in the repo calls `location.assign`.

oxfmt is deliberately NOT added: biome already formats this repo, and a
second formatter would both fight it and reflow every file.

Details:
- `.oxlintrc.json` mirrors the old `globalIgnores` and turns off
  `oxc/erasing-op` for terrain-geometry.ts, where `0 * n` is deliberate
  row-index arithmetic kept symmetric with the `(n - 1) * n` line.
- `bun lint` is `oxlint --max-warnings=0 && ultracite check`; the gate
  still fails on the first warning.
- `.vscode/settings.json` drops `js/ts.tsdk.path`: TS 7 ships no
  `tsserver` at that path, so pointing the editor there only errors.
- Dependabot's `next` and `lint-and-format` groups lose `eslint*` and
  gain `oxlint`.

Dropping ESLint takes the install from 703 packages to 502.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K4oDM5mtBbAtyPEZg9vKy8
@mdugue mdugue changed the title build: migrate to suncalc 2 and bring the dependency/CI surface current build: suncalc 2, TypeScript 7, bun 1.4.2, and oxlint in place of ESLint Sep 21, 2026
The oxlint coverage audit in the previous commit was measured against
`oxlint --print-config`, which lists only the rules currently ENABLED --
and oxlint's default is the `correctness` category alone. The full
catalogue is 653 rules (`--print-config -D all`).

Four of the five rules that audit reported as lost do exist:
`react/rules-of-hooks`, `react/display-name`,
`react/no-unescaped-entities` and `react/jsx-no-comment-textnodes`, plus
`import/no-anonymous-default-export`. They were simply not on. Each is
now named explicitly in `.oxlintrc.json`, and `rules-of-hooks` and
`no-unescaped-entities` were re-probed against a deliberate violation to
confirm they fire from the config alone, with no CLI flags.

`rules-of-hooks` is the one that mattered: biome's `useHookAtTopLevel`
was covering it, so the gate never had a hole, but relying on that was
an accident rather than a decision.

That leaves exactly one rule from the old ESLint set with no home:
`@next/next/no-location-assign-relative-destination`. Nothing in the
repo calls `location.assign`.

`bun run verify` and `oxlint --max-warnings=0` stay green on the real
codebase with all five enabled -- they found nothing to report.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K4oDM5mtBbAtyPEZg9vKy8
@mdugue
mdugue marked this pull request as ready for review September 21, 2026 09:43
@mdugue
mdugue merged commit a1a1f48 into main Sep 21, 2026
7 checks passed

This branch was successfully deployed

1 active deployment
Preview — c01a7468 Deployed Sep 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants