Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ You can view this list in vim with `:help conform-formatters`
- [odinfmt](https://github.com/DanielGavin/ols) - Auto-formatter for the Odin programming language.
- [opa_fmt](https://www.openpolicyagent.org/docs/latest/cli/#opa-fmt) - Format Rego files using `opa fmt` command.
- [ormolu](https://hackage.haskell.org/package/ormolu) - A formatter for Haskell source code.
- [oxfmt](https://github.com/oxc-project/oxc) - Prettier-compatible code formatter.
- [packer_fmt](https://developer.hashicorp.com/packer/docs/commands/fmt) - The packer fmt Packer command is used to format HCL2 configuration files to a canonical format and style.
- [pangu](https://github.com/vinta/pangu.py) - Insert whitespace between CJK and half-width characters.
- [perlimports](https://github.com/perl-ide/App-perlimports) - Make implicit Perl imports explicit.
Expand Down
19 changes: 19 additions & 0 deletions lua/conform/formatters/oxfmt.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
local util = require("conform.util")

local config_file_names = {
-- https://oxc.rs/docs/guide/usage/formatter.html#configuration-file
".oxfmtrc.json",
".oxfmtrc.jsonc",
}

---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/oxc-project/oxc",
description = "A Prettier-compatible code formatter.",
},
command = util.from_node_modules("oxfmt"),
args = { "$FILENAME" },
stdin = false,
cwd = require("conform.util").root_file(config_file_names),
}