Skip to content

feat(graphql_analyze): implement useLoneExecutableDefinition#8617

Merged
Netail merged 3 commits into
biomejs:mainfrom
Netail:feat/use-lone-executable-definition
Jan 4, 2026
Merged

feat(graphql_analyze): implement useLoneExecutableDefinition#8617
Netail merged 3 commits into
biomejs:mainfrom
Netail:feat/use-lone-executable-definition

Conversation

@Netail

@Netail Netail commented Dec 29, 2025

Copy link
Copy Markdown
Member

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

@changeset-bot

changeset-bot Bot commented Dec 29, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7ce58ec

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

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

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Netail Netail changed the title feat(graphql_analyze): implement useLoneAnonymousOperation feat(graphql_analyze): implement useLoneExecutableDefinition Dec 29, 2025
@github-actions github-actions Bot added A-Project Area: project A-Linter Area: linter A-Diagnostic Area: diagnostocis labels Dec 29, 2025
@Netail Netail force-pushed the feat/use-lone-executable-definition branch from 4966d0d to 7333327 Compare December 29, 2025 15:51
@codspeed-hq

codspeed-hq Bot commented Dec 29, 2025

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #8617 will not alter performance

Comparing Netail:feat/use-lone-executable-definition (7ce58ec) with main (f764007)1

Summary

✅ 9 untouched
⏩ 146 skipped2

Footnotes

  1. No successful run was found on main (499594b) during the generation of this report, so f764007 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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

@Netail Netail force-pushed the feat/use-lone-executable-definition branch from 7333327 to de4a247 Compare December 29, 2025 18:30
@Netail Netail marked this pull request as ready for review December 29, 2025 18:31
@coderabbitai

coderabbitai Bot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This pull request introduces the UseLoneExecutableDefinition nursery rule for GraphQL linting. The rule enforces that each GraphQL document contains at most one executable definition (query, mutation, subscription, or fragment). The implementation includes the core rule logic in the GraphQL analyser, an options struct for configuration, and a comprehensive test suite covering both valid scenarios (single operations of various types) and invalid ones (multiple definitions in a single document). A changeset file documents the addition.

Suggested reviewers

  • ematipico
  • Conaclos
  • dyc3

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly describes the main change: implementing the useLoneExecutableDefinition GraphQL lint rule.
Description check ✅ Passed The description is related to the changeset, explaining that it ports ESLint GraphQL's lone-executable-definition rule and mentions test coverage.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4904838 and 7ce58ec.

⛔ Files ignored due to path filters (5)
  • crates/biome_configuration/src/analyzer/linter/rules.rs is excluded by !**/rules.rs and included by **
  • crates/biome_diagnostics_categories/src/categories.rs is excluded by !**/categories.rs and included by **
  • crates/biome_graphql_analyze/src/lint/nursery.rs is excluded by !**/nursery.rs and included by **
  • packages/@biomejs/backend-jsonrpc/src/workspace.ts is excluded by !**/backend-jsonrpc/src/workspace.ts and included by **
  • packages/@biomejs/biome/configuration_schema.json is excluded by !**/configuration_schema.json and included by **
📒 Files selected for processing (1)
  • crates/biome_rule_options/src/lib.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use the dbg!() macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests

Files:

  • crates/biome_rule_options/src/lib.rs
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : The first paragraph of rule documentation must be written in a single line to ensure proper rendering in the rules overview table
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Rule names should use the `use` prefix when the rule's sole intention is to mandate a single concept
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate with a file named after the rule

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Use `Option<_>` wrapper for rule option fields to enable proper merging of configurations

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Rule names should use the `use` prefix when the rule's sole intention is to mandate a single concept

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 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: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use `declare_lint_rule!` macro with a `version` field set to `next` for new rules

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Implement `biome_deserialize::Merge` for rule option types to define how shared and user configurations are merged

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Use `Box<[Box<str>]>` instead of `Vec<String>` for collections of strings in rule options to save memory

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new language prefix to the `LANGUAGE_PREFIXES` constant in `language_kind.rs` file

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Apply `#[serde(rename_all = "camelCase")]` to rule option structs to match JSON configuration naming convention

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Apply `#[serde(deny_unknown_fields)]` to rule option structs to enforce strict configuration validation

Applied to files:

  • crates/biome_rule_options/src/lib.rs
⏰ 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: Check Dependencies
  • GitHub Check: End-to-end tests
  • 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: Test (depot-windows-2022-16)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Check JS Files
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: autofix
🔇 Additional comments (2)
crates/biome_rule_options/src/lib.rs (2)

343-343: LGTM, assuming codegen was properly executed.

The module declaration is correctly positioned alphabetically and follows the established naming convention.


1-1: No action required – codegen has correctly generated this entry.

The module is properly registered in alphabetical order, which is consistent with the output of the codegen tool. The file header is standard for all generated code in this crate.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7c85bf0 and de4a247.

⛔ Files ignored due to path filters (15)
  • crates/biome_configuration/src/analyzer/linter/rules.rs is excluded by !**/rules.rs and included by **
  • crates/biome_diagnostics_categories/src/categories.rs is excluded by !**/categories.rs and included by **
  • crates/biome_graphql_analyze/src/lint/nursery.rs is excluded by !**/nursery.rs and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation 3.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.graphql.snap is excluded by !**/*.snap and included by **
  • packages/@biomejs/backend-jsonrpc/src/workspace.ts is excluded by !**/backend-jsonrpc/src/workspace.ts and included by **
  • packages/@biomejs/biome/configuration_schema.json is excluded by !**/configuration_schema.json and included by **
📒 Files selected for processing (16)
  • .changeset/lazy-doodles-attack.md
  • crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphql
  • 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-anonymous-mutation.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation 3.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.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_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_lone_executable_definition.rs
  • justfile
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use the dbg!() macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests

Files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_lone_executable_definition.rs
  • crates/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.rs
  • 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 : Use `deny_unknown_fields` in serde derive macro for rule options

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_lone_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.rs
  • 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 : Use `rename_all = "camelCase"` in serde derive macro for rule options

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_lone_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.rs
  • 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 : 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.rs
  • 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 : 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.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation 3.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.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
📚 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.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation 3.graphql
  • 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 : 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.graphql
  • crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs
  • 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
📚 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.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
📚 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_definition options 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.

@Netail Netail force-pushed the feat/use-lone-executable-definition branch from de4a247 to 0a2abf1 Compare December 29, 2025 18:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs (1)

40-46: Add issue_number field for nursery rule.

Nursery rules should include an issue_number field 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_number field to declare_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

📥 Commits

Reviewing files that changed from the base of the PR and between de4a247 and 0a2abf1.

⛔ Files ignored due to path filters (16)
  • crates/biome_configuration/src/analyzer/linter/rules.rs is excluded by !**/rules.rs and included by **
  • crates/biome_diagnostics_categories/src/categories.rs is excluded by !**/categories.rs and included by **
  • crates/biome_graphql_analyze/src/lint/nursery.rs is excluded by !**/nursery.rs and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.graphql.snap is excluded by !**/*.snap and included by **
  • packages/@biomejs/backend-jsonrpc/src/workspace.ts is excluded by !**/backend-jsonrpc/src/workspace.ts and included by **
  • packages/@biomejs/biome/configuration_schema.json is excluded by !**/configuration_schema.json and included by **
📒 Files selected for processing (16)
  • .changeset/lazy-doodles-attack.md
  • crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphql
  • 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-anonymous-mutation.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.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_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_lone_executable_definition.rs
  • justfile
✅ 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 the dbg!() macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests

Files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_lone_executable_definition.rs
  • crates/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.rs
  • 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 : Use `deny_unknown_fields` in serde derive macro for rule options

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_lone_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.rs
  • 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 : Use `rename_all = "camelCase"` in serde derive macro for rule options

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_lone_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.rs
  • 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 : Set `version` field to `next` in `declare_lint_rule!` macro

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • 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 `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
  • 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/**/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.rs
  • 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 `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 run function correctly handles edge cases – checking definitions.len() > 1 before removing prevents the panic on empty documents.

@Netail Netail force-pushed the feat/use-lone-executable-definition branch from 0a2abf1 to 52b49ec Compare December 29, 2025 18:43
@ematipico

Copy link
Copy Markdown
Member

FYI, from now on, please fill out the PR template. We don't ask much. Even a one-liner is enough to us

Comment on lines +10 to +11
/// Require queries, mutations, subscriptions or fragments to be located in separate files.
///

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any chance of a longer description explaining why this rule exists?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated the docs to be a bit clearer about the rule

Comment on lines +75 to +76
if definitions.len() > 1 {
definitions.remove(0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can use enumerate() and filter out the first item when the index is 0. Then here you check if len() is >=1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added

Some(
diagnostic
.note(markup! {
"Require queries, mutations, subscriptions or fragments to be located in separate files. Separate definitions into separate files."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"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."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Woops, that's indeed a misunderstanding. Will improve the docs

@Netail Netail force-pushed the feat/use-lone-executable-definition branch from 52b49ec to 4c8941f Compare January 3, 2026 23:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs (1)

80-80: Simplify the length check.

The .iter() call is unnecessary here, and checking >= 1 is 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

📥 Commits

Reviewing files that changed from the base of the PR and between 52b49ec and 4c8941f.

⛔ Files ignored due to path filters (16)
  • crates/biome_configuration/src/analyzer/linter/rules.rs is excluded by !**/rules.rs and included by **
  • crates/biome_diagnostics_categories/src/categories.rs is excluded by !**/categories.rs and included by **
  • crates/biome_graphql_analyze/src/lint/nursery.rs is excluded by !**/nursery.rs and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/single-query-definition.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/fragment.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-mutation.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-subscription.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-shorthand-query.graphql.snap is excluded by !**/*.snap and included by **
  • packages/@biomejs/backend-jsonrpc/src/workspace.ts is excluded by !**/backend-jsonrpc/src/workspace.ts and included by **
  • packages/@biomejs/biome/configuration_schema.json is excluded by !**/configuration_schema.json and included by **
📒 Files selected for processing (16)
  • .changeset/lazy-doodles-attack.md
  • crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-executables-definitions.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/invalid/multi-named-query.graphql
  • 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-anonymous-mutation.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-query.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-anonymous-subscription.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-mutation.graphql
  • crates/biome_graphql_analyze/tests/specs/nursery/useLoneExecutableDefinition/valid/single-named-query.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_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_lone_executable_definition.rs
  • justfile
🚧 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 the dbg!() macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests

Files:

  • crates/biome_graphql_analyze/src/lint/nursery/use_lone_executable_definition.rs
  • crates/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.rs
  • 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/**/*_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.rs
  • 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/**/*_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.

@Netail Netail force-pushed the feat/use-lone-executable-definition branch 2 times, most recently from 8905e34 to e2e280c Compare January 3, 2026 23:49
@Netail Netail force-pushed the feat/use-lone-executable-definition branch from 3f2e78f to 4904838 Compare January 4, 2026 00:07
@Netail Netail merged commit 31a9bfe into biomejs:main Jan 4, 2026
19 checks passed
@Netail Netail deleted the feat/use-lone-executable-definition branch January 4, 2026 15:39
@github-actions github-actions Bot mentioned this pull request Jan 4, 2026
baeseokjae pushed a commit to baeseokjae/biome that referenced this pull request Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants