Issue with none-ls configuration error with eslint_d
Asked Answered
U

2

8

I'm configuring neovim with none-ls and when I'm trying to add eslint_d to the setup I have this error :

[null-ls] failed to load builtin eslint_d for method diagnostics; please check your config

Here is what my none-ls.lua file looks like

 return {
   "nvimtools/none-ls.nvim",
   config = function()
     local null_ls = require("null-ls")

     null_ls.setup({
       sources = {
         null_ls.builtins.formatting.stylua,
         null_ls.builtins.formatting.prettier,
         null_ls.builtins.diagnostics.eslint_d,
       },
     })
 
      vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
    end,
 }

I only have an issue with eslint_d (I tried eslint-lsp too, same issue)

I have installed eslint_d with Mason (even tried to uninstall and install it again) I have installed eslint_d globally using npm I have checked none-ls' documentation and it looks like it should work

Does anyone know what could be the issue? Thanks a lot!

Uncouple answered 5/3 at 13:35 Comment(0)
K
14

This is probably a consequence of the changes announced here: https://github.com/nvimtools/none-ls.nvim/discussions/81.

You can get the code actions/diagnostics for eslint_d from none-ls-extras (don't forget to add this dependency to your null-ls installation).

Your config should be updated to something similar to this:

local null_ls = require("null-ls")

null_ls.setup {
    sources = {
        require("none-ls.diagnostics.eslint_d"),        
        ...
    }
}
Klee answered 5/3 at 22:15 Comment(1)
That was it! Thanks a lot, everything's good nowUncouple
M
3
  1. Add none-ls-extras to the dependencies.
  2. Require the modules you need.
return {
  "nvimtools/none-ls.nvim",
  dependencies = {
    "nvimtools/none-ls-extras.nvim",
  },
  config = function()
    local null_ls = require("null-ls")
    null_ls.setup({
      sources = {
        null_ls.builtins.formatting.stylua,
        null_ls.builtins.formatting.prettier,
        require("none-ls.diagnostics.eslint_d")
      },
    })

    vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
  end,
}
Mulligatawny answered 8/8 at 13:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.