Files
nvim-config/lua/plugins/linter.lua

46 lines
1.1 KiB
Lua

return {
{
"mfussenegger/nvim-lint",
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
opts = {
linters_by_ft = {
fish = { "fish" },
css = { "stylelint" },
scss = { "stylelint" },
ts = { "eslint_d" },
js = { "eslint_d" },
jsx = { "eslint_d" },
tsx = { "eslint_d" },
-- Use the "*" filetype to run linters on all filetypes.
-- ['*'] = { 'global linter' },
-- Use the "_" filetype to run linters on filetypes that don't have other linters configured.
-- ['_'] = { 'fallback linter' },
-- ["*"] = { "typos" },
},
},
config = function()
local lint = require("lint")
lint.linters_by_ft = {
javascript = { "biomejs" },
typescript = { "eslint_d" },
javascriptreact = { "biomejs" },
typescriptreact = { "biomejs" },
svelte = { "biomejs" },
python = { "ruff" },
go = { "golangcilint" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
end,
},
}