r/astrojs • u/ElianCodes • 6h ago
Oxfmt now supports formatting .astro files!
For those using Oxfmt or Vite+ in their Astro projects, you can now format .astro files too!
It’s disabled by default, but enabling it is as simple as adding astro: true to your formatter config.
One small gotcha: you also need to install astrojs/compiler-rs as a dev dependency.
Under the hood, Oxfmt uses prettier-plugin-astro, so you no longer need a separate Prettier setup just for your Astro files.
Oxlint still only lints the script parts of .astro files, though. No template linting yet.
I wrote a short blog post about setting it up on my own website, including some before/after examples and configuration options:
https://elian.codes/blog/26-12-02-formatting-astro-files-with-oxfmt