Skip to Content
Octopus Energy Packages
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 oxfmt

Create an oxfmt config

Create a config.oxfmt.ts file in the root of your project:

config.oxfmt.ts
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:

package.json
{
  "scripts": {
    "check:format": "oxfmt --check",
    "fix:format": "oxfmt --write"
  }
}

Next steps

On this page