neovim: Use eslint with nvim-lspconfig

Note that sometimes you may need to disable autosave with :ASToggle
since JavaScript code is also automatically formatted on save.
This commit is contained in:
Donovan Glover 2023-12-29 17:33:05 -05:00
parent d5fe4c2118
commit 360898f626
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -50,6 +50,7 @@ in
nodePackages."@prisma/language-server"
nodePackages.pnpm
tailwindcss-language-server
vscode-langservers-extracted
# rust
rustc
@ -252,6 +253,14 @@ in
exportPdf = "onSave"
}
}
lspconfig.eslint.setup {
on_attach = function(client, bufnr)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
command = "EslintFixAll",
})
end
}
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)