Skip to content
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

Support Relay __id #316

Open
liamqma opened this issue Oct 18, 2021 · 2 comments
Open

Support Relay __id #316

liamqma opened this issue Oct 18, 2021 · 2 comments

Comments

@liamqma
Copy link

liamqma commented Oct 18, 2021

Hi 👋,

I have the below Relay GraphQL query:

fragment expandedCard on Board {
      __id // Cannot query field "__id" on type "Board".eslint(graphql/template-strings)
}

However, ESLint rule graphql/template-strings complains about "FieldsOnCorrectType" because __id does not exist in the schema.
However, The __id field is NOT something that GraphQL API needs to expose. Instead, it's an identifier that Relay automatically adds to identify the connection record. I guess it's valid for anyone who uses Relay. See this example.

After reading a few Github threads, I notice that __id is in the considering of being added to GraphQL spec but there is no consensus yet.

As a workaround, I can remove 'FieldsOnCorrectType' from the validators for Relay and build a custom ESLint rule for it. Just wondering if you can think of any other work around. Thanks 🙂

@rbalicki2
Copy link

I am running into this issue as well. Is there a way to suppress this lint for a given field?

@jerelmiller
Copy link
Member

Hey @rbalicki2 👋

Unfortunately we are deprecating this library as its largely gone unmaintained in recent years. We are recommending the switch to graphql-eslint since its much more maintained and fully featured at this point. Apologies we haven't actually gone through the motions to archive this repo and deprecate in npm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants