luaeslintneovim

Issue with none-ls configuration error with eslint_d


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!


Solution

  • 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"),        
            ...
        }
    }