Hi,
I installed eslint plugin in vscode in my react project. The eslint server 
was running but in the eslint console output I was getting the following 2 
errors : 

1. The eslint library loaded from 
test-project\node_modules\eslint\lib\api.js doesn't export a CLIEngine. You 
need at least [email protected]

2. ESLint stack trace:
[Error - 1:27:13 pm] TypeError: t.library.CLIEngine is not a constructor
    at 
Users\HP\.vscode\extensions\dbaeumer.vscode-eslint-1.9.1\server\out\eslintServer.js:1:60060

My Environment details -

Node version: v14.19.3
npm version: v6.14.17
Local ESLint version: v8.29.0 (Currently used)
Global ESLint version:  v8.29.0
Operating System: Windows 10
What parser are you using?
@typescript-eslint/parser

Now on adding the following 2 lines of code 
in  node_modules\eslint\lib\api.js, the error went away and eslint started 
working.

On line 16 - const { CLIEngine } = require("./cli-engine");
On line 26 - CLIEngine

My api.js file - 
/**
 * @fileoverview Expose out ESLint and CLI to require.
 * @author Ian Christian Myers
 */

"use strict";

//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------

const { ESLint } = require("./eslint");
const { Linter } = require("./linter");
const { RuleTester } = require("./rule-tester");
const { SourceCode } = require("./source-code");
const { CLIEngine } = require("./cli-engine");        //added
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------

module.exports = {
    Linter,
    ESLint,
    RuleTester,
    SourceCode,
    CLIEngine                  //added
};

What could be the reason for these errors?, could I try anything else to 
resolve them? 

Thanks,
Shivam


-- 
You received this message because you are subscribed to the Google Groups 
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/eslint/bb8010bc-3e84-437f-bd12-8f956d5b44abn%40googlegroups.com.

Reply via email to