graphql-eslint icon indicating copy to clipboard operation
graphql-eslint copied to clipboard

error on duplicate schema

Open dontsave opened this issue 3 years ago • 2 comments

Hi there. Is it possible to write a rule that would error if locally defined @client schema is a duplicate of schema from a remote endpoint? This would be very useful for projects in which client schema is written temporarily on the front-end and then implemented on the back-end later. It would be great to have the linter remind us to remove the local schema once it exists on the server

dontsave avatar Aug 08 '22 22:08 dontsave

Hi, do you mean @client directives?

dimaMachina avatar Aug 09 '22 10:08 dimaMachina

I guess to simplify, what I mean is if we have schema defined in two places, say:

parserOptions: {
  schema:[
    'schema-1.gql',
    'schema-2.gql'
  ]
}

if schema-1 contains a type A and schema-2 also contains a type A, then we have duplicated schema. This breaks some tools like Apollo's VSCode extension. It would be great if we could be alerted of this by the linter to make sure those tools are always working. Is that possible?

dontsave avatar Aug 09 '22 14:08 dontsave