-
-
Notifications
You must be signed in to change notification settings - Fork 64
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/no-unresolved: wildcard exports causing import resolution error in a monorepo #218
Comments
Hi. This fixed a similar issue for me. I didn't need to add a I fixed my issue by adding this to my parserOptions: {
project: ['tsconfig.json', 'packages/*/tsconfig.json'],
node: true,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
'import/resolver': {
typescript: {
// See https://github.com/import-js/eslint-import-resolver-typescript for documentation of these settings
// This `project` entry is needed, in addition to the `project` entry above under `parserOptions`,
// otherwise eslint-plugin-import's `import/no-unused-modules` rule will not work correctly
project: ['tsconfig.json', 'packages/*/tsconfig.json'],
},
},
}, Equivalent syntax for a {
"parserOptions": {
"project": [
"tsconfig.json",
"packages /*/tsconfig.json"
],
"node": true
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [
".ts"
]
},
"import/resolver": {
"typescript": {
"project": [
"tsconfig.json",
"packages/*/tsconfig.json"
]
}
}
}
} |
Any progress on this? I also want to use the exports field in a monorepo, and made typescript work, except I couldn't make eslint to know about imports. |
Any issue should be reported with an online runnable reproduction, otherwise I can help to debug at all. Mostly this should belong to |
This worked for me: https://www.npmjs.com/package/eslint-import-resolver-exports
|
In my monorepo, I have a package.json file with the following configuration:
However, when I try to import a module from this package in my code with the statement import { example } from "example/index.ts", I encounter the following error:
This is my .eslintrc
Here is a demo CodeSandbox that reproduces the error: https://codesandbox.io/p/sandbox/amazing-booth-i2ugum?welcome=true
The text was updated successfully, but these errors were encountered: