mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-25 18:28:50 +02:00
feat(eslint): added an extra for eslint lsp that runs EslintFixAll before saving a buffer
This commit is contained in:
parent
5aad5749a7
commit
75299da24c
1 changed files with 23 additions and 0 deletions
23
lua/lazyvim/plugins/extras/linting/eslint.lua
Normal file
23
lua/lazyvim/plugins/extras/linting/eslint.lua
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
-- other settings removed for brevity
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
eslint = {
|
||||||
|
settings = {
|
||||||
|
-- helps eslint find the eslintrc when it's placed in a subfolder instead of the cwd root
|
||||||
|
workingDirectory = { mode = "auto" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
eslint = function()
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
command = "EslintFixAll",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue