31 lines
637 B
Lua
31 lines
637 B
Lua
local ensure = {
|
|
'shellcheck',
|
|
'hadolint',
|
|
'phpstan',
|
|
}
|
|
|
|
return {
|
|
'mfussenegger/nvim-lint',
|
|
event = 'BufWritePre',
|
|
opts = {
|
|
sh = { 'shellcheck' },
|
|
bash = { 'shellcheck' },
|
|
php = { 'phpstan' },
|
|
dockerfile = { 'hadolint' },
|
|
},
|
|
config = function(_, opts)
|
|
for _, pkg in pairs(ensure) do
|
|
local p = require('mason-registry').get_package(pkg)
|
|
if not p:is_installed() then
|
|
p:install()
|
|
end
|
|
end
|
|
require('lint').linters_by_ft = opts
|
|
|
|
vim.api.nvim_create_autocmd({ 'BufWritePost' }, {
|
|
callback = function()
|
|
require('lint').try_lint()
|
|
end,
|
|
})
|
|
end,
|
|
}
|