From 09336431687c641c18a83e246f95a2f1bef2dd3f Mon Sep 17 00:00:00 2001 From: Dunqing Date: Mon, 2 Mar 2026 22:45:16 +0800 Subject: [PATCH 1/3] chore: migrate to Oxfmt --- .github/workflows/ci.yml | 2 +- .oxfmtrc.json | 39 +++++++ .prettierignore | 16 --- .prettierrc.json | 19 ---- CONTRIBUTING.md | 2 +- netlify.toml | 12 +-- package.json | 6 +- pnpm-lock.yaml | 227 +++++++++++++++++++++++++++++++++++++-- 8 files changed, 267 insertions(+), 56 deletions(-) create mode 100644 .oxfmtrc.json delete mode 100644 .prettierignore delete mode 100644 .prettierrc.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 793fb662abf9c9..a4e1a90ca101c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,7 +169,7 @@ jobs: run: pnpm run lint - name: Check formatting - run: pnpm prettier --write --log-level=warn . && git diff --exit-code + run: pnpm format && git diff --exit-code - name: Typecheck run: pnpm run typecheck diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 00000000000000..957f3a2ef9bdcb --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,39 @@ +{ + "semi": false, + "singleQuote": true, + "printWidth": 80, + "experimentalSortPackageJson": false, + "overrides": [ + { + "files": ["*.json5"], + "options": { + "singleQuote": false, + "quoteProps": "preserve" + } + }, + { + "files": ["*.yml"], + "options": { + "singleQuote": false + } + } + ], + "ignorePatterns": [ + "packages/*/CHANGELOG.md", + "packages/vite/src/node/ssr/__tests__/fixtures/errors/syntax-error.*", + "playground-temp/", + "dist/", + "LICENSE.md", + "pnpm-lock.yaml", + "pnpm-workspace.yaml", + "playground/tsconfig-json-load-error/has-error/tsconfig.json", + "playground/html/invalid.html", + "playground/html/invalidClick.html", + "playground/html/invalidEscape.html", + "playground/html/valid.html", + "playground/external/public/slash@3.0.0.js", + "playground/ssr-html/public/slash@3.0.0.js", + "playground/worker/classic-worker.js", + "playground/css/weapp.wxss" + ] +} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 3db2606045deaf..00000000000000 --- a/.prettierignore +++ /dev/null @@ -1,16 +0,0 @@ -packages/*/CHANGELOG.md -packages/vite/src/node/ssr/__tests__/fixtures/errors/syntax-error.* -playground-temp/ -dist/ -LICENSE.md -pnpm-lock.yaml -pnpm-workspace.yaml -playground/tsconfig-json-load-error/has-error/tsconfig.json -playground/html/invalid.html -playground/html/invalidClick.html -playground/html/invalidEscape.html -playground/html/valid.html -playground/external/public/slash@3.0.0.js -playground/ssr-html/public/slash@3.0.0.js -playground/worker/classic-worker.js -playground/css/weapp.wxss diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index e87784b26fb67a..00000000000000 --- a/.prettierrc.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "semi": false, - "singleQuote": true, - "overrides": [ - { - "files": ["**/*.json5"], - "options": { - "singleQuote": false, - "quoteProps": "preserve" - } - }, - { - "files": ["**/*.yml"], - "options": { - "singleQuote": false - } - } - ] -} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47502f56b1a102..d2376bae749bf8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -248,7 +248,7 @@ For a mock dependency, make sure you add a `@vitejs/test-` prefix to the package - Make sure tests pass! -- No need to worry about code style as long as you have installed the dev dependencies. Modified files are automatically formatted with Prettier on commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks)). +- No need to worry about code style as long as you have installed the dev dependencies. Modified files are automatically formatted with Oxfmt on commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks)). - PR title must follow the [commit message convention](./.github/commit-convention.md) so that changelogs can be automatically generated. diff --git a/netlify.toml b/netlify.toml index 5245ce766e8f31..e1c7a292c43e89 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,8 +1,8 @@ [build.environment] - NODE_VERSION = "24" - # don't need playwright for docs build - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1" +NODE_VERSION = "24" +# don't need playwright for docs build +PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1" [build] - publish = "docs/.vitepress/dist" - command = "pnpm ci-docs" - ignore = "./scripts/docs-check.sh" +publish = "docs/.vitepress/dist" +command = "pnpm ci-docs" +ignore = "./scripts/docs-check.sh" diff --git a/package.json b/package.json index 82017d122d3628..7f08dc41bf6cff 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "scripts": { "preinstall": "npx only-allow pnpm", "postinstall": "simple-git-hooks", - "format": "prettier --write --cache . --experimental-cli", + "format": "oxfmt", "lint": "eslint --cache . --concurrency auto", "typecheck": "tsc -p scripts && pnpm -r --parallel run typecheck", "test": "pnpm test-unit && pnpm test-serve && pnpm test-build", @@ -61,9 +61,9 @@ "execa": "^9.6.1", "globals": "^17.4.0", "lint-staged": "^16.4.0", + "oxfmt": "^0.42.0", "picocolors": "^1.1.1", "playwright-chromium": "^1.58.2", - "prettier": "3.8.1", "rolldown": "1.0.0-rc.11", "rollup": "^4.59.0", "simple-git-hooks": "^2.13.1", @@ -78,7 +78,7 @@ }, "lint-staged": { "*": [ - "prettier --write --cache --ignore-unknown --experimental-cli" + "oxfmt --no-error-on-unmatched-pattern" ], "packages/*/{src,types}/**/*.ts": [ "eslint --cache --fix --concurrency auto" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd544a53cd87cd..69b894f81e5f7e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,15 +86,15 @@ importers: lint-staged: specifier: ^16.4.0 version: 16.4.0 + oxfmt: + specifier: ^0.42.0 + version: 0.42.0 picocolors: specifier: ^1.1.1 version: 1.1.1 playwright-chromium: specifier: ^1.58.2 version: 1.58.2 - prettier: - specifier: 3.8.1 - version: 3.8.1 rolldown: specifier: 1.0.0-rc.11 version: 1.0.0-rc.11 @@ -3092,6 +3092,128 @@ packages: '@oxc-project/types@0.122.0': resolution: {integrity: sha512-oLAl5kBpV4w69UtFZ9xqcmTi+GENWOcPF7FCrczTiBbmC0ibXxCwyvZGbO39rCVEuLGAZM84DH0pUIyyv/YJzA==} + '@oxfmt/binding-android-arm-eabi@0.42.0': + resolution: {integrity: sha512-dsqPTYsozeokRjlrt/b4E7Pj0z3eS3Eg74TWQuuKbjY4VttBmA88rB7d50Xrd+TZ986qdXCNeZRPEzZHAe+jow==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxfmt/binding-android-arm64@0.42.0': + resolution: {integrity: sha512-t+aAjHxcr5eOBphFHdg1ouQU9qmZZoRxnX7UOJSaTwSoKsb6TYezNKO0YbWytGXCECObRqNcUxPoPr0KaraAIg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxfmt/binding-darwin-arm64@0.42.0': + resolution: {integrity: sha512-ulpSEYMKg61C5bRMZinFHrKJYRoKGVbvMEXA5zM1puX3O9T6Q4XXDbft20yrDijpYWeuG59z3Nabt+npeTsM1A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxfmt/binding-darwin-x64@0.42.0': + resolution: {integrity: sha512-ttxLKhQYPdFiM8I/Ri37cvqChE4Xa562nNOsZFcv1CKTVLeEozXjKuYClNvxkXmNlcF55nzM80P+CQkdFBu+uQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxfmt/binding-freebsd-x64@0.42.0': + resolution: {integrity: sha512-Og7QS3yI3tdIKYZ58SXik0rADxIk2jmd+/YvuHRyKULWpG4V2fR5V4hvKm624Mc0cQET35waPXiCQWvjQEjwYQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxfmt/binding-linux-arm-gnueabihf@0.42.0': + resolution: {integrity: sha512-jwLOw/3CW4H6Vxcry4/buQHk7zm9Ne2YsidzTL1kpiMe4qqrRCwev3dkyWe2YkFmP+iZCQ7zku4KwjcLRoh8ew==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxfmt/binding-linux-arm-musleabihf@0.42.0': + resolution: {integrity: sha512-XwXu2vkMtiq2h7tfvN+WA/9/5/1IoGAVCFPiiQUvcAuG3efR97KNcRGM8BetmbYouFotQ2bDal3yyjUx6IPsTg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxfmt/binding-linux-arm64-gnu@0.42.0': + resolution: {integrity: sha512-ea7s/XUJoT7ENAtUQDudFe3nkSM3e3Qpz4nJFRdzO2wbgXEcjnchKLEsV3+t4ev3r8nWxIYr9NRjPWtnyIFJVA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-arm64-musl@0.42.0': + resolution: {integrity: sha512-+JA0YMlSdDqmacygGi2REp57c3fN+tzARD8nwsukx9pkCHK+6DkbAA9ojS4lNKsiBjIW8WWa0pBrBWhdZEqfuw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@oxfmt/binding-linux-ppc64-gnu@0.42.0': + resolution: {integrity: sha512-VfnET0j4Y5mdfCzh5gBt0NK28lgn5DKx+8WgSMLYYeSooHhohdbzwAStLki9pNuGy51y4I7IoW8bqwAaCMiJQg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-riscv64-gnu@0.42.0': + resolution: {integrity: sha512-gVlCbmBkB0fxBWbhBj9rcxezPydsQHf4MFKeHoTSPicOQ+8oGeTQgQ8EeesSybWeiFPVRx3bgdt4IJnH6nOjAA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-riscv64-musl@0.42.0': + resolution: {integrity: sha512-zN5OfstL0avgt/IgvRu0zjQzVh/EPkcLzs33E9LMAzpqlLWiPWeMDZyMGFlSRGOdDjuNmlZBCgj0pFnK5u32TQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@oxfmt/binding-linux-s390x-gnu@0.42.0': + resolution: {integrity: sha512-9X6+H2L0qMc2sCAgO9HS03bkGLMKvOFjmEdchaFlany3vNZOjnVui//D8k/xZAtQv2vaCs1reD5KAgPoIU4msA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-x64-gnu@0.42.0': + resolution: {integrity: sha512-BajxJ6KQvMMdpXGPWhBGyjb2Jvx4uec0w+wi6TJZ6Tv7+MzPwe0pO8g5h1U0jyFgoaF7mDl6yKPW3ykWcbUJRw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-x64-musl@0.42.0': + resolution: {integrity: sha512-0wV284I6vc5f0AqAhgAbHU2935B4bVpncPoe5n/WzVZY/KnHgqxC8iSFGeSyLWEgstFboIcWkOPck7tqbdHkzA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@oxfmt/binding-openharmony-arm64@0.42.0': + resolution: {integrity: sha512-p4BG6HpGnhfgHk1rzZfyR6zcWkE7iLrWxyehHfXUy4Qa5j3e0roglFOdP/Nj5cJJ58MA3isQ5dlfkW2nNEpolw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxfmt/binding-win32-arm64-msvc@0.42.0': + resolution: {integrity: sha512-mn//WV60A+IetORDxYieYGAoQso4KnVRRjORDewMcod4irlRe0OSC7YPhhwaexYNPQz/GCFk+v9iUcZ2W22yxQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxfmt/binding-win32-ia32-msvc@0.42.0': + resolution: {integrity: sha512-3gWltUrvuz4LPJXWivoAxZ28Of2O4N7OGuM5/X3ubPXCEV8hmgECLZzjz7UYvSDUS3grfdccQwmjynm+51EFpw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxfmt/binding-win32-x64-msvc@0.42.0': + resolution: {integrity: sha512-Wg4TMAfQRL9J9AZevJ/ZNy3uyyDztDYQtGr4P8UyyzIhLhFrdSmz1J/9JT+rv0fiCDLaFOBQnj3f3K3+a5PzDQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + '@package-json/types@0.0.12': resolution: {integrity: sha512-uu43FGU34B5VM9mCNjXCwLaGHYjXdNincqKLaraaCW+7S2+SmiBg1Nv8bPnmschrIfZmfKNY9f3fC376MRrObw==} @@ -6340,6 +6462,11 @@ packages: resolution: {integrity: sha512-XziD0au8etayM2zJnqcSiW+Pn3hEpqHsbwfL7G4Ej0SwqfvbIjiEF1/uNqONuHl0n9LkLI1ez378vSWZRJZWAQ==} engines: {node: ^20.19.0 || >=22.12.0} + oxfmt@0.42.0: + resolution: {integrity: sha512-QhejGErLSMReNuZ6vxgFHDyGoPbjTRNi6uGHjy0cvIjOQFqD6xmr/T+3L41ixR3NIgzcNiJ6ylQKpvShTgDfqg==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -6570,11 +6697,6 @@ packages: engines: {node: '>=6'} hasBin: true - prettier@3.8.1: - resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==} - engines: {node: '>=14'} - hasBin: true - pretty-bytes@7.1.0: resolution: {integrity: sha512-nODzvTiYVRGRqAOvE84Vk5JDPyyxsVk0/fbA/bq7RqlnhksGpset09XTxbpvLTIjoaF7K8Z8DG8yHtKGTPSYRw==} engines: {node: '>=20'} @@ -7317,6 +7439,10 @@ packages: resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} engines: {node: '>=12.0.0'} + tinypool@2.1.0: + resolution: {integrity: sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==} + engines: {node: ^20.0.0 || >=22.0.0} + tinyrainbow@3.0.3: resolution: {integrity: sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q==} engines: {node: '>=14.0.0'} @@ -9143,6 +9269,63 @@ snapshots: '@oxc-project/types@0.122.0': {} + '@oxfmt/binding-android-arm-eabi@0.42.0': + optional: true + + '@oxfmt/binding-android-arm64@0.42.0': + optional: true + + '@oxfmt/binding-darwin-arm64@0.42.0': + optional: true + + '@oxfmt/binding-darwin-x64@0.42.0': + optional: true + + '@oxfmt/binding-freebsd-x64@0.42.0': + optional: true + + '@oxfmt/binding-linux-arm-gnueabihf@0.42.0': + optional: true + + '@oxfmt/binding-linux-arm-musleabihf@0.42.0': + optional: true + + '@oxfmt/binding-linux-arm64-gnu@0.42.0': + optional: true + + '@oxfmt/binding-linux-arm64-musl@0.42.0': + optional: true + + '@oxfmt/binding-linux-ppc64-gnu@0.42.0': + optional: true + + '@oxfmt/binding-linux-riscv64-gnu@0.42.0': + optional: true + + '@oxfmt/binding-linux-riscv64-musl@0.42.0': + optional: true + + '@oxfmt/binding-linux-s390x-gnu@0.42.0': + optional: true + + '@oxfmt/binding-linux-x64-gnu@0.42.0': + optional: true + + '@oxfmt/binding-linux-x64-musl@0.42.0': + optional: true + + '@oxfmt/binding-openharmony-arm64@0.42.0': + optional: true + + '@oxfmt/binding-win32-arm64-msvc@0.42.0': + optional: true + + '@oxfmt/binding-win32-ia32-msvc@0.42.0': + optional: true + + '@oxfmt/binding-win32-x64-msvc@0.42.0': + optional: true + '@package-json/types@0.0.12': {} '@parcel/watcher-android-arm64@2.5.6': @@ -12514,6 +12697,30 @@ snapshots: '@oxc-minify/binding-win32-ia32-msvc': 0.121.0 '@oxc-minify/binding-win32-x64-msvc': 0.121.0 + oxfmt@0.42.0: + dependencies: + tinypool: 2.1.0 + optionalDependencies: + '@oxfmt/binding-android-arm-eabi': 0.42.0 + '@oxfmt/binding-android-arm64': 0.42.0 + '@oxfmt/binding-darwin-arm64': 0.42.0 + '@oxfmt/binding-darwin-x64': 0.42.0 + '@oxfmt/binding-freebsd-x64': 0.42.0 + '@oxfmt/binding-linux-arm-gnueabihf': 0.42.0 + '@oxfmt/binding-linux-arm-musleabihf': 0.42.0 + '@oxfmt/binding-linux-arm64-gnu': 0.42.0 + '@oxfmt/binding-linux-arm64-musl': 0.42.0 + '@oxfmt/binding-linux-ppc64-gnu': 0.42.0 + '@oxfmt/binding-linux-riscv64-gnu': 0.42.0 + '@oxfmt/binding-linux-riscv64-musl': 0.42.0 + '@oxfmt/binding-linux-s390x-gnu': 0.42.0 + '@oxfmt/binding-linux-x64-gnu': 0.42.0 + '@oxfmt/binding-linux-x64-musl': 0.42.0 + '@oxfmt/binding-openharmony-arm64': 0.42.0 + '@oxfmt/binding-win32-arm64-msvc': 0.42.0 + '@oxfmt/binding-win32-ia32-msvc': 0.42.0 + '@oxfmt/binding-win32-x64-msvc': 0.42.0 + p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 @@ -12718,8 +12925,6 @@ snapshots: premove@4.0.0: {} - prettier@3.8.1: {} - pretty-bytes@7.1.0: {} pretty-ms@9.3.0: @@ -13588,6 +13793,8 @@ snapshots: fdir: 6.5.0(picomatch@4.0.3) picomatch: 4.0.3 + tinypool@2.1.0: {} + tinyrainbow@3.0.3: {} tinyspy@2.2.0: {} From 11b8df43f680ca5b29b90bf04c0fd4bbf07f38f0 Mon Sep 17 00:00:00 2001 From: Dunqing Date: Wed, 25 Mar 2026 10:02:24 +0800 Subject: [PATCH 2/3] Update .oxfmtrc.json Co-authored-by: Yuji Sugiura <6259812+leaysgur@users.noreply.github.com> --- .oxfmtrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.oxfmtrc.json b/.oxfmtrc.json index 957f3a2ef9bdcb..1318a583dd4a25 100644 --- a/.oxfmtrc.json +++ b/.oxfmtrc.json @@ -2,7 +2,7 @@ "semi": false, "singleQuote": true, "printWidth": 80, - "experimentalSortPackageJson": false, + "sortPackageJson": false, "overrides": [ { "files": ["*.json5"], From a57a7e4c66973e0f30f0b0e3b04e2391e90e5148 Mon Sep 17 00:00:00 2001 From: Dunqing Date: Wed, 25 Mar 2026 10:08:50 +0800 Subject: [PATCH 3/3] update --- .oxfmtrc.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.oxfmtrc.json b/.oxfmtrc.json index 1318a583dd4a25..b6a49763f01fb1 100644 --- a/.oxfmtrc.json +++ b/.oxfmtrc.json @@ -5,14 +5,14 @@ "sortPackageJson": false, "overrides": [ { - "files": ["*.json5"], + "files": ["**/*.json5"], "options": { "singleQuote": false, "quoteProps": "preserve" } }, { - "files": ["*.yml"], + "files": ["**/*.yml"], "options": { "singleQuote": false }