Skip to content

feat: add oxfmt as a formatter option#40

Open
stevan-borus wants to merge 1 commit intocode-forge-io:mainfrom
stevan-borus:feat/oxfmt-formatter
Open

feat: add oxfmt as a formatter option#40
stevan-borus wants to merge 1 commit intocode-forge-io:mainfrom
stevan-borus:feat/oxfmt-formatter

Conversation

@stevan-borus
Copy link
Copy Markdown

Description

Add support for oxfmt (the Oxc formatter) as a third formatter option alongside biome and prettier.

oxfmt >=0.36.0 supports stdin formatting via --stdin-filepath, which follows the same pipe-in/pipe-out pattern already used by biome and prettier. It can format both TypeScript and HTML/SVG files.

Usage

iconsSpritesheet({
  inputDir: './icons',
  outputDir: './output',
  formatter: 'oxfmt',
})

Changes

  • Added "oxfmt" to the Formatter type union
  • Added oxfmt CLI args (--stdin-filepath file.ts / --stdin-filepath file.html) in lintFileContent
  • Refactored formatter options selection from ternary to a Record<Formatter, string[]> map for clarity
  • Updated JSDoc comments
  • Added oxfmt as a devDependency for testing
  • Added tests verifying stdin formatting works for both TypeScript and HTML/SVG

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Algorithm update - updates algorithm documentation/questions/answers etc.
  • Other (please describe):

How Has This Been Tested?

  • Integration tests
  • Unit tests
  • Manual tests
  • No tests required

Unit tests:

  • should format TypeScript via stdin — pipes TS content through oxfmt and verifies semicolons, parenthesized typeof, and content preservation
  • should format HTML/SVG via stdin — pipes SVG content through oxfmt and verifies multi-line formatted output

Manual test steps:

  1. Install oxfmt >=0.36.0 in a project
  2. Configure iconsSpritesheet({ ..., formatter: 'oxfmt' }) in vite.config.ts
  3. Run vite dev
  4. Verify generated types file and SVG spritesheet are formatted by oxfmt

Tested with oxfmt 0.36.0, Vite 7.3.1, and React Router 7.13.1.

Reviewer checklist

  • Check if the UI is working as expected and is satisfactory
  • Check if the code is well documented
  • Check if the behavior is what is expected
  • Check if the code is well tested
  • Check if the code is readable and well formatted
  • Additional checks (document below if any)

Screenshots (if appropriate):

N/A — build-time plugin, no UI changes.

Questions (if appropriate):

N/A

Add support for oxfmt (the Oxc formatter) alongside the existing biome
and prettier options. oxfmt >=0.36.0 supports stdin formatting via
--stdin-filepath, which follows the same pipe-in/pipe-out pattern used
by biome and prettier.

Add oxfmt as a devDependency and tests verifying stdin formatting works
for both TypeScript and HTML/SVG files.
@sairus2k
Copy link
Copy Markdown

sairus2k commented Mar 8, 2026

You could try my fork, I added oxfmt support already

https://github.com/MyEasyFarm/vite-plugin-icons-spritesheet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants