Repository navigation
feat(graphql): honor eslint inline rule configuration comments - #1259
Open
malept wants to merge 2 commits into
Conversation
A schema file can reconfigure an @graphql-eslint rule for itself with a comment such as "# eslint @graphql-eslint/naming-convention: [\"error\", { ... }]". The devbase port ignored these, so it kept applying the repository config to files that override it. Honor them for Tier 2 and Tier 3 rules the way ESLint does: a comment applies to its whole file, replaces the rule's options instead of merging with them, and the last comment for a rule wins. A rule can be named with or without the "@graphql-eslint/" prefix, and the value is a severity or a [severity, options] list in YAML flow syntax. Tier 1 rules cannot be configured, and a file's own "warn" or "error" still reports at the severity scripts/devbase.yaml gives the rule. Each distinct override reruns just its rule with that configuration and keeps the results for the files that declared it, so no rule needs a per-file configuration of its own. Assisted-By: claude-sonnet 5.5 via opencode
Contributor
|
Link to code coverage report (posted by coverbot 🤖) |
malept
marked this pull request as ready for review
October 24, 2026 00:33
Ned-el-ch
reviewed
Oct 26, 2026
Ned-el-ch
approved these changes
Oct 26, 2026
Say in the package comment that inline configuration comments follow ESLint 8, and list the two ways ESLint 9 differs. Assisted-By: claude-sonnet 5.5 via opencode
|
Plan Error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it
A schema file can reconfigure a rule for itself with
# eslint @graphql-eslint/<rule>: <config>. Devbase ignored these comments and kept applying the repository config to files that override it.Honor them for Tier 2 and Tier 3 rules the way ESLint does: the comment applies to its whole file, replaces the rule's options instead of merging with them, and the last comment for a rule wins. The value is a severity or a
[severity, options]list in YAML flow syntax, which also accepts the unquoted keys ESLint allows. The behavior was checked against@graphql-eslint/eslint-plugin3.20.1 under ESLint 8.Jira ID
DT-5643
Notes for your reviewers
Each distinct override reruns only its rule with that configuration and keeps the results for the files that declared it, so no rule needs a per-file configuration. The cost is one extra pass per distinct override.
A file's
warnorerrorstill reports at the severityscripts/devbase.yamlgives the rule. Only the on/off state and options can differ per file.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
parseEslintConfigCommentandparseEslintDirectiveboth make. The duplication is one line.Intentional behavior
[severity, options]list. Extra elements are not supported, since the rules take a single options object.scripts/devbase.yamldoes not configure reports aterror, whatever severity the comment gives.--diffmode applies each side's own comments, so a changed comment can change the baseline. That follows from linting both sides the same way.