Fragments are not properly detected for the `known-fragment-names` rule
See original GitHub issueHello all 👋,
Following the discussion here : https://github.com/dotansimha/graphql-eslint/discussions/456#discussioncomment-781188
Describe the bug
The rules known-fragment-names
and no-unused-fragments
are erroring even if all my fragments are loaded by graphql-eslint.
I edited the sources and logged the value of the siblings
variable : https://github.com/dotansimha/graphql-eslint/blob/master/packages/plugin/src/sibling-operations.ts#L83-L88
When I run eslint CLI, here is the output : https://gist.github.com/jgoux/73b79e57b96531f89ab6c99b089c2512
You can see the errors at the end : https://gist.github.com/jgoux/73b79e57b96531f89ab6c99b089c2512#file-log-sh-L796-L818
As an example, the ProfileForm_user
fragment which is in error is properly detected and loaded here : https://gist.github.com/jgoux/73b79e57b96531f89ab6c99b089c2512#file-log-sh-L98-L105
To Reproduce Steps to reproduce the behavior:
Expected behavior
If all the fragments are detected by the plugin, I should have no errors in my case.
Environment:
- OS: MacOS Big Sur
@graphql-eslint/...
: 1.0.1- NodeJS: v14.15.5
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:19 (10 by maintainers)
Top GitHub Comments
I just discovered this great project and had the same experience as @jgoux. From reading the docs I assumed the
operations
field removed the need to add import statements to the graphql files. Other than that everything appears to work well!That seems to have solved the nested fragments issue, nice! It appears that specifying undefined fragments causes stack overflows in this version though: