mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-04 18:14:40 +02:00
add eslint and eslint_d to efm (#877)
This commit is contained in:
parent
ed382dd488
commit
26c5c74303
2 changed files with 25 additions and 14 deletions
|
@ -266,7 +266,7 @@ O = {
|
|||
},
|
||||
terraform = {},
|
||||
tsserver = {
|
||||
-- @usage can be 'eslint'
|
||||
-- @usage can be 'eslint' or 'eslint_d'
|
||||
linter = "",
|
||||
diagnostics = {
|
||||
virtual_text = { spacing = 0, prefix = "" },
|
||||
|
|
|
@ -5,30 +5,41 @@ local M = {}
|
|||
M.setup = function()
|
||||
local tsserver_args = {}
|
||||
|
||||
local prettier = {
|
||||
formatCommand = "prettier --stdin-filepath ${INPUT}",
|
||||
formatStdin = true,
|
||||
}
|
||||
|
||||
if vim.fn.glob "node_modules/.bin/prettier" ~= "" then
|
||||
prettier = {
|
||||
formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}",
|
||||
if O.lang.tsserver.linter == "eslint" or O.lang.tsserver.linter == "eslint_d" then
|
||||
local eslint = {
|
||||
lintCommand = O.lang.tsserver.linter .. " -f unix --stdin --stdin-filename {INPUT}",
|
||||
lintStdin = true,
|
||||
lintFormats = { "%f:%l:%c: %m" },
|
||||
lintIgnoreExitCode = true,
|
||||
formatCommand = O.lang.tsserver.linter .. " --fix-to-stdout --stdin --stdin-filename=${INPUT}",
|
||||
formatStdin = true,
|
||||
}
|
||||
table.insert(tsserver_args, eslint)
|
||||
end
|
||||
|
||||
require("lspconfig").efm.setup {
|
||||
-- init_options = {initializationOptions},
|
||||
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
||||
init_options = { documentFormatting = true, codeAction = false },
|
||||
filetypes = { "html", "css", "yaml", "vue", "javascript", "javascriptreact", "typescript", "typescriptreact" },
|
||||
filetypes = {
|
||||
"vue",
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"javascript.jsx",
|
||||
"typescript.tsx",
|
||||
},
|
||||
settings = {
|
||||
rootMarkers = { ".git/", "package.json" },
|
||||
languages = {
|
||||
html = { prettier },
|
||||
css = { prettier },
|
||||
json = { prettier },
|
||||
yaml = { prettier },
|
||||
vue = tsserver_args,
|
||||
javascript = tsserver_args,
|
||||
javascriptreact = tsserver_args,
|
||||
["javascript.jsx"] = tsserver_args,
|
||||
typescript = tsserver_args,
|
||||
["typescript.tsx"] = tsserver_args,
|
||||
typescriptreact = tsserver_args,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue