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

`no-unreachable-types` doesn't seem to work properly when Query/Mutation types are defined in a separate file

Open Berger92 opened this issue 2 years ago β€’ 1 comments

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • [ ] 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox

Please make sure the graphql-eslint version under package.json matches yours.

  • [ ] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

Describe the bug

Hi πŸ‘‹

We're trying to use this library to lint some of our subgraphs (in an Apollo Federation) and as per the sandbox below, we are getting an error for all of our types from no-unreachable-types rule. Are we doing something wrong, or is there a real issue here? πŸ€”

Thanks.

To Reproduce Steps to reproduce the behavior:

CodeSandbox Run yarn lint in the console

Expected behavior

Book is reachable and it shouldn't throw an Error for it.

Environment:

  • OS: MacOS
  • @graphql-eslint/eslint-plugin: 3.10.7
  • Node.js: 16.15

Berger92 avatar Aug 05 '22 16:08 Berger92

It’s works perfectly fine, provide full schema for graphql-eslint

parserOptions:
  schema:
    - './src/schema.graphql'
+   - './src/subgraph.graphql'

dimaMachina avatar Aug 05 '22 17:08 dimaMachina

@B2o5T Thanks for the quick response. Yes, it seems to be working now. It is a bit strange that you have to add the file being linted to the schema as well πŸ€” But, I am glad it is working πŸŽ‰

Berger92 avatar Aug 07 '22 09:08 Berger92