feat: Add linters
This commit is contained in:
parent
7db05aa3e3
commit
35f310e0a9
2 changed files with 29 additions and 0 deletions
|
@ -147,6 +147,8 @@ with final.pkgs.lib; let
|
|||
# Linters
|
||||
biome
|
||||
shellcheck
|
||||
statix
|
||||
yamllint
|
||||
|
||||
# Formatters
|
||||
alejandra
|
||||
|
|
|
@ -5,9 +5,36 @@ return {
|
|||
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' },
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue