-
-
Notifications
You must be signed in to change notification settings - Fork 792
feat(graphql_analyze): implement useLoneAnonymousOperation #8616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: e737d50 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis PR introduces a new GraphQL linter rule, Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (2)
9-47: Consider addingissue_numberfield.Per coding guidelines, work-in-progress rules in the nursery group should include an
issue_numberfield in thedeclare_lint_rule!macro to track the associated issue. Based on learnings, addissue_numberfield todeclare_lint_rule!macro for work-in-progress rules.Suggested addition
pub UseLoneAnonymousOperation { version: "next", name: "useLoneAnonymousOperation", language: "graphql", recommended: false, + issue_number: 8616, sources: &[RuleSource::EslintGraphql("lone-anonymous-operation").same()], }Additionally, consider adding a valid example showing a single anonymous operation (which is allowed) to better illustrate when the rule doesn't trigger:
query { fieldA }
103-131: Consider clarifying the diagnostic message.The message "Document contains (multiple) anonymous operations" with "(multiple)" in parentheses is slightly ambiguous when only one anonymous operation exists alongside named operations. Consider:
- "Document contains anonymous operation(s) alongside other operations"
- Conditionally pluralising based on
state.len()However, the detail message on line 117 and the notes are clear and helpful, so this is a minor wording suggestion.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (15)
crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_graphql_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (14)
.changeset/eleven-parents-divide.mdcrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphqlcrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
🧠 Learnings (43)
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Wrap rule options fields in `Option<>` to properly track set and unset options during merge
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be placed inside the `biome_rule_options` crate
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `deny_unknown_fields` in serde derive macro for rule options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `rename_all = "camelCase"` in serde derive macro for rule options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation must include `## Options` section if the rule has options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `version` field to `next` in `declare_lint_rule!` macro
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use generic rule names if the rule could potentially be implemented for multiple languages
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Implement `Merge` trait for rule options to support configuration inheritance
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `options` code block property for rule-specific configuration snippets in documentation
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use language-specific rule names if the rule is meant for a specific language only
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Add `issue_number` field to `declare_lint_rule!` macro for work-in-progress rules
Applied to files:
.changeset/eleven-parents-divide.mdcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Place new rules inside the `nursery` group during development
Applied to files:
.changeset/eleven-parents-divide.mdcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For new nursery rules, send PRs to the maintenance branch `main`
Applied to files:
.changeset/eleven-parents-divide.md
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : The first paragraph of rule documentation must be a single line describing what the rule does
Applied to files:
.changeset/eleven-parents-divide.mdcrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*invalid* : Create test files prefixed with `invalid` for code that should trigger the rule
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*valid* : Create test files prefixed with `valid` for code that should not trigger the rule
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Valid code examples in rule documentation should not trigger any diagnostics
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Each invalid code example in rule documentation must emit exactly one diagnostic
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphqlcrates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `Ast<>` query type to query AST/CST for nodes of a specific type
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Invalid code examples in rule documentation must be marked with `expect_diagnostic` code block property
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Prefix line with `#` in documentation code examples sparingly; prefer concise complete snippets
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_node_union!` macro to query multiple node types at once
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Check if a variable is global using the semantic model to avoid false positives
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options struct must derive `Deserializable`, `Serialize`, `Deserialize`, and optionally `JsonSchema`
Applied to files:
crates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `use_options` code block property for code examples that follow an options configuration in documentation
Applied to files:
crates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.
Applied to files:
crates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `full_options` code block property for complete biome.json configuration snippets in documentation
Applied to files:
crates/biome_rule_options/src/use_lone_anonymous_operation.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/spec_tests.rs : Use the `tests_macros::gen_tests!` macro in `spec_tests.rs` to generate test functions for each specification file matching the pattern `tests/specs/<language>/**/*.<ext>`
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_lint_rule!` macro to declare analyzer rule types and implement the RuleMeta trait
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should perform static analysis of source code to detect invalid or error-prone patterns and emit diagnostics with proposed fixes
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-22T09:26:56.943Z
Learnt from: ematipico
Repo: biomejs/biome PR: 8537
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:167-210
Timestamp: 2025-12-22T09:26:56.943Z
Learning: When defining lint rules (declare_lint_rule!), only specify fix_kind if the rule implements an action(...) function. Rules that only emit diagnostics without a code fix should omit fix_kind. This applies to all Rust lint rule definitions under crates/.../src/lint (e.g., crates/biome_js_analyze/src/lint/...).
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Implement `action` function in Rule trait to provide code actions
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Specify `fix_kind: FixKind::Safe` in `declare_lint_rule!` for safe code actions
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation code blocks should be ordered as language, expect_diagnostic, options/full_options/use_options, ignore, file
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).same()` when implementing a rule that matches the behavior of an ESLint rule
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should check syntax according to language specification and emit error diagnostics
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Lines prefixed with `#` in rule documentation code examples will be hidden from output
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `ignore` code block property to exclude documentation code examples from automatic validation
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use #[derive(Diagnostic)] on enums when every variant contains a type that is itself a diagnostic
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Fields with #[advice] or #[verbose_advice] attributes must implement the Advices trait to record advices on the diagnostic
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Implement the Diagnostic trait on types, or use the #[derive(Diagnostic)] procedural macro to implement the trait. Configure category, severity, description, message, location, and tags using the #[diagnostic] attribute
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Ensure the type implementing Diagnostic derives Debug
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql
🧬 Code graph analysis (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (3)
crates/biome_service/src/workspace.rs (1)
markup(1187-1189)crates/biome_analyze/src/rule.rs (4)
recommended(619-622)sources(634-637)same(252-257)span(1499-1501)crates/biome_service/src/workspace_types.rs (1)
Self(748-748)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Check JS Files
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Test Node.js API
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Documentation
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: End-to-end tests
- GitHub Check: autofix
🔇 Additional comments (14)
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-shorthand.graphql (1)
1-7: LGTM!Test case correctly exercises the rule with two shorthand anonymous operations. The GraphQL syntax is valid, and the diagnostic comment is appropriate.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-named-query.graphql (1)
1-7: LGTM!Test case correctly exercises the rule with an anonymous operation alongside a named query. This validates the rule's detection of anonymous operations when other named operations are present.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-mutation.graphql (1)
1-7: LGTM!Test case correctly exercises the rule with an anonymous query alongside a named mutation. This ensures the rule detects anonymous operations when mixed with different operation types.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/one-shorthand-one-anonymous.graphql (1)
1-7: LGTM!Test case correctly exercises the rule with both shorthand and explicit anonymous operations. This ensures the rule detects multiple anonymous operations regardless of their syntax form.
.changeset/eleven-parents-divide.md (1)
1-17: LGTM!Changeset correctly documents the new nursery rule with a clear description and appropriate invalid example. The documentation follows the standard format.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/one-anonymous.graphql (1)
1-4: LGTM!Test case correctly validates that a single anonymous operation should not trigger diagnostics. This is the core valid scenario for the rule.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/with-type.graphql (1)
1-7: LGTM!Test case correctly validates that an anonymous operation with fragment definitions should not trigger diagnostics. Fragments are not operations, so this is appropriately classified as valid.
crates/biome_rule_options/src/lib.rs (1)
342-342: LGTM!Module export correctly placed in alphabetical order. The addition follows codebase conventions perfectly.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/multi-named.graphql (1)
1-7: LGTM!Test correctly validates that multiple named operations should not trigger the rule.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/with-subscription.graphql (1)
1-7: LGTM!Test correctly validates that an anonymous operation alongside a named subscription should trigger diagnostics.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/valid/no-operations.graphql (1)
1-4: LGTM!Test correctly validates that documents with no operations (fragments only) should not trigger the rule.
crates/biome_rule_options/src/use_lone_anonymous_operation.rs (1)
1-6: LGTM!The options struct follows all required patterns and conventions for rule options, even though no options are currently needed.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneAnonymousOperation/invalid/multi-anonymous.graphql (1)
1-7: LGTM!Test correctly validates that multiple anonymous operations should trigger diagnostics.
crates/biome_graphql_analyze/src/lint/nursery/use_lone_anonymous_operation.rs (1)
55-101: LGTM!The
run()implementation correctly identifies anonymous operations by checking for both unnamedGraphqlOperationDefinitionnodes andGraphqlSelectionSetnodes (which represent shorthand syntax). The early returns appropriately optimise for common cases.
CodSpeed Performance ReportMerging #8616 will not alter performanceComparing Summary
Footnotes
|
Summary
Port Eslint Graphql's
lone-anonymous-operationTest Plan
Docs