apigee / apigeelint

Static code analysis for Apigee proxy bundles to encourage API developers to use best practices and avoid anti-patterns.
Apache License 2.0
93 stars 71 forks source link

eslint import error #276

Closed jampaninc closed 1 year ago

jampaninc commented 2 years ago

Updated the version of apigeelint in our project from 0.2.7 to 2.10.0 and we are facing the below issue.

[error]: uncaughtException: Must use import to load ES Module: _path\node_modules\@eslint\eslintre\universal.js require() of ES modules is not supported. require() of path\node_modules\@eslintleslintrc\universal.js from path\node modules eslint \lib\linter\linter. js is an ES module file as it is a .js file whose nearest parent package. json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename universal.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from path\ node modules\eslint\eslintrc\package.json. Error [ERR _REQUIRE _ESM]: Must use import to load ES Module:path\node_modules\@eslintleslintre\universal.js require() of ES modules is not supported.

ssvaidyanathan commented 2 years ago

Node and npm version please?

jampaninc commented 2 years ago

node version of 12.16 and npm version of 5.5.1 --> above issue node version of 8.9.3 and npm version of 5.5.1 --> we are facing the below issue

uncaughtException: Unexpected token { path\node_modules\eslint\lib\cli-engine\cli-engine.js:439 catch ( XError: Unexpected token { it createscript (vm. js:80:10) it object. runInThisContext (vm. js:139:10) at Module._compile (module.js:616:28) at Object.Module._extensions.. js (module. js:663:10) at Module.load (module. js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module. js:497:3) at Module.require (module. js:596:17) at require (internal/module.js:11:18)

ssvaidyanathan commented 2 years ago

Can you try getting the latest npm version --> sudo npm install npm -g I am on Node 12 and do not have any issue with this version

DinoChiesa commented 2 years ago

and can you double-check that you have a clean install of apigeelint? Get the latest: v2.14

ssvaidyanathan commented 1 year ago

Closing this issue as there are no updates