having issues with eslint-lsp install via Mason

having issues with eslint-lsp install via Mason

6 comments · 67% upvoted · source · other discussions

comments

Minimum-Affect3570 [OP]

I'm not sure why my text isn't showing up but I tried installing eslint-lsp via Mason and it's not working and I'm also receiving that error message at the bottom of my neovim session...has anyone experienced this before?

IzzyDeeee

Do you have null-ls or nvim-lint installed?

It says eslint-lsp but afaik you still need a linter in order for it to work properly.

SkinnyGeek1010

Not totally related but I had other issues with eslint until I removed it and used eslint_d, worth a shot

Minimum-Affect3570 [OP]

mmpph I tried installing eslint_d via mason and it didn't work lol

thot-taliyah

So most formatters like eslint and prettier are NOT lsps by nature. You need an lsp 'proxy' in order for your editor to communicate with these types of processes.

Most people use something call null-ls to achieve this. (Yes I know null-ls is no longer being maintained as of like 3 weeks ago but its the best we have at the moment imo).

You can download these processes with Mason, but you need to configure your editor to communicate with them.

lua local nls = require("null-ls") local opts = { root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"), sources = { -- Make sure mason installs the formatters nls.builtins.code_actions.eslint_d, nls.builtins.diagnostics.eslint_d, nls.builtins.formatting.eslint_d, }, } nls.setup(opts)

This config works with eslint_d which is recommended. eslint is slow.

ecosse31

I had similar issue but now it's gone. Anyway, the nvim lsp command `vim.lsp.buf.format` doesn't work well with ESLint + Prettier. Currently only the `:ESLintFixAll` command works well. Do you know a way to configure it work well with `eslint-lsp` or `eslint_d`?