Skip to content

Nested imported fragments can give false positives on unique-fragment-name #507

@lennartbuit

Description

@lennartbuit

Describe the bug

When a query imports a fragment (using #import) that itself also imports another fragment, all documents are reported as to having a duplicate fragment names.

To Reproduce

Check out this gist: https://gist.github.com/lennartbuit/3d0141b62432c133ca553de15792ad17

In this setup, I have a query importing fragment A that itself imports fragment B.

Running yarn eslint *.graphql will flag all files as having violations of the unique-fragment-name rule:

Screenshot 2021-06-29 at 21 35 30

Expected behavior

No reported errors. Fragments are only defined once, after all.

Environment:

  • OS: Mac OS
  • @graphql-eslint/...: 1.1.0
  • NodeJS: v14.16.1

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    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