Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable NoUnusedVariablesRule by default to relay env #297

Open
gtkatakura opened this issue Feb 24, 2021 · 0 comments · May be fixed by #298
Open

Disable NoUnusedVariablesRule by default to relay env #297

gtkatakura opened this issue Feb 24, 2021 · 0 comments · May be fixed by #298

Comments

@gtkatakura
Copy link

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 gtkatakura linked a pull request Feb 24, 2021 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant