Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
NamesMT opened this issue Mar 31, 2024 · 2 comments · Fixed by #9
Closed

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

NamesMT opened this issue Mar 31, 2024 · 2 comments · Fixed by #9
Labels
bug Something isn't working upstream

Comments

@NamesMT
Copy link

NamesMT commented Mar 31, 2024

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
Copy link
Collaborator

antfu commented Mar 31, 2024

Unfortunately, top-level await is not yet supported because of unjs/jiti#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.

@antfu antfu added bug Something isn't working upstream labels Mar 31, 2024
@NamesMT
Copy link
Author

NamesMT commented Apr 1, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants