Oxfmt
Getting Started
Configure oxfmt for formatting and import sorting
@octopus-energy/oxc exports a shared oxfmt configuration for formatting and
import sorting.
Install dependencies
npm i -D @octopus-energy/oxc oxfmtCreate an oxfmt config
Create a config.oxfmt.ts file in the root of your project:
import sharedConfig from "@octopus-energy/oxc/oxfmt/config";
import { defineConfig } from "oxfmt";
export default defineConfig({
...sharedConfig,
ignorePatterns: [
"public/**",
"**/node_modules/**",
"**/dist/**",
"**/.next/**",
"pnpm-lock.yaml",
],
});Add package scripts
Add scripts to format files and check formatting in CI:
{
"scripts": {
"check:format": "oxfmt --check",
"fix:format": "oxfmt --write"
}
}Next steps
- Configuration for ignore patterns, JSON config, and import sorting.
- API reference for the exact shared config values.
- Oxfmt docs for the full upstream guide.
- CI setup to check formatting in pull requests.