← All tasks
javascriptimport-js/eslint-import-resolver-typescript #213Not a task: not reproduced

Support for upcoming ESLint FlatConfig

envgap__import-js__eslint-import-resolver-typescript-213

01 / FAILURE SIGNATURE

As reported upstream

SyntaxError: Named export 'CachedInputFileSystem' not found. The requested module 'enhanced-resolve' is a CommonJS module, which may not support all module.exports as named exports.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
25f3920cdef31701396fe25dd0942c472400b3a6
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

import-js/eslint-import-resolver-typescript #213 · read the original issue
I've got a new project going, where I'm experimenting with the new FlatConfig option.



Trying to import `eslint-import-resolver-typescript` into the config file results in the following error:

```

Uncaught exception received.

file:///C:/Users/scrap/Reps/MiaTickets-API/node_modules/eslint-import-resolver-typescript/lib/index.js:5

import { CachedInputFileSystem, ResolverFactory, } from 'enhanced-resolve';

         ^^^^^^^^^^^^^^^^^^^^^

SyntaxError: Named export 'CachedInputFileSystem' not found. The requested module 'enhanced-resolve' is a CommonJS module, which may not support all module.exports as named exports.

CommonJS modules can always be imported via the default export, for example using:



import pkg from 'enhanced-resolve';

const { CachedInputFileSystem, ResolverFactory, } = pkg;

```



This seems to be due to `enhanced-resolve` being CommonJS. My project is written with ES Modules, essentially breaking this package.



As a temporary workaround, I've gone back to importing `eslint-plugin-import`, accepting the lack of type information.

To make this work, however, it's apparently needed to add this little line to the settings object:

```

"import/parsers": {

  "espree": [".js", ".cjs", ".mjs", ".jsx"],

  typescript: [importPlugin.configs.typescript.settings["import/parsers"].typescript]

}

```
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]