Better JS/TS Development Experience (#667)

Co-authored-by: Maxime <m.romero@progtechinformatique.ca>
This commit is contained in:
maxime50 2021-07-04 18:22:10 -04:00 committed by GitHub
parent f93c007962
commit d2324d14e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 30 deletions

View file

@ -17,46 +17,18 @@ M.setup = function()
}
end
-- TODO global eslint?
local eslint = {
lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}",
lintIgnoreExitCode = true,
lintStdin = true,
lintFormats = {"%f:%l:%c: %m"},
-- formatCommand = "./node_modules/.bin/eslint -f unix --fix --stdin-filename ${INPUT}", -- TODO check if eslint is the formatter then add this
formatStdin = true
}
if O.lang.tsserver.formatter == 'prettier' then
table.insert(tsserver_args, prettier)
end
if O.lang.tsserver.linter == 'eslint' then
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 = {
"javascriptreact", "javascript", "typescript", "typescriptreact",
"html", "css", "yaml", "vue"
},
filetypes = {"html", "css", "yaml", "vue"},
settings = {
rootMarkers = {".git/", "package.json"},
languages = {
javascript = tsserver_args,
javascriptreact = tsserver_args,
typescript = tsserver_args,
typescriptreact = tsserver_args,
html = {prettier},
css = {prettier},
json = {prettier},
yaml = {prettier}
-- javascriptreact = {prettier, eslint},
-- javascript = {prettier, eslint},
-- markdown = {markdownPandocFormat, markdownlint},
}
}