chore: eslint and mason setup
This commit is contained in:
45
lua/plugins/linter.lua
Normal file
45
lua/plugins/linter.lua
Normal 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,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user