Supressing ESLint LS errors

Here’s github issue with all necessary info: ESLint LS throws errors when trying to declare new variable (indent rule) · Issue #1567 · neovim/nvim-lspconfig · GitHub

ESLint: Cannot read properties of undefined (reading 'loc') Occurred while linting /home/non/test/index.ts. Please see the 'ESLint' output channel for details.

Request Actions:
1. Open Output

Is there a way to prevent this error from showing by using custom handler? If so, can somebody point me to some example of doing that?

The only example which I’ve seen and used is this one: Multiple and wrong definition · Issue #216 · typescript-language-server/typescript-language-server · GitHub


I would copy/paste the exact error here, as I found your initial bug report confusing and had to read through the rpc logs in order to extract the error you were seeing.

Maybe something like:

handlers = {
  ['window/showMessageRequest'] = function(_, result, params) return result end

If you just want to ignore it.


Added the error.
I thought you would watch asciinema and pause when error occured. :slight_smile:
Oh well…

I guess that would prevent me from using code actions, right? Which one of the main reasons I’m using it in the first place.

Hmmm… it appears that it doesn’t interfere with code action window. :slight_smile:

Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:465: method "window/showMessageRequest": either a result or an error must be sent to the server in response
stack traceback:
        [C]: in function 'error'
        /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:465: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457>


I assume there is something you can change in your project/eslint to avoid the error, but this should interfere with nothing (apart from silently ignoring showMessageRequest)

Yeah, I can use @typescript-eslint indent rule which is broken, or not use indent rule at all, any of which doesn’t seem like a proper option. :frowning:

Looks like this solves it:

handlers = {
  ['window/showMessageRequest'] = function(_, result, params) return result end

I can mark your post as the solution if you edit returing result in.

Thanks for your time.

It sounds to me like you don’t have a .eslintrc or .eslintrc.json in your project?

How it can sound this way? Have you seen the repro? It has .eslintrc with indent rule. And the project I’m working on has it too.
And from link above you can see that people recommend using @typescript-eslint/indent rule instead of eslint indent rule for typescript projects, but I don’t see that as good option because according to the maintainers it is broken. Better do nothing with the code on eslint --fix than do strange things.