-
-
Notifications
You must be signed in to change notification settings - Fork 805
feat(graphql_analyze): implement useLoneAnonymousOperation #8616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 83b95ec The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughAdds a new GraphQL nursery lint rule Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (15)
📒 Files selected for processing (14)
🚧 Files skipped from review as they are similar to previous changes (7)
🧰 Additional context used📓 Path-based instructions (1)**/*.rs📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
🧠 Learnings (18)📓 Common learnings📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-11-24T18:05:42.356ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-11-21T01:10:53.059ZApplied to files:
📚 Learning: 2025-11-24T18:05:42.356ZApplied to files:
📚 Learning: 2025-11-24T18:05:42.356ZApplied to files:
📚 Learning: 2025-11-24T18:05:20.371ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
🔇 Additional comments (7)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (2)
9-47: Consider addingissue_numberfield.Per coding guidelines, work-in-progress rules in the nursery group should include an
issue_numberfield in thedeclare_lint_rule!macro to track the associated issue. Based on learnings, addissue_numberfield todeclare_lint_rule!macro for work-in-progress rules.Suggested addition
pub UseLoneAnonymousOperation { version: "next", name: "useLoneAnonymousOperation", language: "graphql", recommended: false, + issue_number: 8616, sources: &[RuleSource::EslintGraphql("lone-anonymous-operation").same()], }Additionally, consider adding a valid example showing a single anonymous operation (which is allowed) to better illustrate when the rule doesn't trigger:
query { fieldA }
103-131: Consider clarifying the diagnostic message.The message "Document contains (multiple) anonymous operations" with "(multiple)" in parentheses is slightly ambiguous when only one anonymous operation exists alongside named operations. Consider:
- "Document contains anonymous operation(s) alongside other operations"
- Conditionally pluralising based on
state.len()However, the detail message on line 117 and the notes are clear and helpful, so this is a minor wording suggestion.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (15)
crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_graphql_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (14)
.changeset/eleven-parents-divide.mdcrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphqlcrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
🧠 Learnings (43)
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Wrap rule options fields in `Option<>` to properly track set and unset options during merge
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be placed inside the `biome_rule_options` crate
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `deny_unknown_fields` in serde derive macro for rule options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `rename_all = "camelCase"` in serde derive macro for rule options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation must include `## Options` section if the rule has options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `version` field to `next` in `declare_lint_rule!` macro
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use generic rule names if the rule could potentially be implemented for multiple languages
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Implement `Merge` trait for rule options to support configuration inheritance
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `options` code block property for rule-specific configuration snippets in documentation
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use language-specific rule names if the rule is meant for a specific language only
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Add `issue_number` field to `declare_lint_rule!` macro for work-in-progress rules
Applied to files:
.changeset/eleven-parents-divide.mdcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Place new rules inside the `nursery` group during development
Applied to files:
.changeset/eleven-parents-divide.mdcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For new nursery rules, send PRs to the maintenance branch `main`
Applied to files:
.changeset/eleven-parents-divide.md
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : The first paragraph of rule documentation must be a single line describing what the rule does
Applied to files:
.changeset/eleven-parents-divide.mdcrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*invalid* : Create test files prefixed with `invalid` for code that should trigger the rule
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*valid* : Create test files prefixed with `valid` for code that should not trigger the rule
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Valid code examples in rule documentation should not trigger any diagnostics
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Each invalid code example in rule documentation must emit exactly one diagnostic
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphqlcrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `Ast<>` query type to query AST/CST for nodes of a specific type
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Invalid code examples in rule documentation must be marked with `expect_diagnostic` code block property
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Prefix line with `#` in documentation code examples sparingly; prefer concise complete snippets
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_node_union!` macro to query multiple node types at once
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Check if a variable is global using the semantic model to avoid false positives
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options struct must derive `Deserializable`, `Serialize`, `Deserialize`, and optionally `JsonSchema`
Applied to files:
crates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `use_options` code block property for code examples that follow an options configuration in documentation
Applied to files:
crates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.
Applied to files:
crates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `full_options` code block property for complete biome.json configuration snippets in documentation
Applied to files:
crates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/spec_tests.rs : Use the `tests_macros::gen_tests!` macro in `spec_tests.rs` to generate test functions for each specification file matching the pattern `tests/specs/<language>/**/*.<ext>`
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_lint_rule!` macro to declare analyzer rule types and implement the RuleMeta trait
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should perform static analysis of source code to detect invalid or error-prone patterns and emit diagnostics with proposed fixes
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-22T09:26:56.943Z
Learnt from: ematipico
Repo: biomejs/biome PR: 8537
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:167-210
Timestamp: 2025-12-22T09:26:56.943Z
Learning: When defining lint rules (declare_lint_rule!), only specify fix_kind if the rule implements an action(...) function. Rules that only emit diagnostics without a code fix should omit fix_kind. This applies to all Rust lint rule definitions under crates/.../src/lint (e.g., crates/biome_js_analyze/src/lint/...).
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Implement `action` function in Rule trait to provide code actions
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Specify `fix_kind: FixKind::Safe` in `declare_lint_rule!` for safe code actions
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation code blocks should be ordered as language, expect_diagnostic, options/full_options/use_options, ignore, file
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).same()` when implementing a rule that matches the behavior of an ESLint rule
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should check syntax according to language specification and emit error diagnostics
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Lines prefixed with `#` in rule documentation code examples will be hidden from output
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `ignore` code block property to exclude documentation code examples from automatic validation
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use #[derive(Diagnostic)] on enums when every variant contains a type that is itself a diagnostic
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Fields with #[advice] or #[verbose_advice] attributes must implement the Advices trait to record advices on the diagnostic
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Implement the Diagnostic trait on types, or use the #[derive(Diagnostic)] procedural macro to implement the trait. Configure category, severity, description, message, location, and tags using the #[diagnostic] attribute
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Ensure the type implementing Diagnostic derives Debug
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
🧬 Code graph analysis (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (3)
crates/biome_service/src/workspace.rs (1)
markup(1187-1189)crates/biome_analyze/src/rule.rs (4)
recommended(619-622)sources(634-637)same(252-257)span(1499-1501)crates/biome_service/src/workspace_types.rs (1)
Self(748-748)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Check JS Files
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Test Node.js API
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Documentation
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: End-to-end tests
- GitHub Check: autofix
🔇 Additional comments (14)
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql (1)
1-7: LGTM!Test case correctly exercises the rule with two shorthand anonymous operations. The GraphQL syntax is valid, and the diagnostic comment is appropriate.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql (1)
1-7: LGTM!Test case correctly exercises the rule with an anonymous operation alongside a named query. This validates the rule's detection of anonymous operations when other named operations are present.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql (1)
1-7: LGTM!Test case correctly exercises the rule with an anonymous query alongside a named mutation. This ensures the rule detects anonymous operations when mixed with different operation types.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql (1)
1-7: LGTM!Test case correctly exercises the rule with both shorthand and explicit anonymous operations. This ensures the rule detects multiple anonymous operations regardless of their syntax form.
.changeset/eleven-parents-divide.md (1)
1-17: LGTM!Changeset correctly documents the new nursery rule with a clear description and appropriate invalid example. The documentation follows the standard format.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphql (1)
1-4: LGTM!Test case correctly validates that a single anonymous operation should not trigger diagnostics. This is the core valid scenario for the rule.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql (1)
1-7: LGTM!Test case correctly validates that an anonymous operation with fragment definitions should not trigger diagnostics. Fragments are not operations, so this is appropriately classified as valid.
crates/biome_rule_options/src/lib.rs (1)
342-342: LGTM!Module export correctly placed in alphabetical order. The addition follows codebase conventions perfectly.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql (1)
1-7: LGTM!Test correctly validates that multiple named operations should not trigger the rule.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql (1)
1-7: LGTM!Test correctly validates that an anonymous operation alongside a named subscription should trigger diagnostics.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql (1)
1-4: LGTM!Test correctly validates that documents with no operations (fragments only) should not trigger the rule.
crates/biome_rule_options/src/use_lone_anonymous_operation.rs (1)
1-6: LGTM!The options struct follows all required patterns and conventions for rule options, even though no options are currently needed.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql (1)
1-7: LGTM!Test correctly validates that multiple anonymous operations should trigger diagnostics.
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (1)
55-101: LGTM!The
run()implementation correctly identifies anonymous operations by checking for both unnamedGraphqlOperationDefinitionnodes andGraphqlSelectionSetnodes (which represent shorthand syntax). The early returns appropriately optimise for common cases.
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
ematipico
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code and the diagnostics can be improved
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
Outdated
Show resolved
Hide resolved
| i Document contains (multiple) anonymous operations. | ||
| 1 │ # should generate diagnostics | ||
| > 2 │ query { | ||
| │ ^^^^^^^ | ||
| > 3 │ fieldA | ||
| > 4 │ } | ||
| > 5 │ query { | ||
| > 6 │ fieldB | ||
| > 7 │ } | ||
| │ ^ | ||
| 8 │ | ||
| i This anonymous operation must be the only defined operation in this document. | ||
| 1 │ # should generate diagnostics | ||
| > 2 │ query { | ||
| │ ^^^^^^^ | ||
| > 3 │ fieldA | ||
| > 4 │ } | ||
| │ ^ | ||
| 5 │ query { | ||
| 6 │ fieldB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have repeated text range, which is a bit odd... it seems like a bug. Shouldn't we highlight the other anonymous operations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first range is actually on the full document.
I wanted to first mention that the document is invalid with "Document contains (multiple) anonymous operations." and then show the operations. But the initial report requires a textrange, so I set that to the full document. Maybe I can rewrite it to use the first query there and then loop over all the other operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see! I didn't notice that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworked :)
e737d50 to
4feea33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.changeset/eleven-parents-divide.md (1)
7-16: Consider adding a valid example for clarity.The changeset shows what's invalid but not what's valid. Adding a valid example (e.g., multiple named operations or a single anonymous operation) would help users quickly understand the rule's intent when reading the changelog.
🔎 Suggested addition
```graphql query { fieldA } query B { fieldB }
+Valid:
+
+```graphql
+query A {
- fieldA
+}+query B {
- fieldB
+}
+```</details> </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used**: Path: .coderabbit.yaml **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between e737d50e71c740b37fd063568171893832cdff23 and 4feea330608670bbbefb263b2a1a92a174f4cafd. </details> <details> <summary>⛔ Files ignored due to path filters (15)</summary> * `crates/biome_configuration/src/analyzer/linter/rules.rs` is excluded by `!**/rules.rs` and included by `**` * `crates/biome_diagnostics_categories/src/categories.rs` is excluded by `!**/categories.rs` and included by `**` * `crates/biome_graphql_analyze/src/lint/nursery.rs` is excluded by `!**/nursery.rs` and included by `**` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql.snap` is excluded by `!**/*.snap` and included by `**` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql.snap` is excluded by `!**/*.snap` and included by `**` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql.snap` is excluded by `!**/*.snap` and included by `**` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql.snap` is excluded by `!**/*.snap` and included by `**` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql.snap` is excluded by `!**/*.snap` and included by `**` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql.snap` is excluded by `!**/*.snap` and included by `**` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql.snap` is excluded by `!**/*.snap` and included by `**` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql.snap` is excluded by `!**/*.snap` and included by `**` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphql.snap` is excluded by `!**/*.snap` and included by `**` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql.snap` is excluded by `!**/*.snap` and included by `**` * `packages/@biomejs/backend-jsonrpc/src/workspace.ts` is excluded by `!**/backend-jsonrpc/src/workspace.ts` and included by `**` * `packages/@biomejs/biome/configuration_schema.json` is excluded by `!**/configuration_schema.json` and included by `**` </details> <details> <summary>📒 Files selected for processing (15)</summary> * `.changeset/eleven-parents-divide.md` * `crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphql` * `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql` * `crates/biome_rule_options/src/lib.rs` * `crates/biome_rule_options/src/use_lone_anonymous_operation.rs` * `justfile` </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (7)</summary> * crates/biome_rule_options/src/lib.rs * crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs * crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql * crates/biome_rule_options/src/use_lone_anonymous_operation.rs * crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql * crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql * crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🧠 Learnings (14)</summary> <details> <summary>📓 Common learnings</summary>Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g.,type Options = RuleNameOptions) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.</details> <details> <summary>📚 Learning: 2026-01-02T14:58:16.536Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze//*_analyze//src/lint/**/*.rs : Invalid code snippets in rule documentation must emit exactly one diagnostic**Applied to files:** - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql` - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql` - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql` - `.changeset/eleven-parents-divide.md` - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql` - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphql` </details> <details> <summary>📚 Learning: 2026-01-02T14:58:16.536Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze//*_analyze//src/lint/**/*.rs : Usedeclare_node_union!macro to query multiple node types together to avoid redundant traversal passes**Applied to files:** - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql` - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql` - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql` - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphql` </details> <details> <summary>📚 Learning: 2026-01-02T14:58:16.536Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze//tests/specs//* : Create test files withinvalidandvalidprefixes to represent code that should and should not trigger the rule**Applied to files:** - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql` - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql` - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql` - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql` </details> <details> <summary>📚 Learning: 2026-01-02T14:58:16.536Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze//*_analyze//src/lint/**/*.rs : New rules must be placed inside thenurserygroup before promotion to other groups**Applied to files:** - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql` - `.changeset/eleven-parents-divide.md` </details> <details> <summary>📚 Learning: 2025-11-24T18:05:42.356Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish betweenTypeData::UnknownandTypeData::UnknownKeywordto measure inference effectiveness versus explicit user-provided unknown types**Applied to files:** - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql` </details> <details> <summary>📚 Learning: 2025-12-31T15:35:41.261Z</summary>Learnt from: dyc3
Repo: biomejs/biome PR: 8639
File: crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs:101-108
Timestamp: 2025-12-31T15:35:41.261Z
Learning: In crates/biome_analyze//*analyze/src/lint/nursery//*.rs, theissue_numberfield indeclare_lint_rule!macro is optional and the vast majority of nursery rules do not need it. Do not recommend addingissue_numberunless there's a specific reason.**Applied to files:** - `.changeset/eleven-parents-divide.md` </details> <details> <summary>📚 Learning: 2025-12-21T21:15:03.796Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For new nursery rules, send PRs to the maintenance branchmain**Applied to files:** - `.changeset/eleven-parents-divide.md` </details> <details> <summary>📚 Learning: 2026-01-02T14:58:16.536Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze//*_analyze//src/lint/**/*.rs : The first paragraph of rule documentation must be written in a single line to ensure proper rendering in the rules overview table**Applied to files:** - `.changeset/eleven-parents-divide.md` </details> <details> <summary>📚 Learning: 2025-12-21T21:15:03.796Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For rule changes in changesets, clearly demonstrate what is now invalid that wasn't before, or vice versa**Applied to files:** - `.changeset/eleven-parents-divide.md` </details> <details> <summary>📚 Learning: 2025-11-24T18:04:57.309Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use #[derive(Diagnostic)] on enums when every variant contains a type that is itself a diagnostic**Applied to files:** - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql` </details> <details> <summary>📚 Learning: 2025-11-24T18:04:57.309Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Fields with #[advice] or #[verbose_advice] attributes must implement the Advices trait to record advices on the diagnostic**Applied to files:** - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql` </details> <details> <summary>📚 Learning: 2025-11-24T18:04:57.309Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Implement the Diagnostic trait on types, or use the #[derive(Diagnostic)] procedural macro to implement the trait. Configure category, severity, description, message, location, and tags using the #[diagnostic] attribute**Applied to files:** - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql` </details> <details> <summary>📚 Learning: 2025-11-24T18:04:57.309Z</summary>Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Ensure the type implementing Diagnostic derives Debug**Applied to files:** - `crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql` </details> </details> </details> <details> <summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)</summary> * GitHub Check: Bench (biome_configuration) * GitHub Check: Bench (biome_graphql_parser) * GitHub Check: Check JS Files * GitHub Check: Bench (biome_graphql_formatter) * GitHub Check: Test Node.js API * GitHub Check: autofix * GitHub Check: Test (depot-windows-2022-16) * GitHub Check: Test (depot-ubuntu-24.04-arm-16) * GitHub Check: Lint project (depot-ubuntu-24.04-arm-16) * GitHub Check: Check Dependencies * GitHub Check: Lint project (depot-windows-2022) * GitHub Check: Documentation * GitHub Check: End-to-end tests </details> <details> <summary>🔇 Additional comments (5)</summary><blockquote> <details> <summary>crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql (1)</summary><blockquote> `1-7`: **Test fixture looks correct.** This properly tests the invalid case where an anonymous query coexists with a named mutation. The rule should trigger diagnostics for this scenario. </blockquote></details> <details> <summary>crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphql (1)</summary><blockquote> `1-4`: **Test fixture looks correct.** Properly validates that a single anonymous operation should not trigger diagnostics. </blockquote></details> <details> <summary>crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql (1)</summary><blockquote> `1-7`: **Test fixture looks correct.** Properly validates that fragments don't count as operations for the rule—an anonymous query with fragment definitions should not trigger diagnostics. </blockquote></details> <details> <summary>crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql (1)</summary><blockquote> `1-7`: **Test fixture looks correct.** Properly tests the invalid case where an anonymous query coexists with a named subscription. The rule should trigger diagnostics for this scenario. </blockquote></details> <details> <summary>crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql (1)</summary><blockquote> `1-4`: **Test fixture looks correct.** Properly validates that a document with only fragments (no operations) should not trigger diagnostics. </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
...raphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (1)
62-91: Consider simplifying by avoiding the intermediate cast.The pattern of matching
AnyGraphqlDefinition, casting toAnyGraphqlOperationDefinition, then matching again is a bit convoluted. You could extract the range and name check directly in the first match, avoiding the.syntax().clone().cast()dance entirely.🔎 Proposed simplification
for def in node.definitions() { - let operation = match def { - AnyGraphqlDefinition::GraphqlOperationDefinition(operation_definition) => { - operation_definition - .syntax() - .clone() - .cast::<AnyGraphqlOperationDefinition>() - } - AnyGraphqlDefinition::GraphqlSelectionSet(selection_set) => selection_set - .syntax() - .clone() - .cast::<AnyGraphqlOperationDefinition>(), + let unnamed_range = match def { + AnyGraphqlDefinition::GraphqlOperationDefinition(op) => { + operation_count += 1; + op.name().is_none().then(|| op.range()) + } + AnyGraphqlDefinition::GraphqlSelectionSet(sel) => { + operation_count += 1; + Some(sel.range()) + } _ => continue, }; - let Some(operation) = operation else { - continue; - }; - - operation_count += 1; - - match operation { - AnyGraphqlOperationDefinition::GraphqlOperationDefinition(operation_definition) => { - if operation_definition.name().is_none() { - unnamed_operations.push(operation_definition.range()); - } - } - AnyGraphqlOperationDefinition::GraphqlSelectionSet(selection_set) => { - unnamed_operations.push(selection_set.range()); - } + if let Some(range) = unnamed_range { + unnamed_operations.push(range); } }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
🧠 Learnings (15)
📓 Common learnings
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Rule names should use the `use` prefix when the rule's sole intention is to mandate a single concept
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Invalid code snippets in rule documentation must emit exactly one diagnostic
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use `declare_lint_rule!` macro with a `version` field set to `next` for new rules
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : The first paragraph of rule documentation must be written in a single line to ensure proper rendering in the rules overview table
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Deprecated rules must include a `deprecated` field in the `declare_lint_rule!` macro with an explanation of what rule to use instead
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Rule names should use the `no` prefix when the rule's sole intention is to forbid a single concept
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement custom `Queryable` and `Visitor` types for rules that require deep inspection of child nodes to avoid inefficient traversals
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement the `action` function and add `fix_kind` metadata to the rule macro if the rule provides code actions
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use the `Semantic<T>` query type to access semantic information about bindings, references, and scope within a rule
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use `declare_node_union!` macro to query multiple node types together to avoid redundant traversal passes
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Code blocks in rule documentation must specify a language identifier and be tagged with `expect_diagnostic` for invalid examples or remain untagged for valid examples
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement the `run` function to return `Option<Self::State>` or `Vec<Self::State>` (as `Box<[Self::State]>`) depending on whether the rule reports one or multiple signals
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-22T09:26:56.943Z
Learnt from: ematipico
Repo: biomejs/biome PR: 8537
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:167-210
Timestamp: 2025-12-22T09:26:56.943Z
Learning: When defining lint rules (declare_lint_rule!), only specify fix_kind if the rule implements an action(...) function. Rules that only emit diagnostics without a code fix should omit fix_kind. This applies to all Rust lint rule definitions under crates/.../src/lint (e.g., crates/biome_js_analyze/src/lint/...).
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-31T15:35:32.899Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8639
File: crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs:101-108
Timestamp: 2025-12-31T15:35:32.899Z
Learning: In Rust lint rules under the nursery category, the issue_number field in declare_lint_rule! is optional and should not be added unless there is a compelling reason. In code reviews, verify that no unnecessary issue_number is included in nursery lint declarations. Only add issue_number if there is an explicit, justified reason (e.g., tracked issue for external observers). This guidance broadly applies to all nursery lint rule files, not just the single file.
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
🧬 Code graph analysis (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (2)
crates/biome_service/src/workspace.rs (1)
markup(1195-1197)crates/biome_analyze/src/rule.rs (3)
recommended(619-622)sources(634-637)same(252-257)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: End-to-end tests
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Documentation
- GitHub Check: Check Dependencies
- GitHub Check: Check JS Files
- GitHub Check: autofix
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Test Node.js API
🔇 Additional comments (2)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (2)
9-47: LGTM!Rule declaration follows Biome conventions nicely:
version: "next", properuseprefix, correctly sourced from ESLint GraphQL, and documentation format is spot on.
97-121: LGTM!Diagnostic construction is solid — primary location from
state.first()?with secondary details for additional anonymous operations, plus a helpful explanatory note.
ffe9c8f to
ab175a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (1)
53-53: Consider whether Options type is needed.The
UseLoneAnonymousOperationOptionstype is declared but never accessed in therunfunction. If this is a placeholder for future configuration, consider adding a comment to clarify intent. Otherwise, you could use()as the Options type.🔎 Verification script
#!/bin/bash # Check if UseLoneAnonymousOperationOptions has any fields or configuration cat crates/biome_rule_options/src/use_lone_anonymous_operation.rsAlso applies to: 55-95
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (7)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql
✅ Files skipped from review due to trivial changes (1)
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql
🚧 Files skipped from review as they are similar to previous changes (5)
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
🧠 Learnings (14)
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Rule names should use the `use` prefix when the rule's sole intention is to mandate a single concept
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Invalid code snippets in rule documentation must emit exactly one diagnostic
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use `declare_lint_rule!` macro with a `version` field set to `next` for new rules
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : The first paragraph of rule documentation must be written in a single line to ensure proper rendering in the rules overview table
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Rule names should use the `no` prefix when the rule's sole intention is to forbid a single concept
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Deprecated rules must include a `deprecated` field in the `declare_lint_rule!` macro with an explanation of what rule to use instead
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement the `action` function and add `fix_kind` metadata to the rule macro if the rule provides code actions
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement custom `Queryable` and `Visitor` types for rules that require deep inspection of child nodes to avoid inefficient traversals
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use the `Semantic<T>` query type to access semantic information about bindings, references, and scope within a rule
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use `declare_node_union!` macro to query multiple node types together to avoid redundant traversal passes
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Code blocks in rule documentation must specify a language identifier and be tagged with `expect_diagnostic` for invalid examples or remain untagged for valid examples
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement the `run` function to return `Option<Self::State>` or `Vec<Self::State>` (as `Box<[Self::State]>`) depending on whether the rule reports one or multiple signals
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-22T09:26:56.943Z
Learnt from: ematipico
Repo: biomejs/biome PR: 8537
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:167-210
Timestamp: 2025-12-22T09:26:56.943Z
Learning: When defining lint rules (declare_lint_rule!), only specify fix_kind if the rule implements an action(...) function. Rules that only emit diagnostics without a code fix should omit fix_kind. This applies to all Rust lint rule definitions under crates/.../src/lint (e.g., crates/biome_js_analyze/src/lint/...).
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-31T15:35:32.899Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8639
File: crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs:101-108
Timestamp: 2025-12-31T15:35:32.899Z
Learning: In Rust lint rules under the nursery category, the issue_number field in declare_lint_rule! is optional and should not be added unless there is a compelling reason. In code reviews, verify that no unnecessary issue_number is included in nursery lint declarations. Only add issue_number if there is an explicit, justified reason (e.g., tracked issue for external observers). This guidance broadly applies to all nursery lint rule files, not just the single file.
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
🧬 Code graph analysis (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (2)
crates/biome_service/src/workspace.rs (1)
markup(1195-1197)crates/biome_analyze/src/rule.rs (3)
recommended(619-622)sources(634-637)same(252-257)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Check Dependencies
- GitHub Check: Documentation
- GitHub Check: End-to-end tests
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Test Node.js API
- GitHub Check: Check JS Files
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: autofix
- GitHub Check: Bench (biome_configuration)
🔇 Additional comments (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (1)
9-47: LGTM! Well-structured rule declaration.The rule declaration follows all guidelines: proper
version: "next", correctuseprefix (mandating anonymous operations only when alone), appropriate source attribution, and well-formatted documentation with correctly tagged examples.
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (1)
97-121: Clear and helpful diagnostic.The diagnostic accurately describes the issue and provides actionable guidance. The message works well whether there's one or multiple anonymous operations, and the detail/note structure effectively communicates the problem.
💡 Optional: Minor wording refinement
For slightly more concise phrasing, consider:
markup! { - "Document contains an anonymous operation while defining more than one operation. This anonymous operation must be the only defined operation in this document or turned into a named operation." + "Document contains an anonymous operation while defining more than one operation. This anonymous operation must be the only defined operation in this document or given a name." },"Given a name" is marginally more direct than "turned into a named operation", but the current wording is perfectly clear.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
🧠 Learnings (15)
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Invalid code snippets in rule documentation must emit exactly one diagnostic
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Rule names should use the `use` prefix when the rule's sole intention is to mandate a single concept
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use `declare_lint_rule!` macro with a `version` field set to `next` for new rules
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Rule names should use the `no` prefix when the rule's sole intention is to forbid a single concept
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : The first paragraph of rule documentation must be written in a single line to ensure proper rendering in the rules overview table
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement the `action` function and add `fix_kind` metadata to the rule macro if the rule provides code actions
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement custom `Queryable` and `Visitor` types for rules that require deep inspection of child nodes to avoid inefficient traversals
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Deprecated rules must include a `deprecated` field in the `declare_lint_rule!` macro with an explanation of what rule to use instead
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use the `Semantic<T>` query type to access semantic information about bindings, references, and scope within a rule
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-31T15:35:32.899Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8639
File: crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs:101-108
Timestamp: 2025-12-31T15:35:32.899Z
Learning: In Rust lint rules under the nursery category, the issue_number field in declare_lint_rule! is optional and should not be added unless there is a compelling reason. In code reviews, verify that no unnecessary issue_number is included in nursery lint declarations. Only add issue_number if there is an explicit, justified reason (e.g., tracked issue for external observers). This guidance broadly applies to all nursery lint rule files, not just the single file.
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Code blocks in rule documentation must specify a language identifier and be tagged with `expect_diagnostic` for invalid examples or remain untagged for valid examples
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-22T09:26:56.943Z
Learnt from: ematipico
Repo: biomejs/biome PR: 8537
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:167-210
Timestamp: 2025-12-22T09:26:56.943Z
Learning: When defining lint rules (declare_lint_rule!), only specify fix_kind if the rule implements an action(...) function. Rules that only emit diagnostics without a code fix should omit fix_kind. This applies to all Rust lint rule definitions under crates/.../src/lint (e.g., crates/biome_js_analyze/src/lint/...).
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement the `diagnostic` function to provide error messages explaining what the error is, why it is triggered, and what the user should do
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement the `run` function to return `Option<Self::State>` or `Vec<Self::State>` (as `Box<[Self::State]>`) depending on whether the rule reports one or multiple signals
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Check if a variable is global using the semantic model before reporting diagnostics for rules that ban global functions or variables
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
🧬 Code graph analysis (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (1)
crates/biome_analyze/src/rule.rs (3)
recommended(619-622)sources(634-637)same(252-257)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test Node.js API
- GitHub Check: Check Dependencies
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Documentation
- GitHub Check: End-to-end tests
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Validate rules documentation
- GitHub Check: autofix
- GitHub Check: Check JS Files
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_graphql_formatter)
🔇 Additional comments (3)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (3)
1-8: LGTM!Imports are clean and appropriate for the rule implementation.
9-47: Excellent rule declaration.Follows all conventions: proper documentation structure, correct metadata (
version: "next", appropriaterecommended: falsefor nursery), correct source attribution, and well-tagged examples. The rule name appropriately uses theuseprefix per guidelines.Based on learnings, the metadata is correctly configured.
55-95: Well-implemented logic.The rule correctly identifies anonymous operations when multiple operations are present. The single for-loop approach efficiently processes definitions without redundant iterations, and the final condition (
operation_count > 1 && !unnamed_operations.is_empty()) accurately captures the rule's intent.
865c879 to
83b95ec
Compare
Summary
Port Eslint Graphql's
lone-anonymous-operationwhich disallows anonymous queries when more than 1 operation has been definedTest Plan
Added unit tests covering all scenarios
Docs
https://the-guild.dev/graphql/eslint/rules/lone-anonymous-operation