[PR #6262] [MERGED] Move to TypeScript 7 and the oxc toolchain (oxlint + oxfmt) #6203

Closed
opened 2026-11-02 04:07:05 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6262
Author: @MHSanaei
Created: 8/19/2026
Status: ✅ Merged
Merged: 8/19/2026
Merged by: @MHSanaei

Base: main ← Head: chore/typescript-7-oxlint-oxfmt


📝 Commits (7)

  • 9d36537 chore(frontend,docs): move to TypeScript 7 and replace ESLint with oxlint
  • c1837af chore(docs): replace Prettier with oxfmt
  • fa458fb style(frontend): adopt oxfmt and format src
  • 69c9fdc ci: enforce formatting in CI and make verify
  • a76a86b ci: trigger CI on Makefile changes
  • 3c7d0ef fix(frontend): replace deprecated Ant Design 6 APIs in the geo components
  • a894c87 fix(frontend): restore lint rules lost in the oxlint migration, and test the guard

📊 Changes

388 files changed (+19708 additions, -14228 deletions)

View changed files

📝 .github/workflows/ci.yml (+5 -0)
📝 .github/workflows/docs-ci.yml (+3 -0)
📝 CLAUDE.md (+3 -2)
📝 CONTRIBUTING.md (+5 -4)
📝 Makefile (+8 -4)
➕ docs/.oxfmtrc.json (+21 -0)
➕ docs/.oxlintrc.json (+42 -0)
➖ docs/.prettierignore (+0 -10)
➖ docs/.prettierrc.json (+0 -7)
📝 docs/CONTRIBUTING.md (+3 -3)
📝 docs/README.md (+16 -16)
📝 docs/architecture.md (+101 -95)
📝 docs/components/tools/api-request-builder.tsx (+6 -1)
📝 docs/components/tools/routing-builder.tsx (+72 -11)
📝 docs/components/tools/subscription-builder.tsx (+38 -7)
📝 docs/custom-subscription-templates.md (+22 -22)
➖ docs/eslint.config.mjs (+0 -21)
📝 docs/lib/layout.shared.tsx (+8 -1)
📝 docs/lib/site-i18n.ts (+2 -1)
📝 docs/lib/xray/api-client.test.ts (+20 -6)

...and 80 more files

📄 Description

Why

TypeScript 7 is the native Go port and ships no programmatic compiler API — require('typescript') returns ~2 keys instead of ~2248. Every tool that drives the compiler from JS therefore breaks. typescript-eslint peer-pins typescript >=4.8.4 <6.1.0 (canary too) and hard-crashes with "typescript-eslint does not support TS 7.0"; upstream support is tracked in typescript-eslint#10940 and targets TS >= 7.1.

Rather than wait, or carry Microsoft's side-by-side alias (which keeps a second TS 6 install alive purely to feed the linter), both frontend/ and docs/ move to the oxc toolchain, which never depended on the TypeScript API.

What changed

before after
TypeScript 6.0.3 7.0.2
Linter ESLint + typescript-eslint / eslint-config-next oxlint 1.78.0
Formatter Prettier (docs only) oxfmt 0.63.0 (both)
  • Typecheck drops from ~9.7s to ~2.2s; 167 packages leave frontend/.
  • rolldown and oxc-parser/oxc-resolver were already in the tree via Vite 8, so this mostly finishes a migration that had started.

Behaviour is preserved, not tightened

This is deliberately not a chance to turn on new rules:

  • jsx-a11y/prefer-tag-over-role is off in both configs — it is not in jsx-a11y's recommended set (34 rules) nor in eslint-config-next's 6-rule subset, so ESLint never enforced it.
  • The six React-Compiler rules frontend/ deliberately disabled do not exist in oxlint 1.78.0, so they need no entry.
  • oxlint honours the existing eslint-disable comments — including the JSX form {/* eslint-disable-next-line @next/next/no-img-element */} and the old @typescript-eslint/ and react-hooks/ rule names — so no source churn was needed. Verified by deleting them and watching the errors return.

The #6121/#6127 guard survives

oxlint has no no-restricted-syntax, so the cleared-InputNumber guard is reimplemented as an oxlint JS plugin in frontend/tools/oxlint/. It was verified to still fire in pages/settings/** and pages/xray/** and to stay exempt in *Modal.tsx.

The type-aware @deprecated sweep survives too

eslint.deprecated.config.js is replaced by npm run lint:deprecated. oxlint's type-aware mode runs on oxlint-tsgolint, which drives the TS 7 typescript-go checker — the TS 7 move is what makes it possible. It runs in ~1.6s where the ESLint version "tripled the wall-clock time", and it immediately found five deprecated Ant Design 6 props, fixed in the last commit.

One user-visible change

Four of the five deprecation fixes are one-to-one renames with no visual effect. The fifth is not: Input addonAfter has no rename, and antd's documented migration is Space.Compact. In the routing rule form (RuleFormModal.tsx:180, :269, :280) the geo-browser trigger therefore changes from a borderless type="text" icon inside the Input's grey addon box to a regular bordered button whose edge joins the input.

Exact visual parity is not reachable while dropping the deprecated prop — Space.Compact has no addon box to sit in, so type="text" would leave the button floating borderless rather than restoring the old look. The alternatives are this change or keeping addonAfter. Tooltip, aria-label, ref, id and onBlur are unchanged, so the react-hook-form binding and the existing tests address it identically.

Formatting

docs/ swaps Prettier for oxfmt with byte-identical output on every file. frontend/ had never been formatted, so it picks up 344 reformatted files — kept in its own commit so it does not bury the migration or the git blame.

Two gotchas worth knowing:

  • Reflowing moves eslint-disable-next-line comments off the line they guard. This broke two suppressions that had been silently correct; both comments were relocated and re-verified.
  • frontend/.oxfmtrc.json ignores src/generated, and format is scoped to src, because make gen-check and make msw-worker-check byte-compare generated artefacts.

CI

Neither workflow ran format:check — which is exactly how docs/ had already drifted to 18 unformatted files. It is now wired into ci.yml, docs-ci.yml and make verify, and verified to actually fail on drift rather than pass vacuously. Makefile was also missing from ci.yml's path filters, so a change to the canonical task runner could land without any job running.

No workflow referenced ESLint or Prettier by name — they all invoke the package scripts — so the swap needed no other CI changes.

Versions are pinned below latest on purpose

pnpm 11's built-in minimumReleaseAge policy rejects same-day releases. oxlint 1.79.0 and oxfmt 0.64.0 both shipped that day and made pnpm silently append 20 waiver lines to pnpm-workspace.yaml; 1.78.0 / 0.63.0 need no waiver.

Verification

make verify passes, plus the docs gate (typecheck / lint / format:check / test / build). 1159 frontend tests and 105 docs tests pass. Commit 1 was additionally checked out into a clean worktree and verified with a fresh npm ci to confirm no commit leaves a broken intermediate state.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6262 **Author:** [@MHSanaei](https://github.com/MHSanaei) **Created:** 8/19/2026 **Status:** ✅ Merged **Merged:** 8/19/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `chore/typescript-7-oxlint-oxfmt` --- ### 📝 Commits (7) - [`9d36537`](https://github.com/MHSanaei/3x-ui/commit/9d36537675caba8265610260e4470f5ae9225b64) chore(frontend,docs): move to TypeScript 7 and replace ESLint with oxlint - [`c1837af`](https://github.com/MHSanaei/3x-ui/commit/c1837af9df33bb0ebc8d148df648bceb5f76b8ff) chore(docs): replace Prettier with oxfmt - [`fa458fb`](https://github.com/MHSanaei/3x-ui/commit/fa458fb537488bfaa661c41d997961fb5fb62e67) style(frontend): adopt oxfmt and format src - [`69c9fdc`](https://github.com/MHSanaei/3x-ui/commit/69c9fdc937ab840afea1854cf25ff40e45e5cf11) ci: enforce formatting in CI and make verify - [`a76a86b`](https://github.com/MHSanaei/3x-ui/commit/a76a86b9542d07ddacd80d74e5b49dd0e93ba3dd) ci: trigger CI on Makefile changes - [`3c7d0ef`](https://github.com/MHSanaei/3x-ui/commit/3c7d0efb056e4592553f0105906ea94fdb847d07) fix(frontend): replace deprecated Ant Design 6 APIs in the geo components - [`a894c87`](https://github.com/MHSanaei/3x-ui/commit/a894c879905138663e3631d02f1ad03499e834cb) fix(frontend): restore lint rules lost in the oxlint migration, and test the guard ### 📊 Changes **388 files changed** (+19708 additions, -14228 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+5 -0) 📝 `.github/workflows/docs-ci.yml` (+3 -0) 📝 `CLAUDE.md` (+3 -2) 📝 `CONTRIBUTING.md` (+5 -4) 📝 `Makefile` (+8 -4) ➕ `docs/.oxfmtrc.json` (+21 -0) ➕ `docs/.oxlintrc.json` (+42 -0) ➖ `docs/.prettierignore` (+0 -10) ➖ `docs/.prettierrc.json` (+0 -7) 📝 `docs/CONTRIBUTING.md` (+3 -3) 📝 `docs/README.md` (+16 -16) 📝 `docs/architecture.md` (+101 -95) 📝 `docs/components/tools/api-request-builder.tsx` (+6 -1) 📝 `docs/components/tools/routing-builder.tsx` (+72 -11) 📝 `docs/components/tools/subscription-builder.tsx` (+38 -7) 📝 `docs/custom-subscription-templates.md` (+22 -22) ➖ `docs/eslint.config.mjs` (+0 -21) 📝 `docs/lib/layout.shared.tsx` (+8 -1) 📝 `docs/lib/site-i18n.ts` (+2 -1) 📝 `docs/lib/xray/api-client.test.ts` (+20 -6) _...and 80 more files_ </details> ### 📄 Description ## Why TypeScript 7 is the native Go port and ships **no programmatic compiler API** — `require('typescript')` returns ~2 keys instead of ~2248. Every tool that drives the compiler from JS therefore breaks. `typescript-eslint` peer-pins `typescript >=4.8.4 <6.1.0` (canary too) and hard-crashes with *"typescript-eslint does not support TS 7.0"*; upstream support is tracked in typescript-eslint#10940 and targets TS >= 7.1. Rather than wait, or carry Microsoft's side-by-side alias (which keeps a second TS 6 install alive purely to feed the linter), both `frontend/` and `docs/` move to the oxc toolchain, which never depended on the TypeScript API. ## What changed | | before | after | |---|---|---| | TypeScript | 6.0.3 | **7.0.2** | | Linter | ESLint + typescript-eslint / eslint-config-next | **oxlint 1.78.0** | | Formatter | Prettier (docs only) | **oxfmt 0.63.0** (both) | - Typecheck drops from **~9.7s to ~2.2s**; 167 packages leave `frontend/`. - `rolldown` and `oxc-parser`/`oxc-resolver` were already in the tree via Vite 8, so this mostly finishes a migration that had started. ## Behaviour is preserved, not tightened This is deliberately not a chance to turn on new rules: - `jsx-a11y/prefer-tag-over-role` is `off` in both configs — it is **not** in jsx-a11y's `recommended` set (34 rules) nor in eslint-config-next's 6-rule subset, so ESLint never enforced it. - The six React-Compiler rules `frontend/` deliberately disabled do not exist in oxlint 1.78.0, so they need no entry. - oxlint honours the existing `eslint-disable` comments — including the JSX form `{/* eslint-disable-next-line @next/next/no-img-element */}` and the old `@typescript-eslint/` and `react-hooks/` rule names — so no source churn was needed. Verified by deleting them and watching the errors return. ## The #6121/#6127 guard survives oxlint has no `no-restricted-syntax`, so the cleared-`InputNumber` guard is reimplemented as an oxlint JS plugin in `frontend/tools/oxlint/`. It was verified to still fire in `pages/settings/**` and `pages/xray/**` and to stay exempt in `*Modal.tsx`. ## The type-aware `@deprecated` sweep survives too `eslint.deprecated.config.js` is replaced by `npm run lint:deprecated`. oxlint's type-aware mode runs on `oxlint-tsgolint`, which drives the TS 7 `typescript-go` checker — **the TS 7 move is what makes it possible**. It runs in ~1.6s where the ESLint version "tripled the wall-clock time", and it immediately found five deprecated Ant Design 6 props, fixed in the last commit. ## One user-visible change Four of the five deprecation fixes are one-to-one renames with no visual effect. The fifth is not: `Input addonAfter` has no rename, and antd's documented migration is `Space.Compact`. In the routing rule form (`RuleFormModal.tsx:180`, `:269`, `:280`) the geo-browser trigger therefore changes from a borderless `type="text"` icon inside the Input's grey addon box to a regular bordered button whose edge joins the input. Exact visual parity is not reachable while dropping the deprecated prop — `Space.Compact` has no addon box to sit in, so `type="text"` would leave the button floating borderless rather than restoring the old look. The alternatives are this change or keeping `addonAfter`. Tooltip, `aria-label`, `ref`, `id` and `onBlur` are unchanged, so the react-hook-form binding and the existing tests address it identically. ## Formatting `docs/` swaps Prettier for oxfmt with byte-identical output on every file. `frontend/` had never been formatted, so it picks up 344 reformatted files — kept in its own commit so it does not bury the migration or the git blame. Two gotchas worth knowing: - Reflowing moves `eslint-disable-next-line` comments off the line they guard. This broke two suppressions that had been silently correct; both comments were relocated and re-verified. - `frontend/.oxfmtrc.json` ignores `src/generated`, and `format` is scoped to `src`, because `make gen-check` and `make msw-worker-check` byte-compare generated artefacts. ## CI Neither workflow ran `format:check` — which is exactly how `docs/` had already drifted to 18 unformatted files. It is now wired into `ci.yml`, `docs-ci.yml` and `make verify`, and verified to actually fail on drift rather than pass vacuously. `Makefile` was also missing from `ci.yml`'s path filters, so a change to the canonical task runner could land without any job running. No workflow referenced ESLint or Prettier by name — they all invoke the package scripts — so the swap needed no other CI changes. ## Versions are pinned below latest on purpose `pnpm` 11's built-in `minimumReleaseAge` policy rejects same-day releases. oxlint 1.79.0 and oxfmt 0.64.0 both shipped that day and made pnpm silently append 20 waiver lines to `pnpm-workspace.yaml`; 1.78.0 / 0.63.0 need no waiver. ## Verification `make verify` passes, plus the docs gate (`typecheck` / `lint` / `format:check` / `test` / `build`). 1159 frontend tests and 105 docs tests pass. Commit 1 was additionally checked out into a clean worktree and verified with a fresh `npm ci` to confirm no commit leaves a broken intermediate state. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:07:05 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6203
No description provided.