eslint / config-inspector

A visual tool for inspecting and understanding your ESLint flat configs.
https://www.npmjs.com/package/@eslint/config-inspector
Apache License 2.0
533 stars 15 forks source link

`Failed to load eslint.config.js` -- `ReferenceError: await is not defined` #11

Closed NamesMT closed 3 months ago

NamesMT commented 3 months ago

If eslint.config.js contains an await keyword, config-inspector will throw an error. image

Extra context: In my config case of the following image: image

Removed the await at L13 allows config-inspector to shows all the configs normally (withNuxt() returns a Promise), ESLint ran from CLI also seems to works, but the VSCode IDE's ESLint server will not be able to infer the configs of withNuxt() and will complain about things like no-undef because globals from withNuxt() isn't registered.

antfu commented 3 months ago

Unfortunately, top-level await is not yet supported because of https://github.com/unjs/jiti/issues/72, where it is still required to properly bail out module cache for re-imports. You might need to workaround to not use top-level await at this moment.

NamesMT commented 3 months ago

Thank you!, For current state, workaround using an async wrapper seems to be working fine for all cases: CLI, Extension server, config-inspector image