Files
dotfiles/nvim/lua/settings/lazy/plugins/nvim-lint.lua
T

56 lines
1.3 KiB
Lua

return {
"mfussenegger/nvim-lint",
dependencies = {
"WhoIsSethDaniel/mason-tool-installer.nvim",
},
event = { "BufReadPre", "BufWritePost" },
init = function()
local lint = require("lint")
vim.api.nvim_create_autocmd(
{ "TextChanged", "TextChangedI", "BufEnter", "BufReadPre", "BufWritePost", "CursorHold", "CursorHoldI" },
{
callback = function()
lint.try_lint()
end,
}
)
end,
config = function()
local lint = require("lint")
local phpcs = lint.linters.phpcs
local phpstan = lint.linters.phpstan
phpcs.args = {
"-q",
-- <- Add a new parameter here
"--standard=PSR12",
"--report=json",
"-",
}
phpstan.args = {
"analyze",
"--error-format=json",
"--no-progress",
"--level-max"
}
lint.linters_by_ft = {
lua = { "luacheck" },
javascript = { "eslint" },
typescript = { "eslint" },
javascriptreact = { "eslint" },
typescriptreact = { "eslint" },
vue = { "eslint" },
sh = { "shellcheck" },
fish = { "fish" },
json = { "jsonlint" },
markdown = { "markdownlint" },
php = { "php", "phpcs", "phpstan" },
css = { "stylelint" },
yaml = { "yamllint" },
}
end,
}