Skip to content

Linting fails with @graphql-eslint/no-unused-variables when variable used in a fragment #651

@beaucollins

Description

@beaucollins

Describe the bug

A query operation in one graphql SomeQuery.graphql defines a variable to be used by a fragment in another document SomeFragment.graphql fails linting and is told the variable is unused even though it is used by the fragment.

To Reproduce
Steps to reproduce the behavior:

Example of failure: beaucollins/graphql-lint-fragment-variables@91fee89#annotation_1981886819

Expected behavior

This should not be an error because the variable is used according to @graphql-eslint/no-unused-variables:

A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.

Environment:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugBug :-(stage/5-alpha-release-testingThe pull request is merged, an alpha release is available, to be tested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions