question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

let `require-id-when-available` validate when fragment is present

See original GitHub issue

consider

fragment a on A {
  id
  aField
}
# import "./a.fragment.graphql"
query AQuery {
  as { ...a }
}

Field “id” must be selected when it’s available on a type. Please make sure to include it in your selection set!eslint@graphql-eslint/require-id-when-available

require-id-when-available should allow fields which contain (only?) fragment spreads. Bonus points if the fragment themselves validate as having id

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
dotansimhacommented, Dec 19, 2020

Added another round of fixes in https://github.com/dotansimha/graphql-eslint/commit/08007cbf53731b29fba1cf3c01cb7db7eec7222c , now it should work better with inline fragments. Available in @graphql-eslint/eslint-plugin@0.5.0. Let me know if there are other issues.

2reactions
dotansimhacommented, Nov 29, 2020

@tvvignesh this issue is currently blocked because I didn’t have the time to implementing the siblings operations support. Since ESLint runs only on a single file every time, we can’t really know that’s in that fragment, so we don’t know if there is id field there. I started a PR with parser performance improvements required for this, hope to have progress on that next week 😃 This feature should allow us to do so much more with graphql-eslint 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

let `require-id-when-available` validate when fragment is ...
Error: You have used a rule which requires GraphQL operations to be loaded. Found "parserServices" generated, but unable to load your GraphQL operations....
Read more >
Fragments - Apollo GraphQL Docs
A GraphQL fragment is a piece of logic that can be shared between multiple ... declare firstName and lastName fields for the NameParts...
Read more >
Android Fragment no view found for ID? - Stack Overflow
Yes, check that you replace a fragment in the current container. Use right id of the container (I used another screen's id and...
Read more >
Fragment | Android Developers
javax.xml.validation ... FragmentLayout$TitlesFragment" android:id="@+id/titles" ... Called to ask the fragment to save its current dynamic state, ...
Read more >
ViewPager with FragmentPagerAdapter - CodePath Cliffnotes
ViewPager android:id="@+id/vpPager" android:layout_width="match_parent" ... Next, let's suppose we have defined two fragments FirstFragment and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found