-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bug: multiple rootDirs in monorepo not honoured #7884
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
Comments
There's a lot of layers and indirection to this repro - tsconfigs extend tsconfigs, ESLint configs extend ESLint configs which extend utility functions from npm, linting is done by a separate tool. Could you please slim the repro down a bit? Ideally the only npm deps should be TS, ESLint, and our parser+plugin. |
Thanks @bradzacher - i've simplified the repository now.
I'm not sure what you mean by "linting is done by a separate tool". It's only using If you would like to avoid this you can:
It's worth noting that whilst this is using the flat config, I was previously using the I've also tried using the But that doesn't seem to make a difference in this scenario. |
I haven't had a chance to check things out locally yet but looking around at the setup - it makes sense that it's not working. Even though your second package is part of the monorepo - it's imported as if it were an npm package and its source is included via a symlink that's managed by pnpm. TypeScript doesn't respect the tsconfig of npm packages. If you want it to understand that the you will need to leverage project references like we do in our repo. |
Ah, I see what you're saying. And you're right even though VSCode shows the name of the type, it doesn't know what that type actually is. I'll close the issue as you're right it's about how typescript is behaving and not the linting. FYI, I just tried to use project references, and got the same errors. I believe it's because of this: From Caveats for Project References
If this requires a build step, then I think I might prefer to build the package and its types and expose it through the Something like:
The downside is that things won't be as dynamic for a development experience. This can be worked around by having a build watch the files for changes. I was trying to avoid doing that, hoping there was a lighter weight solution. Thanks for your help, and quick responses :) |
Uh oh!
There was an error while loading. Please reload this page.
Before You File a Bug Report Please Confirm You Have Done The Following...
Issue Description
I expected that linting should have no issues, however it gets:
I suspect it has something to do with
two
not knowing to follow the multiple root dirs that are defined inone
'stsconfig.json
. VSCode is able to show the types when hovering over the variables, but linting shows errors in both vscode and when running from the command line.Reproduction Repository Link
https://github.com/squirmy/eslint-root-dirs-issue
Repro Steps
pnpm install
pnpm lint
Versions
@typescript-eslint/eslint-plugin
6.9.1
@typescript-eslint/parser
6.9.1
TypeScript
5.2.2
ESLint
8.53.0
node
20.9.0
The text was updated successfully, but these errors were encountered: