Skip to content

Conversation

@Netail
Copy link
Member

@Netail Netail commented Dec 29, 2025

Summary

Port Eslint Graphql's lone-anonymous-operation which disallows anonymous queries when more than 1 operation has been defined

Test Plan

Added unit tests covering all scenarios

Docs

https://the-guild.dev/graphql/eslint/rules/lone-anonymous-operation

@changeset-bot
Copy link

changeset-bot bot commented Dec 29, 2025

🦋 Changeset detected

Latest commit: 83b95ec

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

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

@github-actions github-actions bot added A-Project Area: project A-Linter Area: linter A-Diagnostic Area: diagnostocis labels Dec 29, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 29, 2025

Walkthrough

Adds a new GraphQL nursery lint rule useLoneAnonymousOperation that detects anonymous operations when a document contains more than one operation. Implements the rule, diagnostics (document-level and per-range notes), and a public Rule impl. Introduces UseLoneAnonymousOperationOptions and exports its module from crates/biome_rule_options. Adds a patch changeset entry and test fixtures covering invalid scenarios (multiple anonymous, shorthand+anonymous, mixed operation types) and valid scenarios (single anonymous, multiple named, fragment-only).

Suggested reviewers

  • ematipico
  • dyc3
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: implementing a new GraphQL lint rule called useLoneAnonymousOperation.
Description check ✅ Passed The description is directly related to the changeset, clearly explaining the rule being ported and referencing the original ESLint documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 865c879 and 83b95ec.

⛔ Files ignored due to path filters (15)
  • 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 **
📒 Files selected for processing (14)
  • .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
🚧 Files skipped from review as they are similar to previous changes (7)
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
  • .changeset/eleven-parents-divide.md
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql
  • crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-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 the dbg!() 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.rs
  • crates/biome_rule_options/src/use_lone_anonymous_operation.rs
🧠 Learnings (18)
📓 Common learnings
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, the `issue_number` field in `declare_lint_rule!` macro is optional and the vast majority of nursery rules do not need it. Do not recommend adding `issue_number` unless there's a specific reason.
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 the `nursery` group before promotion to other groups
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
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
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
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
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
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
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
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:27:13.161Z
Learning: In crates/biome_analyze/**/*analyze/src/**/*.rs, the `fix_kind` field in `declare_lint_rule!` should only be specified when the rule implements the `action` function. Rules that only emit diagnostics without providing code fixes should not include `fix_kind` in their metadata.
📚 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/biome_rule_options/lib/**/*.rs : Use `Option<_>` wrapper for rule option fields to enable proper merging of configurations

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/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/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate with a file named after the rule

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/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_rule_options/src/lib.rs
  • crates/biome_rule_options/src/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/biome_rule_options/lib/**/*.rs : Apply `#[serde(rename_all = "camelCase")]` to rule option structs to match JSON configuration naming convention

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/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/biome_rule_options/lib/**/*.rs : Implement `biome_deserialize::Merge` for rule option types to define how shared and user configurations are merged

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/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/biome_rule_options/lib/**/*.rs : Apply `#[serde(deny_unknown_fields)]` to rule option structs to enforce strict configuration validation

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/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/biome_rule_options/lib/**/*.rs : Use `Box<[Box<str>]>` instead of `Vec<String>` for collections of strings in rule options to save memory

Applied to files:

  • crates/biome_rule_options/src/lib.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_rule_options/src/lib.rs
📚 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 : No module may copy or clone data from another module in the module graph, not even behind an `Arc`

Applied to files:

  • crates/biome_rule_options/src/lib.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/biome_rule_options/lib/**/*.rs : Rule option types must derive `Deserializable`, `Serialize`, `Deserialize`, and optionally `JsonSchema` traits

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/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/**/tests/specs/**/* : Create test files with `invalid` and `valid` prefixes to represent code that should and should not trigger the rule

Applied to files:

  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.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
📚 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/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql
📚 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/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql
📚 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-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_rule_options/src/use_lone_anonymous_operation.rs
📚 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 : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented

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-named-query.graphql
⏰ 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: Test Node.js API
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check JS Files
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Check Dependencies
  • GitHub Check: Documentation
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Validate rules documentation
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: autofix
🔇 Additional comments (7)
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql (1)

1-4: Good “fragment-only” valid coverage. Matches the rule’s intent (no operations ⇒ nothing to complain about).

crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql (1)

1-7: Solid invalid case: anonymous query + named mutation. This should reliably trip the rule.

crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql (1)

1-7: Nice minimal invalid repro. Anonymous op plus another op (named) is exactly the edge this rule guards.

crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql (1)

1-7: Good mixed-type invalid case (query + subscription). Keeps the rule honest across operation kinds.

crates/biome_rule_options/src/lib.rs (1)

351-355: No action required—the codegen automatically owns this export.

The generate_rule_options() function in xtask/codegen/src/generate_configuration.rs auto-discovers all rules by visiting the analyzer registries. Since use_lone_anonymous_operation is properly registered in biome_graphql_analyze, the module export will be correctly regenerated in lib.rs on the next codegen run. No explicit xtask config is needed.

