Skip to content

Support per-operationType configuration for OperationDefinition naming conventions #2910

Open
@joe-re

Description

@joe-re

Is your feature request related to a problem? Please describe.

Currently, the OperationDefinition naming convention rule in @graphql-eslint can only be configured globally for all operation types. This limitation makes it difficult to enforce different naming conventions for different types of operations (query, mutation, subscription), which is a common requirement in many codebases.

Describe the solution you'd like

I would like to be able to configure OperationDefinition naming conventions per operationType.

To support this, I propose the following changes:

  1. Allow OperationDefinition to accept an array of asObject configurations. (asArray<asObject>)

  2. Add an operationType property to each asObject to specify which operation type it applies to.

This would allow configurations like the following:

{
  "OperationDefinition": [
    { "style": "PascalCase", "operationType": "query" },
    { "style": "snake_case", "operationType": "mutation" },
    { "style": "camelCase", "operationType": "subscription" }
  ]
}

Describe alternatives you've considered

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