Skip to content

Commit

Permalink
feat(typescript): Swap out eslint_d with eslint-lsp (#600)
Browse files Browse the repository at this point in the history
* feat(typescript): Swap out eslint_d with eslint-lsp

* docs(typescript): Remove mention of eslint_d, add mention of vscode-eslint

* chore(typescript): Rename typescript/deno.lua to typescript/dap.lua
  • Loading branch information
Uzaaft authored Oct 11, 2023
1 parent 6672b64 commit 54a0988
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
3 changes: 1 addition & 2 deletions lua/astrocommunity/pack/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
This plugin pack does the following:

- Adds `typescript`, `javascript`, and `tsx` Treesitter parsers
- Adds `tsserver` language server
- Adds `tsserver` and `vscode-eslint` language server
- Adds `prettierd` formatter
- Adds `eslint_d` linter
- Adds [JSON language support](../json)
- Adds support for dap for JS
- Adds [typescript.nvim](https://github.com/jose-elias-alvarez/typescript.nvim) for language specific tooling
Expand Down
File renamed without changes.
19 changes: 1 addition & 18 deletions lua/astrocommunity/pack/typescript/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ return {
"jay-babu/mason-null-ls.nvim",

opts = function(_, opts)
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "prettierd", "eslint_d" })
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "prettierd", "eslint-lsp" })
if not opts.handlers then opts.handlers = {} end

local has_prettier = function(util)
Expand All @@ -71,27 +71,10 @@ return {
or util.root_has_file ".prettierrc.toml"
end

local has_eslint = function(util)
return util.root_has_file ".eslintrc.js"
or util.root_has_file ".eslintrc.cjs"
or util.root_has_file ".eslintrc.yaml"
or util.root_has_file ".eslintrc.yml"
or util.root_has_file ".eslintrc.json"
or check_json_key_exists(vim.fn.getcwd() .. "/package.json", "eslintConfig")
or util.root_has_file ".eslintrc"
end

opts.handlers.prettierd = function()
local null_ls = require "null-ls"
null_ls.register(null_ls.builtins.formatting.prettierd.with { condition = has_prettier })
end

opts.handlers.eslint_d = function()
local null_ls = require "null-ls"
null_ls.register(null_ls.builtins.diagnostics.eslint_d.with { condition = has_eslint })
null_ls.register(null_ls.builtins.formatting.eslint_d.with { condition = has_eslint })
null_ls.register(null_ls.builtins.code_actions.eslint_d.with { condition = has_eslint })
end
end,
},
{
Expand Down

0 comments on commit 54a0988

Please sign in to comment.