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 the root vite.config.ts so all your configuration stays in one place. We do not recommend using .oxfmtrc.json with Vite+.
When the workspace-root config has a fmt block, vp fmt and vp check use it even when run from a package directory. Package configs cannot replace the root format settings. Commands keep the package working directory, so relative file arguments retain their meaning. Use fmt.overrides for file- or package-specific options.
An explicit vp fmt -c <path> or vp fmt --config <path> selects another config. Otherwise, when running from the workspace root or when the root config has no fmt block, Oxfmt discovers the nearest vite.config.* file with a fmt block. Supported extensions are .js, .mjs, .ts, .cjs, .mts, and .cts. Nested configs do not override settings for individual files.
For editors, disable nested formatter configs to prevent per-file overrides:
{
"oxc.fmt.disableNestedConfig": true
}For the upstream formatter behavior and configuration reference, see the Oxfmt docs.
import { defineConfig } from 'vite-plus';
export default defineConfig({
fmt: {
singleQuote: true,
},
});