Skip to content

Commit

Permalink
chore(neovim): run EslintFixAll only when there are diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
izumin5210 committed Dec 9, 2024
1 parent 4e80fc9 commit 5387a13
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ local lsp_actions_on_save = {
rust_analyzer = { format_sync },
biome = { fix_all_sync, organize_imports_sync, format_sync },
eslint = {
function()
vim.api.nvim_command("silent! EslintFixAll")
function(client, buf)
local diag = vim.diagnostic.get(buf, {
namespace = vim.lsp.diagnostic.get_namespace(client.id),
})
if #diag > 0 then
vim.cmd("EslintFixAll")
end
end,
},
denols = { format_sync },
Expand Down

0 comments on commit 5387a13

Please sign in to comment.