Skip to content

LSP ESlint integration

Kuba Orlik edited this page May 20, 2021 · 6 revisions

Installation

  1. Download the latest version of VScode ESlint from VScode marketplace and unzip it(alternatively, clone and build https://github.com/Microsoft/vscode-eslint). Make sure to use verson 2.1.14 and that lsp-eslint-server-command points to the correct location1 .
(setq lsp-eslint-server-command 
   '("node" 
     "/home/USER/.vscode/extensions/dbaeumer.vscode-eslint-2.0.11/server/out/eslintServer.js" 
     "--stdio"))
  1. Install eslint either locally globally via:
npm install -g eslint
  1. Invoke M-x lsp in html, js, ts buffers.
  2. Enjoy

1: Tilde expansion won't work as expected resulting in the string being appended to your project's root directory. eg: /usr/local/src/my-app/\~/.vscode/extensions/...if you update the vscode extension regularly you could use something like (setq lsp-eslint-server-command `("node" ,(expand-file-name (car (last (file-expand-wildcards "~/.vscode/extensions/dbaeumer.vscode-eslint-*/server/out/eslintServer.js")))) "--stdio"))