Skip to content

Conversation

@Netail
Copy link
Member

@Netail Netail commented Dec 29, 2025

Summary

Port Eslint Graphql's lone-anonymous-operation

Test Plan

Docs

@changeset-bot
Copy link

changeset-bot bot commented Dec 29, 2025

🦋 Changeset detected

Latest commit: e737d50

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

This PR introduces a new GraphQL linter rule, useLoneAnonymousOperation, which detects and reports anonymous operations when multiple operations are present in a single document. The implementation includes the rule logic, options configuration, and comprehensive test coverage across both valid scenarios (single operations, multiple named operations, fragments-only documents) and invalid scenarios (multiple anonymous operations, mixed with named/mutation/subscription operations).

Possibly related PRs

Suggested labels

A-Project, A-Linter, A-Diagnostic

Suggested reviewers

  • dyc3
  • ematipico

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the primary change: implementing a new GraphQL linting rule called useLoneAnonymousOperation.
Description check ✅ Passed The description clearly relates to the changeset, providing context about porting ESLint GraphQL's lone-anonymous-operation rule.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 #8616 will not alter performance

Comparing Netail:feat/use-lone-anonymous-operation (e737d50) with main (cc3e851)

Summary

✅ 9 untouched
⏩ 146 skipped1

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.

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.

1 participant