Hi, maybe a late reply, but this is the proper solution that I found:
lua/lsp/eslint.lua
:
require("lspconfig").eslint.setup {
codeAction = {
disableRuleComment = {
enable = true,
location = "separateLine",
},
showDocumentation = {
enable = true,
},
},
codeActionOnSave = {
enable = false,
mode = "all",
},
experimental = {
useFlatConfig = false,
},
format = true,
nodePath = "",
onIgnoredFiles = "off",
packageManager = "npm",
problems = {
shortenToSingleLine = false,
},
quiet = false,
rulesCustomizations = {},
run = "onType",
useESLintClass = false,
validate = "on",
workingDirectory = {
mode = "location",
},
}
/lua/autocommands.lua
:
local ag = vim.api.nvim_create_augroup
local au = vim.api.nvim_create_autocmd
-- GROUPS:
local disable_node_modules_eslint_group =
ag("DisableNodeModulesEslint", { clear = true })
-- AUTO-COMMANDS:
au({ "BufNewFile", "BufRead" }, {
pattern = { "**/node_modules/**", "node_modules", "/node_modules/*" },
callback = function()
vim.diagnostic.disable(0)
end,
group = disable_node_modules_eslint_group,
})
I added this as a reply to the same issue that I was having with eslint.nvim
: I get diagnostics on `.node_modules` files · Issue #4 · MunifTanjim/eslint.nvim · GitHub