mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6262] [MERGED] Move to TypeScript 7 and the oxc toolchain (oxlint + oxfmt) #6203
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6203
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 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)
9d36537chore(frontend,docs): move to TypeScript 7 and replace ESLint with oxlintc1837afchore(docs): replace Prettier with oxfmtfa458fbstyle(frontend): adopt oxfmt and format src69c9fdcci: enforce formatting in CI and make verifya76a86bci: trigger CI on Makefile changes3c7d0effix(frontend): replace deprecated Ant Design 6 APIs in the geo componentsa894c87fix(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-eslintpeer-pinstypescript >=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/anddocs/move to the oxc toolchain, which never depended on the TypeScript API.What changed
frontend/.rolldownandoxc-parser/oxc-resolverwere 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-roleisoffin both configs — it is not in jsx-a11y'srecommendedset (34 rules) nor in eslint-config-next's 6-rule subset, so ESLint never enforced it.frontend/deliberately disabled do not exist in oxlint 1.78.0, so they need no entry.eslint-disablecomments — including the JSX form{/* eslint-disable-next-line @next/next/no-img-element */}and the old@typescript-eslint/andreact-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-InputNumberguard is reimplemented as an oxlint JS plugin infrontend/tools/oxlint/. It was verified to still fire inpages/settings/**andpages/xray/**and to stay exempt in*Modal.tsx.The type-aware
@deprecatedsweep survives tooeslint.deprecated.config.jsis replaced bynpm run lint:deprecated. oxlint's type-aware mode runs onoxlint-tsgolint, which drives the TS 7typescript-gochecker — 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 addonAfterhas no rename, and antd's documented migration isSpace.Compact. In the routing rule form (RuleFormModal.tsx:180,:269,:280) the geo-browser trigger therefore changes from a borderlesstype="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.Compacthas no addon box to sit in, sotype="text"would leave the button floating borderless rather than restoring the old look. The alternatives are this change or keepingaddonAfter. Tooltip,aria-label,ref,idandonBlurare 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:
eslint-disable-next-linecomments off the line they guard. This broke two suppressions that had been silently correct; both comments were relocated and re-verified.frontend/.oxfmtrc.jsonignoressrc/generated, andformatis scoped tosrc, becausemake gen-checkandmake msw-worker-checkbyte-compare generated artefacts.CI
Neither workflow ran
format:check— which is exactly howdocs/had already drifted to 18 unformatted files. It is now wired intoci.yml,docs-ci.ymlandmake verify, and verified to actually fail on drift rather than pass vacuously.Makefilewas also missing fromci.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
pnpm11's built-inminimumReleaseAgepolicy 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 topnpm-workspace.yaml; 1.78.0 / 0.63.0 need no waiver.Verification
make verifypasses, 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 freshnpm cito 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.