48 lines
1.2 KiB
Lua
48 lines
1.2 KiB
Lua
return {
|
|
'nvim-lint',
|
|
event = { 'BufReadPost', 'BufWritePost', 'BufNewFile' },
|
|
after = function()
|
|
local lint = require('lint')
|
|
|
|
lint.linters_by_ft = {
|
|
bash = { 'shellcheck' },
|
|
fish = { 'fish' },
|
|
nix = { 'statix' },
|
|
scss = { 'stylelint' },
|
|
sh = { 'shellcheck' },
|
|
yaml = { 'yamllint' },
|
|
}
|
|
|
|
local linters = {
|
|
shellcheck = {
|
|
args = {
|
|
'-x',
|
|
},
|
|
},
|
|
}
|
|
|
|
for name, linter in pairs(linters) do
|
|
if type(linter) == 'table' and type(lint.linters[name]) == 'table' then
|
|
lint.linters[name] =
|
|
vim.tbl_deep_extend('force', lint.linters[name], linter)
|
|
|
|
if type(linter.prepend_args) == 'table' then
|
|
lint.linters[name].args = lint.linters[name].args or {}
|
|
vim.list_extend(lint.linters[name].args, linter.prepend_args)
|
|
end
|
|
else
|
|
lint.linters[name] = linter
|
|
end
|
|
end
|
|
|
|
vim.api.nvim_create_autocmd(
|
|
{ 'BufWritePost', 'BufReadPost', 'InsertLeave' },
|
|
{
|
|
group = vim.api.nvim_create_augroup('nvim-lint', { clear = true }),
|
|
callback = function()
|
|
require('lint').try_lint()
|
|
end,
|
|
}
|
|
)
|
|
end,
|
|
}
|