eslint.nvim icon indicating copy to clipboard operation
eslint.nvim copied to clipboard

ESLint plugin for Neovim's built-in LSP client.

eslint.nvim

ESLint plugin for Neovim's built-in LSP client.

Requirements

Installation

Install the plugins with your preferred plugin manager. For example, with vim-plug:

Plug 'neovim/nvim-lspconfig'
Plug 'jose-elias-alvarez/null-ls.nvim'
Plug 'MunifTanjim/eslint.nvim'

Setup

eslint.nvim needs to be initialized with the require("eslint").setup() function.

For example:

local null_ls = require("null-ls")
local eslint = require("eslint")

null_ls.setup()

eslint.setup({
  bin = 'eslint', -- or `eslint_d`
  code_actions = {
    enable = true,
    apply_on_save = {
      enable = true,
      types = { "problem" }, -- "directive", "problem", "suggestion", "layout"
    },
    disable_rule_comment = {
      enable = true,
      location = "separate_line", -- or `same_line`
    },
  },
  diagnostics = {
    enable = true,
    report_unused_disable_directives = false,
    run_on = "type", -- or `save`
  },
})

Acknowledgements

License

Licensed under the MIT License. Check the LICENSE file for details.