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

Bug: parser can't resolve imports when a package is using typesVersions #107

Closed
zikaari opened this issue Jun 25, 2022 · 6 comments · Fixed by #110
Closed

Bug: parser can't resolve imports when a package is using typesVersions #107

zikaari opened this issue Jun 25, 2022 · 6 comments · Fixed by #110

Comments

@zikaari
Copy link

zikaari commented Jun 25, 2022

parser

As seen in the screenshot, VSCode's intellisense is having no problem resolving the module, but import plugin is unable to find the module. I'm using stock settings for eslintrc and parserOptions.

The package in question is using typesVersions to "map" the files in dist directory to module names - https://github.com/mozilla/glean.js/blob/main/glean/package.json#L19-L49

@JounQin
Copy link
Collaborator

JounQin commented Jun 25, 2022

Interesting, I've never used typesVersions before, do you want to raise a PR for it?

Workaround: use paths mapping in tsconfig.json instead.

Just notice it is about 3rd-party integration.

@zikaari
Copy link
Author

zikaari commented Jun 25, 2022

Unfortunately, I'm not familiar with Typescript parser.

@JounQin
Copy link
Collaborator

JounQin commented Jun 25, 2022

I'll take a look when I'm free then.

@JounQin
Copy link
Collaborator

JounQin commented Jun 25, 2022

It should be related to #85

JounQin added a commit that referenced this issue Jun 25, 2022
JounQin added a commit that referenced this issue Jun 25, 2022
JounQin added a commit that referenced this issue Jun 25, 2022
@JounQin
Copy link
Collaborator

JounQin commented Jun 25, 2022

exports is supported in v3.1.0, but notice typesVersions is not used temporarily, tracking on #111 instead.

@JounQin
Copy link
Collaborator

JounQin commented Jul 19, 2022

After thinking, I'd like to only support less TypeScript versions to reduce the complexity of this resolver.

ijjk added a commit to vercel/next.js that referenced this issue Nov 16, 2022
…3010)

<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

Bumps `eslint-import-resolver-typescript` in `eslint-config-next` to the
latest version to pick up a fix from `3.1.0`. As mentioned here,
import-js/eslint-import-resolver-typescript#107,
the typescript parser is unable to resolve the `typesVersions ` field in
their `package.json`. An example repo using this is
[`@vercel/examples-ui`](https://github.com/vercel/examples/blob/385a2e968619f9e50f488e2857e021841ae61030/packages/ui/package.json#L14-L22)
which will report an eslint `import/no-unresolved` error when using the
previous version of `eslint-import-resolver-typescript` (see
import-js/eslint-import-resolver-typescript#107).
This was fixed in
import-js/eslint-import-resolver-typescript#110

This can be locally fixed by bumping
`>=eslint-import-resolver-typescript@3.1.0` but decided it should be
resolved here too.

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Errors have a helpful link attached, see `contributing.md`

Closes: #41786

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants