You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We're using graphql-eslint with graphql-config to enable linting GraphQL string in our frontend codebase which uses Relay.
Field __id is available in Relay on all non-scalar fields: https://relay.dev/docs/next/glossary/#dataid. The meaning behind this id (also called data ID) is to expose the value of the key in Relay's cache. Most of the times __id equals to id if type extends Node interface.
But our use-case is with connections. Relay mutations can receive "connection ID" so you can update lists, it's idiomatic to pass this id dynamically by querying __id on connection fragment (supplied to usePaginationFragment hook).
The problem is that at the moment we must disable @graphql-eslint/fields-on-correct-type rule because field __id is not recognized, e.g.:
error Cannot query field "__id" on type "ItemsConnection" @graphql-eslint/fields-on-correct-type
Describe the solution you'd like
Provide boolean option in configuration file that would specify that schema is used in Relay context. It could be as simple as relay: true or to future-proof it for other clients:
client: 'relay'
It's not really important I think.
Describe alternatives you've considered
I've tried to create my own extension in graphql-config so I could try extending every non-scalar type with __id but I did not manage to load the extension. It's not entirely clear to me from documentation how can I create and load my own extension if I'm using graphql-eslint because my goal is to not create 3rd party tool (I noticed tools like graphql-codegen load the configuration and extension in one specific place via CLI).
Additional context
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
We're using
graphql-eslint
withgraphql-config
to enable linting GraphQL string in our frontend codebase which uses Relay.Field
__id
is available in Relay on all non-scalar fields: https://relay.dev/docs/next/glossary/#dataid. The meaning behind this id (also called data ID) is to expose the value of the key in Relay's cache. Most of the times__id
equals toid
if type extendsNode
interface.But our use-case is with connections. Relay mutations can receive "connection ID" so you can update lists, it's idiomatic to pass this id dynamically by querying
__id
on connection fragment (supplied tousePaginationFragment
hook).The problem is that at the moment we must disable
@graphql-eslint/fields-on-correct-type
rule because field__id
is not recognized, e.g.:Describe the solution you'd like
Provide boolean option in configuration file that would specify that schema is used in Relay context. It could be as simple as
relay: true
or to future-proof it for other clients:It's not really important I think.
Describe alternatives you've considered
I've tried to create my own extension in
graphql-config
so I could try extending every non-scalar type with__id
but I did not manage to load the extension. It's not entirely clear to me from documentation how can I create and load my own extension if I'm usinggraphql-eslint
because my goal is to not create 3rd party tool (I noticed tools likegraphql-codegen
load the configuration and extension in one specific place via CLI).Additional context
The text was updated successfully, but these errors were encountered: