Skip to content

chore: migrate to oxlint, oxfmt and typescript 7 - #1927

Merged
joshunrau merged 2 commits into
DouglasNeuroInformatics:mainfrom
joshunrau:chore/oxlint-oxfmt-ts7
Nov 19, 2026
Merged

joshunrau merged 2 commits into
DouglasNeuroInformatics:mainfrom
joshunrau:chore/oxlint-oxfmt-ts7

Conversation

@joshunrau

Copy link
Copy Markdown
Collaborator

Replaces ESLint with oxlint and Prettier with oxfmt, and moves every workspace except apps/outreach from TypeScript 6 to the native TypeScript 7 compiler. On the maintainer's machine pnpm lint went from 53s to 23s and pnpm format from 11s to 2s.

Changes

  • pnpm lint runs tsc && oxlint --fix per workspace, with type-aware rules through oxlint-tsgolint. The effective rule set per file kind is the one ESLint applied, except for the rules listed under Decisions and Risks.
  • The base rule set and the repo's custom rules live in a new workspace, packages/oxlint-config. The root oxlint.config.ts extends it and holds the path-scoped overrides.
  • The custom rules' ids change from odc/<rule> to opendatacapture/<rule>, and they are now type-checked and unit-tested.
  • no-restricted-syntax is gone: the process.env ban in apps/api and the axios.create ban in apps/web and packages/react-core are no-restricted-properties entries, and the check that every controller handler carries @RouteAccess is the new rule opendatacapture/require-route-access.
  • require-disable-reason also requires a reason on oxlint-disable comments.
  • .astro frontmatter is linted with the JS and TypeScript rules, which ESLint never applied to it.
  • pnpm format and the pre-commit hook run oxfmt. It also sorts imports, package.json keys and Tailwind classes; vendor/ is excluded.
  • An unsorted import no longer fails pnpm lint or CI: import order is only enforced by the pre-commit hook.
  • typescript is 7.0.x at the root, @douglasneuroinformatics/tsconfig is 3.0.0, and the root pnpm.overrides.typescript is removed. apps/outreach carries its own typescript 6.0.x, which astro check and typedoc resolve.
  • prisma-json-types-generator 3.6.2 is patched to load the compiler API from @typescript/typescript6.
  • @douglasneuroinformatics/libnest moves from 10 to 11 and @douglasneuroinformatics/libpasswd from 0.0.3 to 0.0.4; type-fest@6.0.1, which the latter needs, is exempted from minimumReleaseAge.
  • prettier becomes a declared dependency of apps/playground, which imports it at runtime as Monaco's formatter and had been resolving it through the root.
  • packages/runtime-internal/src/index.d.ts and packages/runtime-meta/src/index.d.ts are renamed to types.d.ts. The published runtime still serves @opendatacapture/runtime-internal/index.d.ts.
  • React's forwardRef is removed from apps/playground and apps/web; those components take ref as a prop.

Decisions

  • Patch prisma-json-types-generator rather than upgrade it. Under TypeScript 7 version 3.6.2 exits 0 and rewrites nothing. Its 6.x line drops TypeScript altogether and produced identical types here, but it requires Prisma 7 and prints a warning on every prisma generate under Prisma 6. A scoped pnpm.overrides or packageExtensions entry cannot redirect a peer dependency, so the alternative to a patch was aliasing typescript to TypeScript 6 for all of apps/api.
  • eslint-plugin-perfectionist is pinned to 5.9.0, the version ESLint ran. 5.13.0 reports a class in apps/outreach that 5.9.0 accepts; taking it is a separate change.
  • oxlint's own jsx-a11y rules replace eslint-plugin-jsx-a11y. They were not compared with the original rule by rule. Every existing jsx-a11y disable comment still suppresses a diagnostic. The one new diagnostic, a combobox without aria-controls in the playground's instrument selector, is suppressed with its reason: Radix sets the attribute to the popover when it renders the trigger.
  • Four rules that oxlint still classes as nursery stay enabled, for parity: no-undef, no-useless-assignment, typescript/prefer-optional-chain and react/require-render-return.
  • Existing eslint-disable comments are left as they are; oxlint honours them, including @typescript-eslint/<rule> names. Four no longer suppress anything, because oxlint does not report an unused type parameter on a merged declare module interface, or no-misleading-character-class on a RegExp built from a template literal.
  • Nothing checks formatting in lint or CI. The pre-commit hook is the only enforcement, as it was for Prettier.
  • The one-time reformat is limited to what oxfmt prints differently from Prettier, plus the package.json key order. Files Prettier had never formatted are left for the hook to format when they are next staged.
  • Peer-range mismatches that were checked to be harmless are silenced with scoped peerDependencyRules.allowedVersions entries, each with its reason, rather than by allowing TypeScript 7 globally.
  • settings.react.version is 19. The ESLint config said 18; the apps are on 19.

