-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Comments
I ran into the same issue and discovered it might be related to As noted in comment, you may be able to fix it by adding certain settings under However, because I was referencing a single shared It's not the prettiest solution, but hopefully it helps if you run into the same problem. |
@tobigumo do you have any example for ESLint 9? I'm unable to make it works for aliased paths. |
@SalahAdDin Yup, I'll share it with you if you want. |
@carlocorradini Well, I followed the documentation about ESLint 9:
I followed the steps but I have a problem:
|
I found the way to do it: import tanStackQuery from "@tanstack/eslint-plugin-query";
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
export default tseslint.config(
{ ignores: ["coverage", "dist"] },
sonarjs.configs.recommended,
{
extends: [importX.flatConfigs.recommended],
languageOptions: {
parser: tsParser,
ecmaVersion: "latest",
},
settings: {
"import-x/resolver-next": [
createTypeScriptImportResolver({
alwaysTryTypes: true,
project: ["./tsconfig.app.json", "./tsconfig.node.json"],
}),
],
},
}, It seems the plugin is unable to reach the nested typescript configuration files, so we have to add both to the project property.
This solution works for both JS and TS files. Is there anything I could improve in this configuration? |
@SalahAdDin See import-js/eslint-import-resolver-typescript#94 (comment) Nonetheless, there is the need to fix the other issues first :) |
I'm using TypeScript Project References, where project
A
depends on projectB
:B
'spackage.json
is correctly configured to exportcjs
,esm
, andtypes
A
'spackage.json
has entryB
in dependenciesEven though projects
A
andB
have not yet been built, everything is working properly (thanks to project references).Unfortunately, while importing
B
intoA
in a TypeScript file,ESLint
cannot locate the files for B (it has not yet been built) and returns the errorimport-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 makeimport-x
happy.Thanks
The text was updated successfully, but these errors were encountered: