From 4e9eac57aba1ea575ef008a503cba8327257e4a4 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 20 Mar 2026 22:15:34 +0100 Subject: [PATCH] feat(oxc): added oxc extra for oxfmt and oxlint --- .../plugins/extras/lang/typescript/oxc.lua | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/typescript/oxc.lua diff --git a/lua/lazyvim/plugins/extras/lang/typescript/oxc.lua b/lua/lazyvim/plugins/extras/lang/typescript/oxc.lua new file mode 100644 index 00000000..4bd3a00d --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/typescript/oxc.lua @@ -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, + }, +}