feat(graphql_analyze): implement useLoneExecutableDefinition#8617
Conversation
🦋 Changeset detectedLatest commit: 7ce58ec 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 |
4966d0d to
7333327
Compare
CodSpeed Performance ReportMerging #8617 will not alter performanceComparing Summary
Footnotes
|
7333327 to
de4a247
Compare
WalkthroughThis pull request introduces the Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.rs📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
🧠 Learnings (11)📓 Common learnings📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-11-24T18:05:42.356ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-11-24T18:06:03.545ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
🔇 Additional comments (2)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
.changeset/lazy-doodles-attack.md (1)
5-17: Consider adding a valid example to the changeset.The changeset shows what's now invalid, but adding a brief valid example (e.g., "each definition in its own file") would clarify the expected behaviour for users.
Based on learnings, changesets should demonstrate both invalid and valid patterns.
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs (1)
86-92: Consider simplifying diagnostic message.The message "Document contains (multiple) definitions." could be clearer as "This document contains multiple definitions."
🔎 Suggested simplification
let mut diagnostic = RuleDiagnostic::new( rule_category!(), span, markup! { - "Document contains (multiple) definitions." + "This document contains multiple definitions." }, );
📜 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/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation 3.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.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 (16)
.changeset/lazy-doodles-attack.mdcrates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation 3.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.graphqlcrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_executable_definition.rsjustfile
🧰 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_executable_definition.rscrates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs
🧠 Learnings (42)
📚 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 : 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_executable_definition.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_executable_definition.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/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes
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 : 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_executable_definition.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_executable_definition.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_executable_definition.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 `Box<[T]>` instead of `Vec<T>` for rule options arrays to save memory
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 : 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_executable_definition.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 `language` field in `declare_lint_rule!` macro to the language the rule primarily applies to
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/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/useLoneExecutableDefinition/valid/single-anonymous-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation 3.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.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/useLoneExecutableDefinition/invalid/multi-named-query.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/useLoneExecutableDefinition/invalid/multi-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation 3.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.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/useLoneExecutableDefinition/invalid/multi-named-query.graphqlcrates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.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 : Implement Queryable trait for custom query match types in analyzer rules
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphql
📚 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/useLoneExecutableDefinition/invalid/multi-named-query.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_executable_definition.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_executable_definition.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_executable_definition.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_executable_definition.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 `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_executable_definition.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_executable_definition.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_executable_definition.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 : The first paragraph of rule documentation must be a single line describing what the rule does
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs.changeset/lazy-doodles-attack.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/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_executable_definition.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_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_executable_definition.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 `domains` field in `declare_lint_rule!` to tag rules that belong to specific concepts like testing or frameworks
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_executable_definition.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(...).inspired()` when implementing a rule inspired by but with different behavior than an ESLint rule
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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 : Add `sources` field with `RuleSource` to cite ESLint or other rules that inspired the implementation
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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 : Valid code examples in rule documentation should not trigger any diagnostics
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.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/useLoneExecutableDefinition/invalid/multi-executables-definitions.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 : Rule documentation must include `## Examples` section with `### Invalid` and `### Valid` subsections
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.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 rule changes in changesets, clearly demonstrate what is now invalid that wasn't before, or vice versa
Applied to files:
.changeset/lazy-doodles-attack.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/lint/nursery/**/*.rs : Place new rules inside the `nursery` group during development
Applied to files:
.changeset/lazy-doodles-attack.md
📚 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/lazy-doodles-attack.md
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.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/useLoneExecutableDefinition/valid/single-shorthand-query.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/useLoneExecutableDefinition/valid/single-shorthand-query.graphql
🧬 Code graph analysis (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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)
🔇 Additional comments (12)
justfile (1)
10-10: LGTM – Windows PowerShell configuration.This setting ensures proper Windows compatibility for the justfile commands.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphql (1)
1-4: LGTM – Valid single subscription test case.Correctly tests that a lone named subscription does not trigger diagnostics.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql (1)
1-4: LGTM – Valid anonymous query test case.Correctly validates that a single anonymous query is permitted.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphql (1)
1-4: LGTM – Valid fragment test case.Correctly validates that a single fragment definition is permitted.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql (1)
1-4: LGTM – Valid anonymous subscription test case.Correctly validates that a single anonymous subscription is permitted.
crates/biome_rule_options/src/lib.rs (1)
342-342: LGTM – Module exposure for new rule options.Correctly exposes the
use_lone_executable_definitionoptions module in alphabetical order.crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphql (1)
1-4: LGTM!Valid test case for a single named query is correctly structured.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql (1)
1-26: LGTM!Comprehensive invalid test case covering multiple definition types (queries, mutations, subscriptions, fragments).
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql (1)
1-6: LGTM!Minimal invalid case with two definitions is appropriate.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.graphql (1)
1-4: LGTM!Valid shorthand query test case is correctly structured.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphql (1)
1-6: LGTM!Valid anonymous mutation test case is correctly structured.
crates/biome_rule_options/src/use_lone_executable_definition.rs (1)
1-6: LGTM!Options struct correctly follows all coding guidelines: appropriate derives, serde attributes, and Merge trait implementation.
As per coding guidelines, options structs must derive Deserializable, Serialize, Deserialize, Merge, and use deny_unknown_fields with camelCase.
de4a247 to
0a2abf1
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs (1)
40-46: Addissue_numberfield for nursery rule.Nursery rules should include an
issue_numberfield to track the associated GitHub issue.🔎 Suggested addition
pub UseLoneExecutableDefinition { version: "next", name: "useLoneExecutableDefinition", language: "graphql", recommended: false, + issue_number: <issue_number_here>, sources: &[RuleSource::EslintGraphql("lone-executable-definition").same()], }Based on learnings, work-in-progress rules should add
issue_numberfield todeclare_lint_rule!macro.
🧹 Nitpick comments (2)
crates/biome_rule_options/src/use_lone_executable_definition.rs (1)
3-6: Consider adding rustdoc for the options struct.Per coding guidelines, Rust types should have inline rustdoc documentation.
🔎 Suggested addition
+/// Options for the `useLoneExecutableDefinition` rule. #[derive(Default, Clone, Debug, Deserialize, Deserializable, Merge, Eq, PartialEq, Serialize)] #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields, default)] pub struct UseLoneExecutableDefinitionOptions {}crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs (1)
88-91: Consider clarifying the diagnostic message.The parenthetical "(multiple)" reads a bit awkwardly. A clearer message might be:
🔎 Suggested change
let mut diagnostic = RuleDiagnostic::new( rule_category!(), span, markup! { - "Document contains (multiple) definitions." + "Document contains multiple executable definitions." }, );
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (16)
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/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.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 (16)
.changeset/lazy-doodles-attack.mdcrates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.graphqlcrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_executable_definition.rsjustfile
✅ Files skipped from review due to trivial changes (1)
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql
🚧 Files skipped from review as they are similar to previous changes (9)
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphql
- justfile
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphql
- .changeset/lazy-doodles-attack.md
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphql
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_executable_definition.rscrates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs
🧠 Learnings (37)
📚 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 : 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_executable_definition.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_executable_definition.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/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes
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 : 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_executable_definition.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_executable_definition.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_executable_definition.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.rscrates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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 `language` field in `declare_lint_rule!` macro to the language the rule primarily applies to
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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 `Box<[T]>` instead of `Vec<T>` for rule options arrays to save memory
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 : Rule documentation must include `## Options` section if the rule has options
Applied to files:
crates/biome_rule_options/src/use_lone_executable_definition.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 struct must derive `Deserializable`, `Serialize`, `Deserialize`, and optionally `JsonSchema`
Applied to files:
crates/biome_rule_options/src/use_lone_executable_definition.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_executable_definition.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_executable_definition.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_executable_definition.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 `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_executable_definition.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:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_executable_definition.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_executable_definition.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 : The first paragraph of rule documentation must be a single line describing what the rule does
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_executable_definition.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 : Add `sources` field with `RuleSource` to cite ESLint or other rules that inspired the implementation
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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 `domains` field in `declare_lint_rule!` to tag rules that belong to specific concepts like testing or frameworks
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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 : Add `deprecated` field to `declare_lint_rule!` macro when deprecating a rule
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_executable_definition.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_executable_definition.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 : Each invalid code example in rule documentation must emit exactly one diagnostic
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.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 `RuleSource::Eslint(...).inspired()` when implementing a rule inspired by but with different behavior than an ESLint rule
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql
📚 Learning: 2025-12-22T09:27:13.161Z
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.
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.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/useLoneExecutableDefinition/invalid/multi-executables-definitions.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/useLoneExecutableDefinition/invalid/multi-executables-definitions.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/useLoneExecutableDefinition/invalid/multi-executables-definitions.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 : Rule documentation must include `## Examples` section with `### Invalid` and `### Valid` subsections
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql
🧬 Code graph analysis (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs (2)
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)
🔇 Additional comments (5)
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql (1)
1-6: LGTM!Valid test fixture for a single named mutation – correctly expects no diagnostics.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql (1)
1-4: LGTM!Valid test fixture for a single anonymous subscription.
crates/biome_rule_options/src/lib.rs (1)
342-342: LGTM!Module correctly placed in alphabetical order.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql (1)
1-26: LGTM!Comprehensive invalid test fixture covering all executable definition types – good coverage.
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs (1)
55-81: LGTM!The
runfunction correctly handles edge cases – checkingdefinitions.len() > 1before removing prevents the panic on empty documents.
0a2abf1 to
52b49ec
Compare
|
FYI, from now on, please fill out the PR template. We don't ask much. Even a one-liner is enough to us |
| /// Require queries, mutations, subscriptions or fragments to be located in separate files. | ||
| /// |
There was a problem hiding this comment.
Any chance of a longer description explaining why this rule exists?
There was a problem hiding this comment.
Updated the docs to be a bit clearer about the rule
| if definitions.len() > 1 { | ||
| definitions.remove(0); |
There was a problem hiding this comment.
You can use enumerate() and filter out the first item when the index is 0. Then here you check if len() is >=1
| Some( | ||
| diagnostic | ||
| .note(markup! { | ||
| "Require queries, mutations, subscriptions or fragments to be located in separate files. Separate definitions into separate files." |
There was a problem hiding this comment.
| "Require queries, mutations, subscriptions or fragments to be located in separate files. Separate definitions into separate files." | |
| "Queries, mutations, subscriptions or fragments must be defined and grouped in separate files." |
There was a problem hiding this comment.
Updated, left the "grouped" out, as it's only 1 operation or fragment per file instead of only the same type
| │ ^ | ||
| 9 │ | ||
|
|
||
| i Require queries, mutations, subscriptions or fragments to be located in separate files. Separate definitions into separate files. |
There was a problem hiding this comment.
Isn't this supposed be valid? If not, then the documentation of the rule is very misleading.
I understood that all definitions of the same kind must be grouped in the same file. And here we have only query definitions.
I suggest reword the docs to make this more explicit
There was a problem hiding this comment.
Woops, that's indeed a misunderstanding. Will improve the docs
52b49ec to
4c8941f
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs (1)
80-80: Simplify the length check.The
.iter()call is unnecessary here, and checking>= 1is less idiomatic than!is_empty().🔎 Suggested simplification
- if definitions.iter().len() >= 1 { + if !definitions.is_empty() { return Some(definitions); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (16)
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/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.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 (16)
.changeset/lazy-doodles-attack.mdcrates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rscrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphqlcrates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.graphqlcrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_lone_executable_definition.rsjustfile
🚧 Files skipped from review as they are similar to previous changes (9)
- justfile
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphql
- crates/biome_rule_options/src/lib.rs
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.graphql
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql
- .changeset/lazy-doodles-attack.md
- crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphql
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rscrates/biome_rule_options/src/use_lone_executable_definition.rs
🧠 Learnings (34)
📓 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.
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 : Use `declare_lint_rule!` macro with a `version` field set to `next` for new rules
📚 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/useLoneExecutableDefinition/valid/fragment.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/**/tests/specs/**/*.jsonc : Use `.jsonc` format for test files containing multiple code snippets, where each snippet is a string in an array
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.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_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_executable_definition.rscrates/biome_rule_options/src/use_lone_executable_definition.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_executable_definition.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_executable_definition.rscrates/biome_rule_options/src/use_lone_executable_definition.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_executable_definition.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_executable_definition.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_executable_definition.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_executable_definition.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_executable_definition.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_executable_definition.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 : New rules must be placed inside the `nursery` group before promotion to other groups
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_executable_definition.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 : Mark rules with `issue_number` in the `declare_lint_rule!` macro if they are work-in-progress to indicate missing features
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_executable_definition.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 `try operator (?)` to transform `Result` types into `Option` when the `run` function returns `Option`
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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: Rules should explain to users what the error is, why it is triggered, and what they should do to fix it
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_executable_definition.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_executable_definition.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 : When porting rules from other linters, use `sources` metadata with `RuleSource::Eslint().same()` for identical behavior or `.inspired()` for different behavior
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.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_executable_definition.rs
📚 Learning: 2025-12-31T15:35:41.261Z
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:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql
📚 Learning: 2025-12-22T09:27:13.161Z
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.
Applied to files:
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.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/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/use_lone_executable_definition.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/use_lone_executable_definition.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/use_lone_executable_definition.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_executable_definition.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/use_lone_executable_definition.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/use_lone_executable_definition.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/use_lone_executable_definition.rs
📚 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: Applies to **/*.rs : Use inline rustdoc documentation for rules, assists, and their options
Applied to files:
crates/biome_rule_options/src/use_lone_executable_definition.rs
🧬 Code graph analysis (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs (3)
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)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). (14)
- GitHub Check: Validate PR title
- GitHub Check: Check Dependencies
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: End-to-end tests
- GitHub Check: Documentation
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test Node.js API
- GitHub Check: autofix
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Check JS Files
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_graphql_formatter)
🔇 Additional comments (7)
crates/biome_rule_options/src/use_lone_executable_definition.rs (1)
1-6: LGTM! Options struct follows all required patterns.The struct correctly derives all necessary traits (Deserializable, Merge, Serialize, Deserialize, JsonSchema), applies the required serde attributes (camelCase, deny_unknown_fields, default), and follows the standard pattern for rule options. Empty structs are acceptable for rules without configuration options.
Based on learnings.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphql (1)
1-4: Valid test fixture looks correct.The single fragment definition aligns perfectly with the rule's intent—exactly one executable definition per document should not trigger diagnostics.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql (1)
1-4: Valid test fixture is correct.Single anonymous subscription appropriately validates that lone executable definitions should pass without diagnostics.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphql (1)
1-4: Valid test fixture is correct.Named subscription with a single executable definition properly validates the rule's expected behaviour.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql (1)
1-4: Valid test fixture is correct.Anonymous query with a single executable definition correctly represents a valid case that should pass the rule.
crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql (1)
1-6: Test fixture looks correct.This valid test case appropriately contains a single executable definition (named mutation), which should not trigger the lint rule.
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs (1)
87-108: Diagnostic implementation is sound.The diagnostic correctly highlights each extra executable definition with appropriate messages and provides helpful guidance in the note.
8905e34 to
e2e280c
Compare
3f2e78f to
4904838
Compare
Summary
Port Eslint Graphql's
lone-executable-definition, only allowing a single operation or fragment per document.Test Plan
Added unit tests covering all scenarios
Docs
https://the-guild.dev/graphql/eslint/rules/lone-executable-definition