formatting/linting added for lua/ts

This commit is contained in:
RingOfStorms (Joshua Bell) 2024-05-02 12:33:00 -05:00
parent e54f6ee975
commit 61d3aec608
18 changed files with 338 additions and 710 deletions

30
lua/plugins/formatter.lua Normal file
View file

@ -0,0 +1,30 @@
return {
"stevearc/conform.nvim",
opts = {
-- https://github.com/stevearc/conform.nvim?tab=readme-ov-file#setup
notify_on_error = true,
formatters_by_ft = {
lua = { "stylua" },
typescript = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
javascript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
},
},
keys = {
{
"<leader>l<leader>",
function()
require("conform").format({ async = true, lsp_fallback = true }, function(err, edited)
if edited then
print("Formatted!")
else
print("Nothing to format!")
end
end)
end,
mode = { "n", "v", "x" },
desc = "Format buffer",
},
},
}