pgAdmin / eslint-parallel

Tiny eslint wrapper to allow executing javascript linting in parallel.
Apache License 2.0
27 stars 11 forks source link

v1.2.1: CLI throws with ERR_REQUIRE_ESM from strip-ansi #27

Open johnhunter opened 3 years ago

johnhunter commented 3 years ago

Node: v14.16.1 eslint-parallel: 1.2.1

Caused by https://github.com/pgAdmin/eslint-parallel/pull/25

Running eslint-parallel src/app/ --ext js throws the following error:

internal/modules/cjs/loader.js:1080
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: node_modules/eslint-parallel/node_modules/strip-ansi/index.js
require() of ES modules is not supported.
require() of node_modules/eslint-parallel/node_modules/strip-ansi/index.js from node_modules/eslint-parallel/lib/formatter.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from [...]/node_modules/eslint-parallel/node_modules/strip-ansi/package.json.

Looks like the babel transformed eslint-parallel lib/formatter.js uses require and the strip-ansi module setting forbids it.