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

Variable define a query and use inside a fragment

Open alexis-regnaud opened this issue 5 years ago • 0 comments
trafficstars

Hi, I have this lint error : Screen Shot 2020-05-21 at 10 15 41 AM

Here my Query :

#import './user-fragment.gql'

query GetUser($id: Int!, $filter: String, $sorts: [String!]) {
  user(id: $id) {
    ...UserFragment
  }
}

And here my Fragment :

fragment UserFragment on User {
  id
  username
  name
  email
  time_zone
  state
  custom_expression_access
  user_roles(filter: $filter, sorts: $sorts) {
    id
    role {
      id
      name
      type
    }
  }
}

The linter seems not recognized that $filter is use by the Fragment and send me a error. Do we have a solution for this kind of issue or I have to add a // eslint-disable-next-line in the Query file ?

alexis-regnaud avatar May 21 '20 14:05 alexis-regnaud