Skip to content

ESLint aborts if require-description.rootField is set to false #2774

@cosmopetrich

Description

@cosmopetrich

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox
  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

ESLint will abort when linting a trivial GQL file if the rootField setting of the require-description rule is false.

The error in StackBlitz's environment is quite opaque.

Oops! Something went wrong! :(

ESLint: 9.15.0

getPossibleTypes@file:///home/projects/github-a3aypf/node_modules/eslint/lib/linter/node-event-generator.js#cjs:67:13
[...]
lintFiles/results</</<@file:///home/projects/github-a3aypf/node_modules/eslint/lib/eslint/eslint.js#cjs:810:50

On my local environment, with a newer Node, I additionally get the error below in addition to that stack trace.

Oops! Something went wrong! :(

ESLint: 9.15.0

TypeError: Cannot read properties of undefined (reading 'type')

To Reproduce Steps to reproduce the behavior:

A fork of the StackBlitz can be found here: https://stackblitz.com/edit/github-a3aypf?file=eslint.config.js

Running eslint in that environment should trigger the error.

Expected behavior

The linter runs normally with rootField: false set, and does not require descriptions on root fields.

Environment:

  • OS: Ubuntu
  • @graphql-eslint/eslint-plugin: 4.0.0
  • Node.js: v18.20.3 (StackBlitz) or v22.11.0 (my local environment)

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