ESLint LSP
raw JSON → 0.1.2 verified Sat Apr 25 auth: no javascript
eslint-lsp is a language server that wraps ESLint to provide linting diagnostics via the Language Server Protocol (LSP). The current stable version is 0.1.2, with an infrequent release cadence. It is a minimal implementation, still lacking many features (e.g., code actions) and is primarily intended as a proof-of-concept. Compared to alternatives like vscode-eslint or eslint-language-server, it is barebones and community-maintained. It works with editors like Emacs (lsp-mode, eglot) by spawning the server with --stdio.
Common errors
error Error: Cannot find module 'eslint' ↓
cause eslint is not installed or not in node_modules of the global install.
fix
Install eslint globally alongside eslint-lsp: npm install -g eslint-lsp eslint
error Content-Length header missing ↓
cause Sending data without proper LSP framing; need Content-Length header.
fix
Prefix JSON message with 'Content-Length: <length>\r\n\r\n' where <length> is the byte length of the JSON string.
Warnings
breaking Version 0.1.x is a work-in-progress; many LSP features (e.g., code actions, formatting) are missing or broken. ↓
fix Consider using eslint-language-server or vscode-eslint for a more complete solution.
gotcha The server does not support all ESLint config formats (e.g., .eslintrc.js may not be loaded correctly). ↓
fix Use JSON-formatted .eslintrc (e.g., .eslintrc.json) to ensure config is parsed.
gotcha No caching mechanism; every file open triggers a fresh lint, slowing down large projects. ↓
fix None yet; limit workspace size or use alternative server.
deprecated Package name is not unique (conflicts with eslint-lsp on Open VSX); may be renamed/clarified in future. ↓
fix Use full npm scope @danielpza/eslint-lsp if ambiguous; but current npm package is eslint-lsp.
Install
npm install eslint-lsp yarn add eslint-lsp pnpm add eslint-lsp Imports
- eslint-lsp
not importable as library; used as CLI via 'eslint-lsp --stdio'
Quickstart
npm install -g eslint-lsp eslint
# create a basic .eslintrc.json
cat > .eslintrc.json <<'EOF'
{
"extends": ["eslint:recommended"],
"env": { "es6": true, "node": true }
}
EOF
# run the language server
printf 'Content-Length: 56\r\n\r\n{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | eslint-lsp --stdio