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..b6a49763f01fb1 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,39 @@ +{ + "semi": false, + "singleQuote": true, + "printWidth": 80, + "sortPackageJson": 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 7ec8a7d08ae3d4..b3d9ec989f44cb 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 e9cbd5d794c3b5..cd6eed00f6df03 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.59.1", - "prettier": "3.8.1", "rolldown": "1.0.0-rc.12", "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 8fd990722cd458..38deee52cb4b41 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.59.1 version: 1.59.1 - prettier: - specifier: 3.8.1 - version: 3.8.1 rolldown: specifier: 1.0.0-rc.12 version: 1.0.0-rc.12 @@ -3266,6 +3266,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==} @@ -6534,6 +6656,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'} @@ -6764,11 +6891,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'} @@ -7511,6 +7633,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.1.0: resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==} engines: {node: '>=14.0.0'} @@ -9418,6 +9544,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': @@ -12832,6 +13015,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 @@ -13036,8 +13243,6 @@ snapshots: premove@4.0.0: {} - prettier@3.8.1: {} - pretty-bytes@7.1.0: {} pretty-ms@9.3.0: @@ -13907,6 +14112,8 @@ snapshots: fdir: 6.5.0(picomatch@4.0.4) picomatch: 4.0.4 + tinypool@2.1.0: {} + tinyrainbow@3.1.0: {} tinyspy@2.2.0: {}