Risks

  • oxlint marks JS plugins as alpha and JS/TS config files as experimental, and both are outside its semver. oxlint, oxlint-tsgolint, @oxlint/plugins and oxfmt are pinned to exact versions, so a break can only arrive with a deliberate bump.
  • oxlint's rules differ from ESLint's at the edges. Not implemented: no-dupe-args, no-octal, react/jsx-uses-react, react/no-deprecated. import/enforce-node-protocol-usage becomes unicorn/prefer-node-protocol. Several rules miss a case ESLint caught, such as typescript/prefer-optional-chain on foo?.bar && foo.bar.baz and react/jsx-no-literals on {'a' + 'b'}. Accepted.
  • The patched generator still fails silently if its TypeScript import ever breaks again: prisma generate exits 0 and only tsc in apps/api notices. The patch names version 3.6.2 exactly and the catalog pins it, so a bump cannot skip the patch unnoticed.
  • libnest 11 is a major release. apps/api type-checks, and its unit and end-to-end tests run against it.
  • An editor needs the oxc extension in place of the ESLint and Prettier ones to lint and format on save.

Notes

The oxlint rule set was compared with ESLint's by resolving both configs for 21 representative file paths: the sets match except for the rules named above. The patched generator writes the same 71 PrismaJson references into the Prisma client as it did under TypeScript 6. turbo prune carries patches/ and packages/oxlint-config into the Docker build context.

Adversarial review

Reviewed at commit 8542432. pnpm check: green.

Findings

  1. apps/playground/src/components/Header/InstrumentSelector/InstrumentSelector.tsx:33 — The new aria-controls={listId} points the combobox at an id that never reaches the DOM, and it replaces the correct aria-controls Radix was already setting. — Move id={listId} from Command.List to Popover.Content, or drop useId and the explicit aria-controls and let Radix supply it, with a reasoned disable for the lint.

Fixed

    1. Dropped the explicit aria-controls and its useId, and suppressed the rule with the reason that Radix sets the attribute at runtime; libui's Popover.Content does not accept an id.

Attestation

I, Claude Fable 5.2, attest that the review block above reports the adversarial review as it ran on the commit named, with every finding it returned.

🤖 Generated with Claude Code

joshunrau and others added 2 commits November 18, 2026 19:35
Replace ESLint with oxlint and Prettier with oxfmt, and move every workspace but
apps/outreach from TypeScript 6 to the native TypeScript 7 compiler.

Linting. The base rule set and the repo's custom rules move into the new
packages/oxlint-config workspace; the custom rules run as an oxlint JS plugin
named opendatacapture, so their ids change from odc/<rule> to
opendatacapture/<rule>. The root oxlint.config.ts extends that config and holds
the path-scoped overrides. typescript-eslint is dropped for oxlint's native
typescript rules with oxlint-tsgolint; react, jsx-a11y, import and vitest rules
are oxlint's own; perfectionist and eslint-plugin-playwright still run, as JS
plugins. no-restricted-syntax has no oxlint equivalent: the process.env and
axios.create bans become no-restricted-properties entries, and the @RouteAccess
check becomes opendatacapture/require-route-access. .astro frontmatter is now
linted with the JS and TypeScript rules.

Formatting. oxfmt takes over import sorting from perfectionist/sort-imports, and
sorts package.json keys and Tailwind classes. The pre-commit hook formats staged
files with it; nothing checks formatting in lint or CI.

TypeScript. typescript@7 has no classic compiler API, so apps/outreach keeps a
TypeScript 6 devDependency for astro check and typedoc, and
prisma-json-types-generator is patched to load the API from
@typescript/typescript6. libnest moves to 11, whose loader no longer depends on
the TypeScript API. The hand-written declarations of runtime-internal and
runtime-meta are renamed to types.d.ts, since TypeScript 7 resolves a JSDoc
import of ./index.d.ts to the sibling index.js.

React's forwardRef is removed from the apps, where ref is a prop under React 19.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…adix

The combobox pointed aria-controls at an id set on the cmdk list, which cmdk
overwrites with its own, so the attribute named an element that never rendered.
It also displaced the aria-controls that Radix's PopoverTrigger sets to the
popover content. Remove the explicit attribute and suppress
jsx-a11y/role-has-required-aria-props there, which cannot see the runtime one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added the Status: Waiting on Review Automated: unreviewed, pushed since the last review, or review re-requested label Nov 19, 2026
@joshunrau
joshunrau merged commit 5e9553f into DouglasNeuroInformatics:main Nov 19, 2026
3 checks passed
@joshunrau
joshunrau deleted the chore/oxlint-oxfmt-ts7 branch November 19, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Waiting on Review Automated: unreviewed, pushed since the last review, or review re-requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant