Skip to content

Disable NoUnusedVariablesRule by default to relay env #297

@gtkatakura

Description

@gtkatakura

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") {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions