0

When I'm opening my app.js file in the vim status bar following error is shown

[coc.nvim] Failed to load the ESLint library for the document /mnt/d/js/my_take/js_sandbox/app.js

Even though the autocompletion is working, I'm curious to know why this is happening.

1

As Tae pointed, that's not really about vim, nor CoC.

This message is displayed (most probably) because you have no .eslint nor .eslint.json, which are needed for CoC to use the linter.

First, you'll need eslint if it's not already installed:

npm i -g eslint

You can then generate these files with the config demon. Run this command from your project root:

eslint --init

Follow the instructions and pick options depending on your project. You can also refer to the eslint user guide.

Edit:

You'll also need some config in your coc-settings.json file (which you can open with :CocConfig):

"eslint.filetypes": [
    "javascript",
    "typescript",
    "typescriptreact",
    "javascriptreact"
],
"eslint.options" : {
    "env": {
        "browser": true,
        "node": true
    }
}
| improve this answer | |
  • Thanks for this brief answer – Neel Modi May 27 at 14:44
0

I don't use CoC, but ESLint is an static analyzer and has nothing to do with code completion, that's why it is working.

As far as I know CoC provides more than code completion, and if ESLint is not being loaded you may be missing its diagnostics

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.