(nvim) add linter plugin

This commit is contained in:
jc 2025-03-04 18:03:39 -05:00
commit a1f90fcd49
No known key found for this signature in database
2 changed files with 51 additions and 13 deletions

View file

@ -0,0 +1,39 @@
local linters_by_ft = {
javascript = { "biomejs" },
typescript = { "biomejs" },
javascriptreact = { "biomejs" },
typescriptreact = { "biomejs" },
jsonc = { "biomejs" },
json = { "biomejs" },
css = { "biomejs" },
}
return {
"mfussenegger/nvim-lint",
event = { "BufWritePost" },
keys = {
{
"<leader>lf",
function()
require("lint").try_lint()
end,
mode = "n",
desc = "[L]int [F]ile",
},
},
config = function()
local lint = require("lint")
lint.linters_by_ft = linters_by_ft
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
lint.try_lint()
end,
})
vim.api.nvim_create_user_command("Lint", function()
lint.try_lint()
end, { desc = "Lint file" })
end,
}