Skip to content

The ignoreClientDirectives option for known-directives does not work with fragments #2941

@raymondwang

Description

@raymondwang

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox

    For example, you can start off by editing the
    'basic' example on Stackblitz.

    Please make sure the graphql-eslint version under package.json matches yours.

  • 2. A failing test has been provided

  • 3. A local solution has been provided

  • 4. A pull request is pending review


Describe the bug

The ignoreClientDirectives option for the known-directives rule only filters directives on Field and OperationDefinition nodes. It doesn't filter directives on FragmentDefinition, FragmentSpread, or InlineFragment nodes.

To Reproduce Steps to reproduce the behavior:

With config:

rules: {
  '@graphql-eslint/known-directives': ['error', { ignoreClientDirectives: ['client'] }],
},
# This works: ignored client directive on field
{
  product {
    name @client
  }
}

# This fails: ignored client directive on fragment definition                                                                     
fragment ProductFields on Product @client {
  name
}

Expected behavior

Client directives should be ignored on all executable definition nodes where they can legally appear.

Environment:

  • OS:
  • @graphql-eslint/eslint-plugin: 4.4.0
  • Node.js:

Additional context

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