Skip to content

[Help] Use 1 eslint server for code actions, diagnostics and formatting #21

Open
@Ajaymamtora

Description

@Ajaymamtora

At the moment Ive setup my sources like:

    require("none-ls.diagnostics.eslint").with({
      command = "eslint",
      args = { "-f", "json", "--stdin", "--stdin-filename", "$FILENAME" },
      to_stdin = true,
      format = "json_raw",
      check_exit_code = function(code)
        return code <= 1
      end,
      cwd = function()
        return eslint_override_cwd
      end,
    }),

    require("none-ls.code_actions.eslint").with({
      generator_opts = {
        command = "eslint",
        args = { "-f", "json", "--stdin", "--stdin-filename", "$FILENAME" },
        to_stdin = true,
        format = "json_raw",
        check_exit_code = { 0, 1 },
        cwd = function()
          return eslint_override_cwd
        end,
      }
    }),

    null_ls.builtins.formatting.uncrustify.with({
      args = function(params)
        local config_path = _G.__os.home .. "/.config/uncrustify/config.cfg"
        local format_type = "-l " .. params.ft:upper()
        return { "-c", config_path, "-q", format_type }
      end,
    }),

But I dont want to spawn 3 eslint instances. Surely theres a way to use just one?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions