From 0a5c8fb4759369404b73c2ae70ffdaaa3ee8572d Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sun, 16 Mar 2025 16:35:28 -0700 Subject: [PATCH] feat: Add linters --- flake.nix | 7 +++++++ lua/config/options.lua | 7 +++++++ lua/plugins/nvim-lint.lua | 13 ++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 0b4a197..667861f 100644 --- a/flake.nix +++ b/flake.nix @@ -76,8 +76,12 @@ biome codespell curl + deadnix + djlint docker-compose-language-service dockerfile-language-server-nodejs + dotenv-linter + editorconfig-checker emmet-language-server fd fish-lsp @@ -87,12 +91,14 @@ grpcurl hadolint helm-ls + htmlhint jq lazygit lua-language-server markdownlint-cli2 marksman nil + nodePackages.alex nodePackages.prettier npm-modules.css-variables-language-server npm-modules.gh-actions-language-server @@ -126,6 +132,7 @@ vue-language-server yaml-language-server yamllint + zizmor ]; }; diff --git a/lua/config/options.lua b/lua/config/options.lua index 7146817..8273b82 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -2,3 +2,10 @@ vim.o.textwidth = 80 vim.o.colorcolumn = '+1' vim.g.lazyvim_prettier_needs_config = true + +vim.filetype.add({ + pattern = { + ['%.env%.[%w_.-]+'] = 'sh.env', + ['.*/.github/workflows/.*%.yml'] = 'yaml.ghaction', + }, +}) diff --git a/lua/plugins/nvim-lint.lua b/lua/plugins/nvim-lint.lua index 0ec26ab..52f35e8 100644 --- a/lua/plugins/nvim-lint.lua +++ b/lua/plugins/nvim-lint.lua @@ -3,12 +3,23 @@ return { 'mfussenegger/nvim-lint', opts = { linters_by_ft = { - ['*'] = { 'codespell' }, + ['*'] = { 'codespell', 'editorconfig-checker', 'alex' }, bash = { 'shellcheck' }, css = { 'stylelint' }, + django = { 'djlint' }, + env = { 'dotenv-linter' }, + ghaction = { 'zizmor' }, + handlebars = { 'djlint' }, + html = { 'htmlhint' }, + jinja = { 'djlint' }, + mustache = { 'djlint' }, + nix = { 'deadnix', 'statix' }, + nunjucks = { 'djlint' }, scss = { 'stylelint' }, sh = { 'shellcheck' }, + twig = { 'djlint' }, yaml = { 'yamllint' }, + zsh = { 'zsh' }, }, }, },