feat(oxc): added oxc extra for oxfmt and oxlint

This commit is contained in:
Folke Lemaitre 2026-03-20 22:15:34 +01:00
parent 9029d928d2
commit 4e9eac57ab
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -0,0 +1,56 @@
local supported = {
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"json",
"jsonc",
"vue",
"svelte",
"astro",
}
return {
recommended = function()
return LazyVim.extras.wants({
root = {
".oxlintrc.json",
".oxlintrc.jsonc",
"oxlint.config.ts",
".oxfmtrc.json",
".oxfmtrc.jsonc",
"oxfmt.config.ts",
},
})
end,
{
"neovim/nvim-lspconfig",
opts = {
servers = {
---@type lspconfig.settings.oxlint
oxlint = {},
--- disable the oxfmt lsp server since we use conform for formatting
oxfmt = { enabled = false },
},
},
},
{
"mason-org/mason.nvim",
opts = { ensure_installed = { "oxfmt" } },
},
{
"stevearc/conform.nvim",
optional = true,
---@param opts conform.setupOpts
opts = function(_, opts)
opts.formatters_by_ft = opts.formatters_by_ft or {}
for _, ft in ipairs(supported) do
opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {}
table.insert(opts.formatters_by_ft[ft], "oxfmt")
end
end,
},
}