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

Disable NoUnusedVariablesRule by default to relay env

Open gtkatakura opened this issue 4 years ago • 0 comments
trafficstars

The relay-compiler already validate if we have defined a variable and doesn't use them and in some cases when you don't need to use @arguments/@argumentDefinitions we receive a false negative, like this case:

const response = useLazyLoadQuery<StoresListQuery>(
    graphql`
      query StoresListQuery(
        $count: Int # Variable "$count" is never used in operation "StoresListQuery"
        $cursor: String
        $where: StoresWhereInput!
        $search: String
      ) {
        ...StoresList_stores # relay already understand that here we are using count/cursor/where/search
      }
    `,
    { count: PER_PAGE, where }
  )

  const list = usePaginationFragment<
    StoresList_stores_refetch,
    StoresList_stores$key
  >(
    graphql`
      fragment StoresList_stores on Query
      @refetchable(queryName: "StoresList_stores_refetch") {
        stores(first: $count, after: $cursor, where: $where, search: $search)
          @connection(key: "StoreList_stores") {

gtkatakura avatar Feb 24 '21 17:02 gtkatakura