WebStorm + ESLint: TypeError: this.CliEngine is not a constructor

When I try to set up eslint in webstorm i get an error message on each js file saying ESLint: TypeError: this.cliEngine is not a constructor . I have search the web and cannot find any way to fix this issue, does anyone know how to solve this problem?

image
DownloadNp
Last Updated: May 10th 2021

Error-Message:

ESLint: TypeError: This.cliEngine is not a constructor

SOLUTION 1:

The cause of the error is: prior to this issue we were using a part of the ESLint API that was removed in v6.

This has already been resolved in 2019.1.3 and in all 2019.2 builds.

If you're encountering this error, please upgrade your IDE to the latest version.

 

SOLUTION 2:

The issue is with ESLint version 6.x. If upgrading Webstorm is not an option for you, you have to downgrade to ESLint version 5:

npm install --save-dev eslint@5

 

SOLUTION 3:

There's a dirty but valid hack for anyone using a fallback license and not wanting to upgrade to resolve the issue (or those who don't want to go to 5.x version of ESLint):

Wait for the this.CliEngine is not a constructor balloon to appear and click "Details"

Follow the first link in the stack-trace to eslint-plugin.js file

Find the following line at the top:

this.CliEngine = require(this.basicPath + "lib/cli-engine");

And replace it with the following one:

this.CliEngine = require(this.basicPath).CLIEngine;

Restart IDEA

Referencing and thanks to ESLint Issue and the comment: https://github.com/eslint/eslint/issues/11957#issuecomment-509261793

Please Login to Comment