@homebound/graphql-id-linter

According to apollo-client's issue 2510, the apollo client really, really wants you to include ids in every query that touches a type, so that it can maintain its cache.

Usage no npm install needed!

<script type="module">
  import homeboundGraphqlIdLinter from 'https://cdn.skypack.dev/@homebound/graphql-id-linter';
</script>

README

graphql-id-linter

According to apollo-client's issue 2510, the apollo client really, really wants you to include ids in every query that touches a type, so that it can maintain its cache.

In theory this is getting fixed in apollo-client 3.0-beta, but always returning id is probably not a bad idea anyway.

Credits, this is a ~80% copy/paste of Cecchi's solution on this comment.

Install

npm install --save-dev @homebound/graphql-id-linter

Include it in your graphql-codegen.yml:

schema: ./schema.json
documents: src/**/*.graphql
generates:
  src/generated/graphql-types.tsx:
    plugins:
      - "@homebound/graphql-id-linter"