Likely an incorrect or invalid review comment.

crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql (1)

1-7: LGTM! Valid test fixture for multiple anonymous operations.

The fixture appropriately tests the invalid case where two anonymous query operations exist in a single document, which should trigger diagnostics from the useLoneAnonymousOperation rule.

crates/biome_rule_options/src/use_lone_anonymous_operation.rs (1)

1-6: LGTM! Options struct follows all established patterns.

The implementation correctly includes all required derives (Deserializable, Merge, Serialize, Deserialize) and serde attributes (camelCase, deny_unknown_fields, default). The empty struct is standard practice for rules without configurable options.

Based on learnings, this follows the expected pattern for rule options in the biome_rule_options crate.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 adding issue_number field.

Per coding guidelines, work-in-progress rules in the nursery group should include an issue_number field in the declare_lint_rule! macro to track the associated issue. Based on learnings, add issue_number field to declare_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

📥 Commits

Reviewing files that changed from the base of the PR and between cc3e851 and e737d50.

⛔ Files ignored due to path filters (15)
  • 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 **
📒 Files selected for processing (14)
  • .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
🧰 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 the dbg!() 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.rs
  • crates/biome_rule_options/src/use_lone_anonymous_operation.rs
  • crates/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.rs
  • 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/**/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.rs
  • 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/**/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.rs
  • 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 : Rule documentation must include `## Options` section if the rule has options

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_lone_anonymous_operation.rs
  • 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 : 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.rs
  • 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/**/biome_rule_options/lib/**/*.rs : Implement `Merge` trait for rule options to support configuration inheritance

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • 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 `options` code block property for rule-specific configuration snippets in documentation

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • 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 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.md
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql
  • 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/nursery/**/*.rs : Place new rules inside the `nursery` group during development

Applied to files:

  • .changeset/eleven-parents-divide.md
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql
  • crates/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.md
  • crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
  • 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/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.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.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/valid/no-operations.graphql
  • crates/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.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.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/no-operations.graphql
  • crates/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.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.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/invalid/multi-anonymous.graphql
  • 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 : 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.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.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
  • crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
  • crates/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.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql
  • 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 : 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.graphql
  • crates/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.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql
  • 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 `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.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql
  • crates/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 unnamed GraphqlOperationDefinition nodes and GraphqlSelectionSet nodes (which represent shorthand syntax). The early returns appropriately optimise for common cases.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 29, 2025

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing Netail:feat/use-lone-anonymous-operation (83b95ec) with main (251b47b)

Summary

✅ 9 untouched benchmarks
⏩ 146 skipped benchmarks1

Footnotes

  1. 146 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Member

@ematipico ematipico left a 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

Comment on lines 21 to 43
i Document contains (multiple) anonymous operations.
1 │ # should generate diagnostics
> 2 │ query {
^^^^^^^
> 3fieldA
> 4}
> 5 │ query {
> 6fieldB
> 7}
│ ^
8 │
i This anonymous operation must be the only defined operation in this document.
1 │ # should generate diagnostics
> 2 │ query {
^^^^^^^
> 3fieldA
> 4}
│ ^
5 │ query {
6fieldB
Copy link
Member

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?

Copy link
Member Author

@Netail Netail Jan 3, 2026

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.

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Reworked :)

@Netail Netail force-pushed the feat/use-lone-anonymous-operation branch from e737d50 to 4feea33 Compare January 3, 2026 17:47
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 : Use declare_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 with invalid and valid prefixes 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 the nursery group 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 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`

</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, the issue_number field in declare_lint_rule! macro is optional and the vast majority of nursery rules do not need it. Do not recommend adding issue_number unless 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 branch main


**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 -->

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 to AnyGraphqlOperationDefinition, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4feea33 and ffe9c8f.

⛔ Files ignored due to path filters (6)
  • 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 **
📒 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 the dbg!() 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", proper use prefix, 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.

@Netail Netail force-pushed the feat/use-lone-anonymous-operation branch from ffe9c8f to ab175a2 Compare January 3, 2026 18:24
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 UseLoneAnonymousOperationOptions type is declared but never accessed in the run function. 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.rs

Also applies to: 55-95

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ffe9c8f and ab175a2.

⛔ Files ignored due to path filters (6)
  • 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 **
📒 Files selected for processing (7)
  • 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
✅ 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 the dbg!() 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", correct use prefix (mandating anonymous operations only when alone), appropriate source attribution, and well-formatted documentation with correctly tagged examples.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between ab175a2 and 0755743.

⛔ Files ignored due to path filters (6)
  • 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 **
📒 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 the dbg!() 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", appropriate recommended: false for nursery), correct source attribution, and well-tagged examples. The rule name appropriately uses the use prefix 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.

@Netail Netail requested a review from ematipico January 7, 2026 23:52
@Netail Netail force-pushed the feat/use-lone-anonymous-operation branch from 865c879 to 83b95ec Compare January 9, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Diagnostic Area: diagnostocis A-Linter Area: linter A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants