nvim/lua/custom/plugins/conform.lua
Simon Lasbrugnas b700549bf3
feat: enhance typescript configuration
Remove several extensions and add typescript-tools along with conform
and format-ts-errors (could be better but is the best I found)
2025-02-27 14:55:50 +01:00

29 lines
671 B
Lua

return {
'stevearc/conform.nvim',
config = function()
require("conform").setup({
formatters_by_ft = {
html = { "prettierd" },
yaml = { "prettierd" },
javascript = { "prettierd" },
javascriptreact = { "prettierd" },
markdown = { "prettierd" },
typescript = { "prettierd" },
typescriptreact = { "prettierd" },
["*"] = { "trim_whitespace" },
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
formatters = {
prettierd = {
condition = function()
return vim.loop.fs_realpath(".prettierrc.js") ~= nil or
vim.loop.fs_realpath(".prettierrc") ~= nil
end,
},
},
})
end,
}