mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(eslint): add option to disable eslint auto format
This commit is contained in:
parent
12818a6cb4
commit
391a6f97b5
1 changed files with 12 additions and 0 deletions
|
|
@ -1,3 +1,10 @@
|
|||
if lazyvim_docs then
|
||||
-- Set to false to disable auto format
|
||||
vim.g.lazyvim_eslint_auto_format = true
|
||||
end
|
||||
|
||||
local auto_format = vim.g.lazyvim_eslint_auto_format == nil or vim.g.lazyvim_eslint_auto_format
|
||||
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
|
|
@ -9,11 +16,16 @@ return {
|
|||
settings = {
|
||||
-- helps eslint find the eslintrc when it's placed in a subfolder instead of the cwd root
|
||||
workingDirectories = { mode = "auto" },
|
||||
format = auto_format,
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
eslint = function()
|
||||
if not auto_format then
|
||||
return
|
||||
end
|
||||
|
||||
local function get_client(buf)
|
||||
return LazyVim.lsp.get_clients({ name = "eslint", bufnr = buf })[1]
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue