56 lines
1.8 KiB
Lua
56 lines
1.8 KiB
Lua
return {
|
|
{
|
|
"mfussenegger/nvim-lint",
|
|
event = { "BufReadPre", "BufNewFile" },
|
|
config = function()
|
|
local lint = require("lint")
|
|
lint.linters_by_ft = {
|
|
-- Python
|
|
python = { "ruff" }, -- Fast! Replaces pylint, flake8, isort
|
|
-- Alternative: python = { "pylint" },
|
|
-- Or combine: python = { "ruff", "mypy" }, -- ruff + type checking
|
|
-- Bash/Shell
|
|
sh = { "shellcheck" },
|
|
bash = { "shellcheck" },
|
|
zsh = { "zsh" },
|
|
-- JSON
|
|
json = { "jsonlint" },
|
|
jsonc = { "jsonlint" },
|
|
-- YAML (added for your compose files)
|
|
yaml = { "yamllint" },
|
|
-- CSS/SCSS
|
|
css = { "stylelint" },
|
|
scss = { "stylelint" },
|
|
sass = { "stylelint" },
|
|
less = { "stylelint" },
|
|
-- HTML
|
|
html = { "htmlhint" },
|
|
-- Alternative: html = { "tidy" },
|
|
-- Dockerfile (bonus)
|
|
dockerfile = { "hadolint" },
|
|
-- JavaScript/TypeScript (bonus)
|
|
javascript = { "eslint_d" },
|
|
typescript = { "eslint_d" },
|
|
javascriptreact = { "eslint_d" },
|
|
typescriptreact = { "eslint_d" },
|
|
-- Ruby (you already have this formatter)
|
|
ruby = { "rubocop" },
|
|
-- Markdown (bonus)
|
|
markdown = { "markdownlint" },
|
|
}
|
|
-- Auto-lint on save and when leaving insert mode
|
|
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
|
group = lint_augroup,
|
|
callback = function()
|
|
lint.try_lint()
|
|
end,
|
|
})
|
|
-- Manual lint trigger
|
|
vim.keymap.set("n", "<leader>l", function()
|
|
lint.try_lint()
|
|
end, { desc = "Trigger linting" })
|
|
end,
|
|
},
|
|
}
|