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

import-x/no-unresolved TS Project References #229

Open
carlocorradini opened this issue Jan 27, 2025 · 1 comment
Open

import-x/no-unresolved TS Project References #229

carlocorradini opened this issue Jan 27, 2025 · 1 comment

Comments

@carlocorradini
Copy link

I'm using TypeScript Project References, where project A depends on project B:

  • B's package.json is correctly configured to export cjs, esm, and types
  • A's package.json has entry B in dependencies
  • TypeScript successfully infers all types and goes to definitions.
    Even though projects A and B have not yet been built, everything is working properly (thanks to project references).
    Unfortunately, while importing B into A in a TypeScript file, ESLint cannot locate the files for B (it has not yet been built) and returns the error import-x/no-unresolved.
    Is it possible to instruct import-x to infer/use TypeScript project references or there is another trick or workaround?
    The only option I've found is to build project B, which will make import-x happy.
    Thanks
@tobigumo
Copy link

I ran into the same issue and discovered it might be related to eslint-import-resolver-typescript:
import-js/eslint-import-resolver-typescript#94

As noted in comment, you may be able to fix it by adding certain settings under import/resolver.
import-js/eslint-import-resolver-typescript#94 (comment)

However, because I was referencing a single shared tsconfig.json—which contained the common settings for two different projects—that adjustment alone did not work for me.
Ultimately, I fixed it by moving the shared settings into each project's individual tsconfig file instead.

It's not the prettiest solution, but hopefully it helps if you run into the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants