ESlint sourced from same location can't load library in different projects

Viewed 3451

We have two projects in the same VScode workspace.

which eslint revelase /root/.nvm/versions/node/v14.17.0/bin/eslint in both cases.

In one project folder, everything works fine.

In another project folder, we get the error:

The eslint library loaded from /root/.nvm/versions/node/v14.17.0/lib/node_modules/eslint/lib/api.js doesn't export a CLIEngine. You need at least eslint@1.0.0

Everything, as far as we can see, is equal. The only different is the project folder.

What could be the issue?

2 Answers

According to the ESLint migration doc in version 8 the CLIEngine class has been removed and replaced by the ESLint class.

VS Code ESLint extension has not yet fully adapted to this change. Currently there is insider version 2.1.24-Insider. That is needed to install manually and it is supposed to work with ESLint v8.

Nevertheless, best you can do is to wait for next release of VS Code ESLint extension.

I have this problem with eslint version 8. I downgraded it to 7.19.0 then it works fine. Try downgrading it.

Related