chore: eslint and mason setup

This commit is contained in:
2026-05-03 23:01:50 +02:00
parent 3325c48cb2
commit 4d10724f93
5 changed files with 109 additions and 36 deletions

45
lua/plugins/linter.lua Normal file
View File

@@ -0,0 +1,45 @@
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,
},
}