-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Multi-project configurations cannot be linted all at once #2260
Comments
Maybe this is a FlatConfig-specific thing? I can't reproduce this in the example project, but I can definitely reproduce it in ours. |
Confirmed this reproduces in the multiple-project sample project. It doesn't reproduce today because both schemas define a User type. If you just change one of them to be called AdminUser instead, it reproduces: This will say that the AdminUser is unreachable, if eslint loads the other schema first. |
Also run into a similar issue. Any news on the fix? |
@dotansimha could you take a look into this? I can allocate some time into fixing it, but I need some guidance from the maintainers as to what the fix should look like. The problem comes from here. Plugin caches the first config it reads and uses it for everything. |
@user1736 can you please share the patch fix you made locally? Or what's the suggested workaround for that? @dimaMachina can help with adjusting it. |
@user1736 hi, could you create a minimal reproduction with steps to reproduce issues with caching? |
It's reproducible in the sample project in this repo. See this patch: #2260 (comment) |
So for my case specifically I used the following patch:
For my configuration having schema name + number of documents is enough to distinguish between config sections, but it's not going to fly as general solution. From my testing disabling cache all together is also not an option since everything slows down to a crawl. |
Hello! I've also just run into this issue on an internal company project. Updating:
to:
Seems to be enough to fix it in our use-case at least. But I could see a test for both |
@benasher44 can confirm that |
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox
2. A failing test has been provided
3. A local solution has been provided
4. A pull request is pending review
Describe the bug
The lint plugin does load per-project schemas, but it loads it once and ends up reusing it for all files. This results in using one project's schema to lint schemas of other projects.
To Reproduce Steps to reproduce the behavior:
Expected behavior
Lint should pass, but it instead claims that (for example) types are unreachable, since it's checking those types against the project that was loaded for the lint pass.
Environment:
@graphql-eslint/eslint-plugin
: 3.20.1Additional context
Having looked at the code a little bit, it looks like each rule looks at the loaded schema, which will be the schema loaded by the plugin at the start of the lint pass. Instead, each rule should reuse the code that loads the schema from the project-specific schema cache.
The text was updated successfully, but these errors were encountered: