Format
vp fmt formats code with Oxfmt.
Overview
vp fmt is built on Oxfmt, the Oxc formatter. Oxfmt has full Prettier compatibility and is designed as a fast drop-in replacement for Prettier.
Use vp fmt to format your project, and vp check to format, lint and type-check all at once.
Usage
vp fmt
vp fmt --check
vp fmt . --writeConfiguration
Put formatting configuration directly in the fmt block in vite.config.ts so all your configuration stays in one place. We do not recommend using .oxfmtrc.json with Vite+.
For editors, point the formatter config path at ./vite.config.ts so format-on-save uses the same fmt block:
{
"oxc.fmt.configPath": "./vite.config.ts"
}For the upstream formatter behavior and configuration reference, see the Oxfmt docs.
In monorepos, vp fmt walks up from the current working directory and uses the first vite.config.ts it finds — unlike vp lint, which is cwd-only. See Nested Configuration for the full resolution rules.
import { defineConfig } from 'vite-plus';
export default defineConfig({
fmt: {
singleQuote: true,
},
});