Skip to content

Commit

Permalink
feat: replace eslint_d with eslint language server
Browse files Browse the repository at this point in the history
  • Loading branch information
nshen committed Feb 28, 2024
1 parent 40a3726 commit f8b7e87
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
5 changes: 3 additions & 2 deletions lua/insis/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,9 @@ local UserConfig = {
---@class FrontendConfig
frontend = {
enable = false,
linter = "eslint_d",
---@type "eslint_d" | "prettier" | "tsserver"
---@type "eslint" | false
linter = "eslint", -- :EslintFixAll command added
---@type false | "prettier" | "tsserver"
formatter = "tsserver",
format_on_save = false,
cspell = false,
Expand Down
17 changes: 7 additions & 10 deletions lua/insis/env/frontend.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ return function(config)
if config.vue then
table.insert(list, "volar")
end
if config.linter == "eslint" then
table.insert(list, "eslint")
end
return list
end,

Expand All @@ -40,6 +43,9 @@ return function(config)
emmet_ls = require("insis.lsp.config.emmet"),
html = require("insis.lsp.config.html"),
}
if config.linter == "eslint" then
list.eslint = require("insis.lsp.config.eslint")
end
if config.tailwindcss then
list.tailwindcss = require("insis.lsp.config.tailwindcss")
end
Expand All @@ -55,9 +61,6 @@ return function(config)

getToolEnsureList = function()
local list = {}
if config.formatter == "eslint_d" or config.linter == "eslint_d" then
table.insert(list, "eslint_d")
end
if config.formatter == "prettier" then
table.insert(list, "prettier")
end
Expand All @@ -73,9 +76,7 @@ return function(config)
return {}
end
local list = {}
if config.formatter == "eslint_d" then
table.insert(list, null_ls.builtins.formatting.eslint_d)
elseif config.formatter == "prettier" then
if config.formatter == "prettier" then
table.insert(
list,
null_ls.builtins.formatting.prettier.with({
Expand All @@ -99,9 +100,6 @@ return function(config)
})
)
end
table.insert(list, null_ls.builtins.diagnostics.eslint_d)
table.insert(list, null_ls.builtins.code_actions.eslint_d)
table.insert(list, require("typescript.extensions.null-ls.code-actions"))
if config.cspell then
table.insert(
list,
Expand All @@ -117,7 +115,6 @@ return function(config)
table.insert(
list,
null_ls.builtins.code_actions.cspell.with({

"javascript",
"javascriptreact",
"typescript",
Expand Down
5 changes: 5 additions & 0 deletions lua/insis/lsp/config/eslint.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
return {
on_setup = function(server)
server.setup({})
end,
}

1 comment on commit f8b7e87

@nshen
Copy link
Owner Author

@nshen nshen commented on f8b7e87 Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.