feat: Add linters

This commit is contained in:
punkfairie 2025-01-05 11:25:37 -08:00
parent 7db05aa3e3
commit 35f310e0a9
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
2 changed files with 29 additions and 0 deletions

View file

@ -147,6 +147,8 @@ with final.pkgs.lib; let
# Linters
biome
shellcheck
statix
yamllint
# Formatters
alejandra

View file

@ -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' },
{