-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.lua
More file actions
22 lines (21 loc) · 697 Bytes
/
Copy patheslint.lua
File metadata and controls
22 lines (21 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- EslintFixAll on save, scoped to eslint-attached buffers only.
-- Registered as a side effect when this config file is sourced; the augroup's
-- clear = true keeps it idempotent if the file is sourced more than once.
local group = vim.api.nvim_create_augroup("EslintFixOnSave", { clear = true })
vim.api.nvim_create_autocmd("LspAttach", {
group = group,
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client and client.name == "eslint" then
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = args.buf,
command = "EslintFixAll",
})
end
end,
})
return {
settings = {
packageManager = "npm",
},
}