Skip to content

Processor extremely slow - Can't migrate from eslint-plugin-graphql #2932

@ItaiYosephi

Description

@ItaiYosephi

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
In our frontend app, which is quite big, we use both .gql files and gql``` in .ts/.tsx` to define operations.

While trying to migrate from eslint-plugin-graphql, we added the following to our eslint.config.js, trying to have the same rules we have using eslint-plugin-graphql:

      {
        files: ['**/*.{ts,tsx}'],
        processor: graphqlPlugin.processor,
      },
      {
        files: ['**/*.{gql,graphql}'],
        languageOptions: {
          parser: graphqlPlugin.parser,
        },
        plugins: {
          '@graphql-eslint': graphqlPlugin,
        },
        rules: {
          '@graphql-eslint/executable-definitions': 'error',
          '@graphql-eslint/fields-on-correct-type': 'error',
          '@graphql-eslint/fragments-on-composite-type': 'error',
          '@graphql-eslint/known-directives': 'error',
          '@graphql-eslint/known-type-names': 'error',
          '@graphql-eslint/lone-anonymous-operation': 'error',
          '@graphql-eslint/no-fragment-cycles': 'error',
          '@graphql-eslint/no-undefined-variables': 'error',
          '@graphql-eslint/no-unused-variables': 'error',
          '@graphql-eslint/overlapping-fields-can-be-merged': 'error',
          '@graphql-eslint/possible-fragment-spread': 'error',
          '@graphql-eslint/provided-required-arguments': 'error',
          '@graphql-eslint/scalar-leafs': 'error',
          '@graphql-eslint/one-field-subscriptions': 'error',
          '@graphql-eslint/unique-argument-names': 'error',
          '@graphql-eslint/unique-directive-names-per-location': 'error',
          '@graphql-eslint/unique-input-field-names': 'error',
          '@graphql-eslint/unique-operation-name': 'error',
          '@graphql-eslint/unique-variable-names': 'error',
          '@graphql-eslint/value-literals-of-correct-type': 'error',
          '@graphql-eslint/variables-are-input-types': 'error',
          '@graphql-eslint/variables-in-allowed-position': 'error',
        },
      },

When running eslint, I waited for over an hour and it never ended, but after removing:

      {
        files: ['**/*.{ts,tsx}'],
        processor: graphqlPlugin.processor,
      },

it took 12 minutes...

I think this is related: #1858 .

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