Skip to content

feat(graphql): honor eslint-disable comments when linting schema - #1258

Open
malept wants to merge 1 commit into
malept/dt-5641/fix/graphql-lint-hashtag-ignore-directivesfrom
malept/dt-5642/feat/graphql-lint-eslint-disable-comments
Open

malept wants to merge 1 commit into
malept/dt-5641/fix/graphql-lint-hashtag-ignore-directivesfrom
malept/dt-5642/feat/graphql-lint-eslint-disable-comments

Conversation

@malept

@malept malept commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

What this PR does / why we need it

Schemas already carry # eslint-disable ... comments to silence @graphql-eslint rules. Devbase ignored them and reported the violations they suppress, so it could not replace ESLint on those schemas.

Honor # eslint-disable, # eslint-enable and # eslint-disable-next-line for Tier 2 and Tier 3 rules. A rule is named as @graphql-eslint/<rule> or by its bare name, a -- reason suffix is ignored, and a directive naming no rule covers every suppressible rule. Tier 1 violations are never suppressed, since they are parse and schema validity errors. eslint-disable-line is not supported because the schemas this was tested against do not use it.

Jira ID

DT-5642

Notes for your reviewers

Suppression is a filter over the violations a run produces, using each violation's file and line, so --diff mode gets it too. Directives are read from real comment tokens, so text inside a description block string is never a directive.

Rejected review findings and intentional non-goals

These were raised in earlier reviews and deliberately left as they are. Do not raise them again unless the reasoning below no longer holds.

Rejected findings

  • Remove the comment on the const block of directive kinds. The repo's doculint requires a comment on every const block.
  • Restructure the named results and var rest in parseEslintDirective. The current form is acceptable and a rewrite would not be clearer.

Intentional behavior

  • eslint-disable-line is not supported, and a line using it silences nothing and produces no warning.
  • A directive naming an unknown rule is ignored without a message. ESLint reports unknown or unused directives. Devbase does not.
  • Unused directives are not reported.
  • The unsuppressibleRules guard cannot be reached today, because Tier 1 violations return from FilesFromSources before suppression runs. It stays as protection against that order changing, and a test calls withoutSuppressed directly to cover it.
  • Operation documents are dropped before linting, so directives in them are never read.
  • suppresses replays directives for each violation. That is not significant at schema scale.

Repositories already carry "# eslint-disable ..." comments to silence
@graphql-eslint rules, and the devbase port ignored them, so it
reported violations those comments suppress.

Honor eslint-disable, eslint-enable and eslint-disable-next-line
comments for Tier 2 and Tier 3 rules, naming a rule as
"@graphql-eslint/<rule>" or by its bare name, with an optional "--"
reason. A directive naming no rule covers every suppressible rule.
Tier 1 and unclassified gqlparser violations are never suppressed.
eslint-disable-line is not supported.

Assisted-By: claude-sonnet 5.5 via opencode
@malept
malept added this pull request to stack #1261 October 24, 2026 00:22
@getoutreach-ci-1

Copy link
Copy Markdown
Contributor

Link to code coverage report (posted by coverbot 🤖)

@malept
malept marked this pull request as ready for review October 24, 2026 00:33
@malept
malept requested a review from a team as a code owner October 24, 2026 00:33

@Ned-el-ch Ned-el-ch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants