Cannot query field "admin_notification" on type "Subscription" when multiple projects defined in .graphqlrc.yml
See original GitHub issueDescribe the bug
Here is my .graphqlrc.yml
:
projects:
first:
schema: ./first.graphql
documents: ./src/first-gql.js
second:
schema: ./second.graphql
documents: ./src/second-gql.js
Here is my ./src/first-gql.js
file:
const queryUsers = gql`
query users($first: Int) {
users(first: $first) {
id
symbol
}
}
`;
Here is my ./src/second-gql.js
file:
const subscribeAdminNotification = gql`
subscription admin_notification(
$limit: Int
$order_by: [admin_notification_order_by!]
$where: admin_notification_bool_exp
) {
admin_notification(limit: $limit, order_by: $order_by, where: $where) {
id
level
}
}
`;
When running npx eslint --ext graphql,js .
the graphql-eslint
linter complains that Cannot query field "admin_notification" on type "Subscription"
, because it is looking in the wrong .graphql
schema!!!
If I remove the first schema definition from .graphqlrc.yml
, then it works OK.
Expected behavior
graphql-eslint
should lint .js files against their related .graphql schema definition (as defined by the documents
field in .graphqlrc.yml
)
Otherwise, it breaks compatibility with graphql-config@3
which documentation states that it’s supporting multiple projects
May I know how do you lint when you have multiple .graphql files/projects in .graphqlrc.yml
?
Thanks for your help!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:19 (6 by maintainers)
Top GitHub Comments
Wow, it just works!
graphql-eslint
is now correctly lintinggql
tags belonging to multiple projects.And as a bonus,
vscode.graphql
extension now works perfectly.Amazing, Thanks @B2o5T and @dotansimha for the fix and your precious help!
I let you close the issue when you feel appropriate 😃
Fixed in
@graphql-eslint/eslint-plugin@1.1.4
😃 Thanks @B2o5T ❤️