Unexpected @graphql-eslint/known-fragment-names when using fragments within fragments
See original GitHub issueDescribe the bug
Not precisely sure what the exact requirements are but this is close to what we have in our codebase. It appears that a certain depth of fragment use in an operations
document is not able to be found. I tried moving the fragment definitions in different orders with the same result.
Moving the fragments into the same file as the operation that uses them will cause the error to go away.
Also the line numbers that are reported are the wrong file and not the correct location if they were in the other file.
https://github.com/beaucollins/graphql-lint-fragment-variables/runs/3715892638
To Reproduce Steps to reproduce the behavior:
git clone -b fragment-not-found git@github.com:beaucollins/graphql-lint-fragment-variables.git
npm install
npm run lint
graphql-lint-fragment-variables/src/admin/allOwners.graphql
11:9 error Unknown fragment "TimelineEntry" @graphql-eslint/known-fragment-names
14:9 error Unknown fragment "TimelineEntry" @graphql-eslint/known-fragment-names
Expected behavior
The fragment should be found and validated correctly. Copying the contents of sharedFields.graphql
into allOwners.graphql
shows the expected result.
Environment:
- OS: macOS 11.5.2
@graphql-eslint/eslint-plugin@2.2.0
- NodeJS: v16.9.1
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:11 (6 by maintainers)
Top GitHub Comments
I am actually running into the same issues in my project, using a default and not a named import, with eslint-plugin@latest 😦
I tested it with default import, but forget to test with named import, I think we need adjust a fix for named import too