-
Notifications
You must be signed in to change notification settings - Fork 18
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
incompatible with eslint-plugin-import #288
Comments
@olsonpm, eslint-plugin-import has no parser, eslint has it. And eslint supports top-level await without any issues. Could you please provide a more details / steps to reproduce? Generally speaking, it's ok to fix some library a bit to provide compatibility with popular tools, but we need to understand the root cause. |
Here's a reproduction $ git clone git@github.com:olsonpm/repro.git
$ cd repro
$ git checkout esmock-issue-288
$ npm ci
$ npx eslint index.mjs
/path/to/repro/index.mjs
1:20 error Parse errors in imported module 'esmock': Cannot use keyword 'await' outside an async function (2:8171) import/namespace
1:20 error Parse errors in imported module 'esmock': Cannot use keyword 'await' outside an async function (2:8171) import/default
1:20 warning Parse errors in imported module 'esmock': Cannot use keyword 'await' outside an async function (2:8171) import/no-named-as-default
1:20 warning Parse errors in imported module 'esmock': Cannot use keyword 'await' outside an async function (2:8171) import/no-named-as-default-member
✖ 4 problems (2 errors, 2 warnings) I'll look into the parser detail you mention to better understand the issue edit: okay I fixed the repro and updated the error text |
looks like I needed to add I haven't encountered this issue before I think because typically eslint rules are specific to a projects' own files. Looks like the import plugin parses other module's files (necessarily of course), which then means the parser configuration needs to support other library's code. Sorry for the noise |
Due to a top-level await in pnpResolver.js, eslint-plugin-import is unable to parse this module.
I understand if you don't want to support this use-case, as the owner of that module is particularly against native esm. However if pnp is able to be imported directly now or if there's some other way to work around the top level await then that would be helpful.
For now I'm removing pnp in a fork since I have no plans on using yarn's pnp.
Thanks for this library :)
The text was updated successfully, but these errors were encountered: