-
-
Notifications
You must be signed in to change notification settings - Fork 781
feat(graphql_analyze): add useUniqueGraphqlOperationName
#8013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(graphql_analyze): add useUniqueGraphqlOperationName
#8013
Conversation
🦋 Changeset detectedLatest commit: df2fd79 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #8013 will not alter performanceComparing Summary
Footnotes
|
WalkthroughAdds a new GraphQL lint rule Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs (1)
59-105: Point developers at the first definition as well.Right now we overwrite the stored range on every duplicate, so the diagnostic can’t show where the original name lives. If we keep that first
TextRangeand feed it into a.detail(...), teams can jump straight to the culprit instead of grepping around. Something along these lines should do the trick:-pub struct DuplicateOperationName { - name: Box<str>, - text_range: TextRange, -} +pub struct DuplicateOperationName { + name: Box<str>, + first_range: TextRange, + duplicate_range: TextRange, +} - if let Some(_existing_range) = operation_names.insert(name.clone(), text_range) { - duplicates.push(DuplicateOperationName { name, text_range }); + if let Some(first_range) = operation_names.insert(name.clone(), text_range) { + duplicates.push(DuplicateOperationName { + name, + first_range, + duplicate_range: text_range, + }); } - let DuplicateOperationName { name, text_range } = state; + let DuplicateOperationName { name, first_range, duplicate_range } = state; Some( RuleDiagnostic::new( rule_category!(), - text_range, + duplicate_range, markup! { "Operation named \""{ name }"\" is already defined." }, ) - .note(markup! { - "GraphQL operation names must be unique to ensure proper identification." - }), + .note(markup! { + "GraphQL operation names must be unique to ensure proper identification." + }) + .detail(*first_range, markup! { + "First definition lives here." + }), )That keeps the diagnostic concise while giving contributors both ends of the clash.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (8)
Cargo.lockis excluded by!**/*.lockand included by**crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_graphql_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_graphql_analyze/tests/specs/nursery/uniqueOperationName/invalid.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_analyze/tests/specs/nursery/uniqueOperationName/valid.graphql.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (7)
.changeset/rich-memes-sleep.md(1 hunks)crates/biome_graphql_analyze/Cargo.toml(1 hunks)crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs(1 hunks)crates/biome_graphql_analyze/tests/specs/nursery/uniqueOperationName/invalid.graphql(1 hunks)crates/biome_graphql_analyze/tests/specs/nursery/uniqueOperationName/valid.graphql(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/unique_operation_name.rs(1 hunks)
🧰 Additional context used
🧠 Learnings (11)
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/biome_module_graph/src/**/*.rs : Do not copy or clone data between module graph entries (including behind Arc). Each module must avoid holding duplicated data from another module to enable simple invalidation.
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/crates/biome_*_{syntax,factory}/** : Create per-language crates biome_<lang>_syntax and biome_<lang>_factory under crates/
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/**/*.rs : After generation, remove usages of `format_verbatim_node` and implement real formatting with biome_formatter utilities
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/crates/**/src/lexer/mod.rs : Create a lexer module at crates/<parser_crate>/src/lexer/mod.rs
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/src/workspace.rs : Implement and expose the Workspace trait in src/workspace.rs
Applied to files:
crates/biome_graphql_analyze/Cargo.toml
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/**/Cargo.toml : Add the specified dev-dependencies under [dev-dependencies] for the test infrastructure
Applied to files:
crates/biome_graphql_analyze/Cargo.toml
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/Cargo.toml : Declare the dependency `biome_js_formatter = { version = "0.0.1", path = "../biome_js_formatter" }` for internal installation
Applied to files:
crates/biome_graphql_analyze/Cargo.toml
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Place watcher tests related to workspace methods in src/workspace/watcher.tests.rs
Applied to files:
crates/biome_graphql_analyze/Cargo.toml
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/src/workspace/server.rs : WorkspaceServer must maintain workspace state and is used in the daemon and CLI daemonless mode
Applied to files:
crates/biome_graphql_analyze/Cargo.toml
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/src/workspace_watcher.rs : WorkspaceWatcher should synchronize workspace state with the filesystem and be active only in daemon mode (not used by the CLI)
Applied to files:
crates/biome_graphql_analyze/Cargo.toml
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/type_info.rs : Add new TypeScript type support by extending the TypeData enum rather than introducing parallel structures.
Applied to files:
crates/biome_rule_options/src/unique_operation_name.rs
🧬 Code graph analysis (2)
crates/biome_rule_options/src/unique_operation_name.rs (1)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (1)
UniqueOperationNameOptions(8376-8376)
crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs (2)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (2)
TextRange(9433-9433)UniqueOperationNameOptions(8376-8376)crates/biome_analyze/src/rule.rs (3)
recommended(595-598)sources(610-613)inspired(254-259)
⏰ 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). (20)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Check JS Files
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Check Dependencies
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: autofix
🔇 Additional comments (6)
crates/biome_graphql_analyze/Cargo.toml (1)
27-27: Dependency addition looks right.Thanks for pulling in
rustc-hash; the new rule leans onFxHashMap, so this lands exactly where it should.crates/biome_rule_options/src/unique_operation_name.rs (1)
1-6: Options stub matches the runtime surface.The empty struct with defaults keeps Rust and TypeScript options in sync—no notes from me.
.changeset/rich-memes-sleep.md (1)
1-37: Double-check the docs link before we ship.The changeset points to https://biomejs.dev/linter/rules/unique-operation-name; please make sure that page lands alongside this release so we don’t ship a 404.
crates/biome_graphql_analyze/tests/specs/nursery/uniqueOperationName/invalid.graphql (1)
1-29: Nice coverage of duplicate scenarios.Hitting both duplicate queries and stacked mutations will keep the rule honest.
crates/biome_rule_options/src/lib.rs (1)
251-251: Good catch adding the module export.This keeps the new options reachable from the crate surface—exactly what we need.
crates/biome_graphql_analyze/tests/specs/nursery/uniqueOperationName/valid.graphql (1)
1-33: Happy path looks solid.Anon operations plus distinct names cover the “no diagnostic” side nicely.
crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs
Outdated
Show resolved
Hide resolved
crates/biome_graphql_analyze/src/lint/nursery/use_unique_graphql_operation_name.rs
Show resolved
Hide resolved
crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs (2)
52-52: Rule naming still violates convention.As previously noted, rule names must start with
useornoper Biome's contributing guidelines.
99-108: Diagnostic still lacks actionable resolution guidance.As previously noted, this doesn't follow the rule pillars—needs clearer guidance on what the user should do to resolve the problem.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
crates/biome_graphql_analyze/tests/specs/nursery/uniqueOperationName/invalid.graphql.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (1)
crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-25T07:02:26.457Z
Learnt from: ematipico
Repo: biomejs/biome PR: 7856
File: .changeset/yellow-crews-guess.md:1-5
Timestamp: 2025-10-25T07:02:26.457Z
Learning: The Biome documentation website uses kebab-case URL slugs for rule pages (e.g., `/linter/rules/no-continue/`), not camelCase.
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs
📚 Learning: 2025-10-15T09:21:24.116Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:21:24.116Z
Learning: A diagnostic must explain why something went wrong, using log advices and links to documentation when helpful
Applied to files:
crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs
🧬 Code graph analysis (1)
crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs (2)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (1)
UniqueOperationNameOptions(8376-8376)crates/biome_analyze/src/rule.rs (3)
recommended(595-598)sources(610-613)inspired(254-259)
⏰ 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). (25)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Documentation
- GitHub Check: End-to-end tests
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Check Dependencies
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Validate rules documentation
- GitHub Check: Check JS Files
- GitHub Check: autofix
- GitHub Check: Bench (biome_package)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_css_parser)
🔇 Additional comments (2)
crates/biome_graphql_analyze/src/lint/nursery/unique_operation_name.rs (2)
1-8: LGTM—imports are appropriate.Good choice using
TokenTextthroughout, avoiding unnecessary allocations.
59-62: State struct looks good.Clean structure using
TokenTextto avoid allocations.
crates/biome_graphql_analyze/src/lint/nursery/use_unique_graphql_operation_name.rs
Show resolved
Hide resolved
uniqueOperationNameuseUniqueGraphqlOperationName
ec179b6 to
ae6bf08
Compare
dyc3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No complaints here. Nice work! Just a couple housekeeping items.
crates/biome_graphql_analyze/src/lint/nursery/use_unique_graphql_operation_name.rs
Show resolved
Hide resolved
crates/biome_graphql_analyze/src/lint/nursery/use_unique_graphql_operation_name.rs
Show resolved
Hide resolved
crates/biome_graphql_analyze/src/lint/nursery/use_unique_graphql_operation_name.rs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_service/src/workspace_types.rs (1)
173-208: Don't panic onadditionalProperties: true.Right now, if a schema sets
additionalProperties: true,schema_typereturns(any, true, …)and theassert!(!optional, …)path will fire. That means the codegen blows up for common dictionary shapes (OpenAPI defaults totrue). Please special-case booleantrue(and other permissive forms) so we emit a sensibleRecord<string, any>instead of asserting.Apply this patch to tame the panic:
- let value_type = { - let (ts_type, optional, _) = schema_type(queue, root_schema, add_props); - assert!(!optional, "optional nested types are not supported"); - ts_type - }; + let value_type = match add_props { + Value::Bool(true) => { + AnyTsType::from(make::ts_any_type(make::token(T![any]))) + } + _ => { + let (ts_type, optional, _) = schema_type(queue, root_schema, add_props); + assert!(!optional, "optional nested types are not supported"); + ts_type + } + };
🧹 Nitpick comments (1)
crates/biome_rule_options/src/use_import_type.rs (1)
42-42: Consider using the shorter path for consistency.
schemars::SchemaGeneratoris re-exported at the crate root and matches the pattern used elsewhere in the codebase.- fn json_schema(_generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema { + fn json_schema(_generator: &mut schemars::SchemaGenerator) -> schemars::Schema {
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
Cargo.lockis excluded by!**/*.lockand included by**crates/biome_analyze/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_js_analyze/tests/specs/style/noNestedTernary/invalid.js.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/style/noNestedTernary/valid.js.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (39)
.changeset/fix-nested-ternary-parentheses.md(1 hunks)Cargo.toml(1 hunks)crates/biome_configuration/src/analyzer/linter/mod.rs(1 hunks)crates/biome_configuration/src/analyzer/mod.rs(9 hunks)crates/biome_configuration/src/bool.rs(1 hunks)crates/biome_configuration/src/extends.rs(1 hunks)crates/biome_configuration/src/lib.rs(1 hunks)crates/biome_configuration/src/overrides.rs(1 hunks)crates/biome_diagnostics/src/display/backtrace.rs(1 hunks)crates/biome_diagnostics/src/serde.rs(1 hunks)crates/biome_diagnostics_categories/Cargo.toml(1 hunks)crates/biome_diagnostics_categories/build.rs(1 hunks)crates/biome_fs/src/path.rs(1 hunks)crates/biome_glob/src/editorconfig.rs(1 hunks)crates/biome_glob/src/lib.rs(1 hunks)crates/biome_grit_patterns/src/grit_target_language.rs(1 hunks)crates/biome_js_analyze/src/lint/style/no_nested_ternary.rs(1 hunks)crates/biome_js_analyze/tests/specs/style/noNestedTernary/invalid.js(1 hunks)crates/biome_js_analyze/tests/specs/style/noNestedTernary/valid.js(1 hunks)crates/biome_js_formatter/src/context/trailing_commas.rs(1 hunks)crates/biome_json_formatter/src/context.rs(1 hunks)crates/biome_rule_options/Cargo.toml(1 hunks)crates/biome_rule_options/src/no_restricted_elements.rs(1 hunks)crates/biome_rule_options/src/no_undeclared_dependencies.rs(1 hunks)crates/biome_rule_options/src/organize_imports/import_groups.rs(1 hunks)crates/biome_rule_options/src/shared/restricted_regex.rs(1 hunks)crates/biome_rule_options/src/use_consistent_graphql_descriptions.rs(1 hunks)crates/biome_rule_options/src/use_exhaustive_dependencies.rs(1 hunks)crates/biome_rule_options/src/use_filenaming_convention.rs(1 hunks)crates/biome_rule_options/src/use_import_type.rs(1 hunks)crates/biome_rule_options/src/use_naming_convention.rs(2 hunks)crates/biome_service/src/workspace.rs(3 hunks)crates/biome_service/src/workspace_types.rs(9 hunks)crates/biome_text_size/src/schemars_impls.rs(2 hunks)crates/biome_wasm/Cargo.toml(1 hunks)crates/biome_wasm/build.rs(2 hunks)crates/biome_wasm/src/utils.rs(1 hunks)xtask/codegen/src/generate_bindings.rs(1 hunks)xtask/codegen/src/generate_schema.rs(2 hunks)
✅ Files skipped from review due to trivial changes (2)
- crates/biome_wasm/src/utils.rs
- crates/biome_wasm/build.rs
🧰 Additional context used
📓 Path-based instructions (2)
crates/biome_service/src/workspace.rs
📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)
Implement and expose the Workspace trait in src/workspace.rs
Files:
crates/biome_service/src/workspace.rs
crates/biome_js_formatter/**/*.rs
📄 CodeRabbit inference engine (crates/biome_js_formatter/CONTRIBUTING.md)
crates/biome_js_formatter/**/*.rs: Implement theFormattrait for your node type and useJsFormatterwithwrite!/format_args!to define formatting
Import and use theFormatNodetrait for AST nodes
When a token is mandatory and present in the AST, use the AST-provided token (e.g.,node.l_paren_token().format()) instead of emitting a static token
For non-mandatory tokens, use the provided helper constructors (e.g.,token,space_token,dynamic_token)
Do not attempt to fix code; if a mandatory token/node is missing, returnNoneinstead
Usedbg_write!to debug and inspect the emitted IR during formatting
Files:
crates/biome_js_formatter/src/context/trailing_commas.rs
🧠 Learnings (35)
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to fix code; if a mandatory token/node is missing, return `None` instead
Applied to files:
crates/biome_js_analyze/src/lint/style/no_nested_ternary.rscrates/biome_json_formatter/src/context.rsxtask/codegen/src/generate_schema.rscrates/biome_service/src/workspace_types.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/{type_info,local_inference,resolver,flattening}.rs : Avoid recursive type structures and cross-module Arcs; represent links between types using TypeReference and TypeData::Reference.
Applied to files:
crates/biome_js_analyze/src/lint/style/no_nested_ternary.rscrates/biome_rule_options/src/no_undeclared_dependencies.rscrates/biome_configuration/src/overrides.rsxtask/codegen/src/generate_bindings.rscrates/biome_service/src/workspace.rscrates/biome_text_size/src/schemars_impls.rscrates/biome_configuration/src/analyzer/linter/mod.rscrates/biome_fs/src/path.rscrates/biome_rule_options/src/use_import_type.rscrates/biome_diagnostics/src/display/backtrace.rscrates/biome_rule_options/src/use_naming_convention.rscrates/biome_configuration/src/lib.rsxtask/codegen/src/generate_schema.rscrates/biome_rule_options/src/use_exhaustive_dependencies.rscrates/biome_service/src/workspace_types.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When a token is mandatory and present in the AST, use the AST-provided token (e.g., `node.l_paren_token().format()`) instead of emitting a static token
Applied to files:
crates/biome_js_analyze/src/lint/style/no_nested_ternary.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/type_info.rs : Add new TypeScript type support by extending the TypeData enum rather than introducing parallel structures.
Applied to files:
crates/biome_js_analyze/src/lint/style/no_nested_ternary.rscrates/biome_rule_options/Cargo.tomlcrates/biome_service/src/workspace.rscrates/biome_text_size/src/schemars_impls.rscrates/biome_rule_options/src/use_consistent_graphql_descriptions.rscrates/biome_rule_options/src/use_import_type.rscrates/biome_rule_options/src/use_naming_convention.rscrates/biome_configuration/src/extends.rscrates/biome_service/src/workspace_types.rscrates/biome_diagnostics_categories/Cargo.toml
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import and use the `FormatNode` trait for AST nodes
Applied to files:
crates/biome_js_analyze/src/lint/style/no_nested_ternary.rsxtask/codegen/src/generate_bindings.rscrates/biome_json_formatter/src/context.rscrates/biome_rule_options/src/use_import_type.rscrates/biome_rule_options/src/use_naming_convention.rsxtask/codegen/src/generate_schema.rscrates/biome_service/src/workspace_types.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/**/*.rs : After generation, remove usages of `format_verbatim_node` and implement real formatting with biome_formatter utilities
Applied to files:
crates/biome_js_analyze/src/lint/style/no_nested_ternary.rscrates/biome_configuration/src/overrides.rscrates/biome_rule_options/Cargo.tomlxtask/codegen/src/generate_bindings.rscrates/biome_service/src/workspace.rscrates/biome_text_size/src/schemars_impls.rscrates/biome_json_formatter/src/context.rscrates/biome_wasm/Cargo.tomlcrates/biome_configuration/src/analyzer/linter/mod.rscrates/biome_rule_options/src/use_consistent_graphql_descriptions.rscrates/biome_fs/src/path.rscrates/biome_rule_options/src/use_import_type.rscrates/biome_rule_options/src/use_naming_convention.rsxtask/codegen/src/generate_schema.rscrates/biome_js_formatter/src/context/trailing_commas.rscrates/biome_diagnostics_categories/Cargo.toml
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/Cargo.toml : Declare the dependency `biome_js_formatter = { version = "0.0.1", path = "../biome_js_formatter" }` for internal installation
Applied to files:
crates/biome_rule_options/Cargo.tomlcrates/biome_wasm/Cargo.tomlcrates/biome_fs/src/path.rsxtask/codegen/src/generate_schema.rscrates/biome_diagnostics_categories/Cargo.toml
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/**/Cargo.toml : Add the specified dev-dependencies under [dev-dependencies] for the test infrastructure
Applied to files:
crates/biome_rule_options/Cargo.tomlcrates/biome_wasm/Cargo.tomlcrates/biome_diagnostics_categories/Cargo.toml
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/crates/biome_*_{syntax,factory}/** : Create per-language crates biome_<lang>_syntax and biome_<lang>_factory under crates/
Applied to files:
crates/biome_rule_options/Cargo.tomlcrates/biome_service/src/workspace.rscrates/biome_wasm/Cargo.tomlcrates/biome_diagnostics_categories/Cargo.toml
📚 Learning: 2025-10-15T09:20:45.587Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_aria_metadata/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:45.587Z
Learning: Applies to crates/biome_aria_metadata/**/{build.rs,aria-data.json} : Keep aria-data.json at the expected location/name because build.rs uses it to generate ARIA metadata
Applied to files:
crates/biome_rule_options/Cargo.tomlcrates/biome_wasm/Cargo.toml
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/crates/biome_*_{syntax,factory}/src/generated/** : Each new biome_<lang>_{syntax,factory} crate must have a src/generated/ directory for codegen output
Applied to files:
crates/biome_rule_options/Cargo.tomlcrates/biome_wasm/Cargo.toml
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/src/workspace.rs : Implement and expose the Workspace trait in src/workspace.rs
Applied to files:
crates/biome_rule_options/Cargo.tomlxtask/codegen/src/generate_bindings.rscrates/biome_service/src/workspace.rscrates/biome_text_size/src/schemars_impls.rscrates/biome_wasm/Cargo.tomlcrates/biome_service/src/workspace_types.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/biome_module_graph/src/**/*.rs : Do not copy or clone data between module graph entries (including behind Arc). Each module must avoid holding duplicated data from another module to enable simple invalidation.
Applied to files:
xtask/codegen/src/generate_bindings.rscrates/biome_service/src/workspace_types.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/biome_module_graph/src/js_module_info/scoped_resolver.rs : Full inference must resolve TypeReference::Import across modules to TypeReference::Resolved when the target is available in the module graph.
Applied to files:
xtask/codegen/src/generate_bindings.rscrates/biome_service/src/workspace_types.rs
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Place watcher tests related to workspace methods in src/workspace/watcher.tests.rs
Applied to files:
xtask/codegen/src/generate_bindings.rscrates/biome_service/src/workspace.rscrates/biome_wasm/Cargo.tomlcrates/biome_service/src/workspace_types.rs
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Keep end-to-end LSP tests in ../biome_lsp/src/server.tests.rs
Applied to files:
crates/biome_service/src/workspace.rscrates/biome_wasm/Cargo.toml
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/src/workspace/client.rs : WorkspaceClient is for creating connections to the daemon and communicating with WorkspaceServer
Applied to files:
crates/biome_service/src/workspace.rscrates/biome_text_size/src/schemars_impls.rscrates/biome_wasm/Cargo.toml
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/src/workspace/server.rs : WorkspaceServer must maintain workspace state and is used in the daemon and CLI daemonless mode
Applied to files:
crates/biome_service/src/workspace.rscrates/biome_text_size/src/schemars_impls.rscrates/biome_wasm/Cargo.toml
📚 Learning: 2025-10-15T09:21:24.116Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:21:24.116Z
Learning: Applies to crates/biome_diagnostics/crates/biome_diagnostics_categories/src/categories.rs : Register any new diagnostic category in `crates/biome_diagnostics_categories/src/categories.rs`
Applied to files:
crates/biome_diagnostics_categories/build.rscrates/biome_diagnostics/src/serde.rscrates/biome_diagnostics_categories/Cargo.toml
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/context.rs : Create HtmlFormatContext in context.rs with comments and source_map fields and implement FormatContext and CstFormatContext
Applied to files:
crates/biome_json_formatter/src/context.rsxtask/codegen/src/generate_schema.rs
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.
Applied to files:
crates/biome_wasm/Cargo.tomlcrates/biome_configuration/src/lib.rscrates/biome_diagnostics_categories/Cargo.toml
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/src/workspace_watcher.rs : WorkspaceWatcher should synchronize workspace state with the filesystem and be active only in daemon mode (not used by the CLI)
Applied to files:
crates/biome_wasm/Cargo.toml
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use `dbg_write!` to debug and inspect the emitted IR during formatting
Applied to files:
crates/biome_wasm/Cargo.toml
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/comments.rs : Define HtmlCommentStyle implementing CommentStyle in comments.rs
Applied to files:
crates/biome_rule_options/src/use_consistent_graphql_descriptions.rscrates/biome_rule_options/src/use_import_type.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Implement the `Format` trait for your node type and use `JsFormatter` with `write!`/`format_args!` to define formatting
Applied to files:
crates/biome_rule_options/src/use_naming_convention.rsxtask/codegen/src/generate_schema.rscrates/biome_service/src/workspace_types.rs
📚 Learning: 2025-10-15T09:21:24.116Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:21:24.116Z
Learning: Prefer implementing the Diagnostic trait via `#[derive(Diagnostic)]`
Applied to files:
crates/biome_configuration/src/analyzer/mod.rscrates/biome_diagnostics/src/serde.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Parser type must implement the biome_parser::Parser trait and hold context, token source, and optional options
Applied to files:
xtask/codegen/src/generate_schema.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Lexer must implement the biome_parser::Lexer trait
Applied to files:
xtask/codegen/src/generate_schema.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/lib.rs : Add the provided AsFormat, IntoFormat, and iterator plumbing code to lib.rs
Applied to files:
xtask/codegen/src/generate_schema.rs
📚 Learning: 2025-10-15T09:21:24.116Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:21:24.116Z
Learning: `#[derive(Diagnostic)]` is supported on enums; each variant must contain a type that is itself a diagnostic
Applied to files:
crates/biome_diagnostics/src/serde.rs
📚 Learning: 2025-10-15T09:21:24.116Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:21:24.116Z
Learning: Specify static properties (category, severity, description, message, location, tags) with `#[diagnostic(...)]`
Applied to files:
crates/biome_diagnostics/src/serde.rs
📚 Learning: 2025-10-15T09:21:24.116Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:21:24.116Z
Learning: Types deriving `Diagnostic` must also implement `Debug`
Applied to files:
crates/biome_diagnostics/src/serde.rs
📚 Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Applied to files:
crates/biome_service/src/workspace_types.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For non-mandatory tokens, use the provided helper constructors (e.g., `token`, `space_token`, `dynamic_token`)
Applied to files:
crates/biome_service/src/workspace_types.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/biome_module_graph/src/js_module_info/collector.rs : Thin (module-level) inference should resolve local and global bindings to TypeReference::Resolved, mark imported bindings as TypeReference::Import, and fall back to TypeReference::Unknown if unresolved.
Applied to files:
crates/biome_service/src/workspace_types.rs
🧬 Code graph analysis (29)
crates/biome_rule_options/src/no_undeclared_dependencies.rs (2)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/analyzer/mod.rs (18)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)
crates/biome_configuration/src/overrides.rs (4)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/analyzer/mod.rs (33)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)generator(112-112)generator(113-113)generator(218-218)generator(219-219)generator(378-378)generator(379-379)generator(453-453)generator(454-454)generator(497-497)generator(498-498)generator(547-547)generator(548-548)generator(549-549)generator(985-985)generator(986-986)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_configuration/src/extends.rs (2)
schema_name(65-67)json_schema(69-78)
xtask/codegen/src/generate_bindings.rs (2)
crates/biome_service/src/workspace_types.rs (2)
SchemaGenerator(730-730)SchemaGenerator(731-731)crates/biome_wasm/build.rs (1)
SchemaGenerator(25-26)
crates/biome_rule_options/src/shared/restricted_regex.rs (4)
crates/biome_configuration/src/analyzer/mod.rs (33)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)generator(112-112)generator(113-113)generator(218-218)generator(219-219)generator(378-378)generator(379-379)generator(453-453)generator(454-454)generator(497-497)generator(498-498)generator(547-547)generator(548-548)generator(549-549)generator(985-985)generator(986-986)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_configuration/src/extends.rs (2)
schema_name(65-67)json_schema(69-78)crates/biome_configuration/src/lib.rs (2)
schema_name(430-432)json_schema(434-436)
crates/biome_service/src/workspace.rs (3)
crates/biome_wasm/build.rs (1)
SchemaGenerator(25-26)crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)
crates/biome_diagnostics_categories/build.rs (4)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_configuration/src/extends.rs (2)
schema_name(65-67)json_schema(69-78)crates/biome_configuration/src/lib.rs (2)
schema_name(430-432)json_schema(434-436)
crates/biome_text_size/src/schemars_impls.rs (4)
crates/biome_configuration/src/analyzer/mod.rs (9)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)crates/biome_configuration/src/bool.rs (1)
schema_name(105-107)crates/biome_configuration/src/lib.rs (1)
schema_name(430-432)crates/biome_diagnostics/src/serde.rs (1)
schema_name(364-366)
crates/biome_grit_patterns/src/grit_target_language.rs (4)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_configuration/src/extends.rs (2)
schema_name(65-67)json_schema(69-78)crates/biome_configuration/src/lib.rs (2)
schema_name(430-432)json_schema(434-436)
crates/biome_rule_options/src/use_filenaming_convention.rs (2)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
crates/biome_configuration/src/analyzer/mod.rs (18)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)xtask/codegen/src/generate_bindings.rs (3)
SchemaGenerator(158-159)SchemaGenerator(161-162)SchemaGenerator(164-165)
crates/biome_rule_options/src/use_consistent_graphql_descriptions.rs (2)
crates/biome_configuration/src/analyzer/mod.rs (18)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)crates/biome_configuration/src/extends.rs (2)
schema_name(65-67)json_schema(69-78)
crates/biome_glob/src/lib.rs (4)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_configuration/src/lib.rs (2)
schema_name(430-432)json_schema(434-436)crates/biome_configuration/src/overrides.rs (2)
schema_name(104-106)json_schema(107-109)
crates/biome_fs/src/path.rs (3)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_service/src/workspace.rs (6)
schema_name(426-428)schema_name(673-675)json_schema(430-444)json_schema(677-679)generator(432-432)generator(433-433)
crates/biome_glob/src/editorconfig.rs (4)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_configuration/src/extends.rs (2)
schema_name(65-67)json_schema(69-78)crates/biome_configuration/src/overrides.rs (2)
schema_name(104-106)json_schema(107-109)
crates/biome_rule_options/src/no_restricted_elements.rs (1)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)
crates/biome_rule_options/src/use_import_type.rs (1)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)
crates/biome_diagnostics/src/display/backtrace.rs (4)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_configuration/src/extends.rs (2)
schema_name(65-67)json_schema(69-78)crates/biome_diagnostics/src/serde.rs (2)
schema_name(364-366)json_schema(368-370)
crates/biome_rule_options/src/use_naming_convention.rs (4)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/analyzer/mod.rs (33)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)generator(112-112)generator(113-113)generator(218-218)generator(219-219)generator(378-378)generator(379-379)generator(453-453)generator(454-454)generator(497-497)generator(498-498)generator(547-547)generator(548-548)generator(549-549)generator(985-985)generator(986-986)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_configuration/src/lib.rs (2)
schema_name(430-432)json_schema(434-436)
crates/biome_configuration/src/extends.rs (3)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_configuration/src/lib.rs (2)
schema_name(430-432)json_schema(434-436)
crates/biome_configuration/src/lib.rs (3)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/analyzer/mod.rs (33)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)generator(112-112)generator(113-113)generator(218-218)generator(219-219)generator(378-378)generator(379-379)generator(453-453)generator(454-454)generator(497-497)generator(498-498)generator(547-547)generator(548-548)generator(549-549)generator(985-985)generator(986-986)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)
crates/biome_rule_options/src/organize_imports/import_groups.rs (2)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/analyzer/mod.rs (33)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)generator(112-112)generator(113-113)generator(218-218)generator(219-219)generator(378-378)generator(379-379)generator(453-453)generator(454-454)generator(497-497)generator(498-498)generator(547-547)generator(548-548)generator(549-549)generator(985-985)generator(986-986)
crates/biome_configuration/src/analyzer/mod.rs (3)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)crates/biome_service/src/workspace.rs (6)
schema_name(426-428)schema_name(673-675)json_schema(430-444)json_schema(677-679)generator(432-432)generator(433-433)
xtask/codegen/src/generate_schema.rs (1)
crates/biome_service/src/workspace_types.rs (1)
rename_type(47-73)
crates/biome_configuration/src/bool.rs (4)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/analyzer/mod.rs (33)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)generator(112-112)generator(113-113)generator(218-218)generator(219-219)generator(378-378)generator(379-379)generator(453-453)generator(454-454)generator(497-497)generator(498-498)generator(547-547)generator(548-548)generator(549-549)generator(985-985)generator(986-986)crates/biome_configuration/src/extends.rs (2)
schema_name(65-67)json_schema(69-78)crates/biome_configuration/src/lib.rs (2)
schema_name(430-432)json_schema(434-436)
crates/biome_diagnostics/src/serde.rs (3)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/analyzer/mod.rs (33)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)generator(112-112)generator(113-113)generator(218-218)generator(219-219)generator(378-378)generator(379-379)generator(453-453)generator(454-454)generator(497-497)generator(498-498)generator(547-547)generator(548-548)generator(549-549)generator(985-985)generator(986-986)crates/biome_configuration/src/bool.rs (2)
schema_name(105-107)json_schema(109-111)
crates/biome_js_analyze/tests/specs/style/noNestedTernary/invalid.js (1)
crates/biome_js_analyze/tests/specs/style/noNestedTernary/valid.js (5)
thing1(2-2)thing2(4-4)thing3(14-14)thing4(16-16)thing5(18-18)
crates/biome_rule_options/src/use_exhaustive_dependencies.rs (2)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/analyzer/mod.rs (18)
schema_name(106-108)schema_name(212-214)schema_name(373-375)schema_name(448-450)schema_name(491-493)schema_name(541-543)schema_name(651-653)schema_name(859-861)schema_name(979-981)json_schema(110-122)json_schema(216-228)json_schema(377-387)json_schema(452-464)json_schema(495-510)json_schema(545-562)json_schema(654-656)json_schema(862-864)json_schema(983-995)
crates/biome_service/src/workspace_types.rs (3)
crates/biome_wasm/build.rs (1)
SchemaGenerator(25-26)xtask/codegen/src/generate_bindings.rs (3)
SchemaGenerator(158-159)SchemaGenerator(161-162)SchemaGenerator(164-165)xtask/codegen/src/generate_schema.rs (1)
rename_type(30-56)
crates/biome_js_formatter/src/context/trailing_commas.rs (2)
crates/biome_configuration/src/analyzer/linter/mod.rs (2)
schema_name(67-69)json_schema(71-81)crates/biome_configuration/src/extends.rs (2)
schema_name(65-67)json_schema(69-78)
🔇 Additional comments (28)
crates/biome_rule_options/src/use_filenaming_convention.rs (1)
100-103: LGTM! Clean API migration.The schemars API updates are correct and consistent with the patterns used elsewhere in the codebase (e.g.,
RuleDomains,Bool). UsingCow::Borrowedfor the static schema name is appropriate.xtask/codegen/src/generate_bindings.rs (1)
13-13: LGTM! Clean API migration.The import path update aligns with the schemars library migration from
r#gentogeneratemodule, consistent with similar changes elsewhere in the codebase.crates/biome_rule_options/src/no_restricted_elements.rs (1)
44-56: LGTM! Clean refactoring to inline schema generation.The migration to
Cow::Borrowedforschema_name()and theschemars::json_schema!macro aligns well with the project-wide patterns. TheminProperties: 1constraint appropriately ensures the map isn't empty.crates/biome_diagnostics_categories/build.rs (1)
69-77: The schema glow-up looks splendidSwitch to
Cowplus the compact JSON map keeps the build script neat and matches the rest of the migration. Nicely done.crates/biome_text_size/src/schemars_impls.rs (1)
9-9: LGTM! Clean API migration.The import simplification and migration to
Cow<'static, str>forschema_name()are spot on. UsingCow::Borrowedfor static strings avoids unnecessary allocations and aligns perfectly with the pattern used throughout the codebase.Also applies to: 12-13, 24-25
crates/biome_diagnostics/src/serde.rs (1)
363-371: LGTM! Clean schemars API migration.The changes correctly update the
JsonSchemaimplementation to match the new schemars API whilst preserving the delegation behaviour toVec<DiagnosticTag>.crates/biome_rule_options/src/shared/restricted_regex.rs (1)
109-115: LGTM! Clean API migration.The JsonSchema implementation correctly follows the project-wide migration pattern. Using
Cow::Borrowed("Regex")is efficient, and delegating toString::json_schema(generator)is appropriate sinceRestrictedRegexserializes to/fromString.crates/biome_rule_options/src/no_undeclared_dependencies.rs (2)
63-64: LGTM! Clean migration toCow::Borrowed.The schema name implementation is consistent with the broader refactoring pattern across the codebase.
67-84: LGTM! Schema accurately represents the enum structure.The macro-based implementation correctly models the untagged
DependencyAvailabilityenum with aoneOfschema. Both variants (boolean and array of globs) are properly typed, and theminItems: 1constraint on the array variant is sensible.crates/biome_fs/src/path.rs (1)
244-253: LGTM! Clean schema API migration.The changes correctly migrate to the newer schemars API:
Cow::Borrowedavoids unnecessary allocations, and the schema generation behaviour remains unchanged through delegation toString::json_schema(generator).crates/biome_glob/src/editorconfig.rs (1)
157-163: LGTM! Efficient API migration.The migration to
Cow<'static, str>for the schema name avoids unnecessary heap allocation, and the simplified type paths align with the broader schemars API update across the codebase.crates/biome_rule_options/src/use_naming_convention.rs (2)
500-508: LGTM — schemars API migration applied correctly.The signature changes align with the broader codebase migration pattern.
650-657: LGTM — consistent migration applied.Identical pattern to the RestrictedModifiers impl above.
crates/biome_diagnostics/src/display/backtrace.rs (1)
96-102: LGTM! Clean JsonSchema API migration.The migration to
Cow<'static, str>and the updatedschemars::SchemaGeneratorparameter follows the project-wide pattern. UsingCow::Borrowedavoids unnecessary allocations whilst maintaining the same functionality.crates/biome_glob/src/lib.rs (1)
381-389: LGTM! Clean API migration.The JsonSchema implementation has been correctly updated to use
Cow<'static, str>for the schema name (avoiding unnecessary allocations) and simplified type paths for the schemars API. Consistent with the broader migration pattern across the codebase.crates/biome_rule_options/src/use_consistent_graphql_descriptions.rs (1)
20-20: LGTM! Clean schema migration.The custom
JsonSchemaimplementation correctly represents the enum's serialised form, and the schema name follows the codebase convention. The#[default]attribute properly aligns with the documented default behaviour.Also applies to: 26-39
crates/biome_rule_options/src/use_import_type.rs (1)
36-49: Manual schema implementation looks correct.The enum values in the schema properly reflect the camelCase serialization of the
Stylevariants. Good replacement of the derived implementation.crates/biome_js_analyze/src/lint/style/no_nested_ternary.rs (1)
66-72: LGTM!The fix correctly detects nested ternaries wrapped in parentheses by calling
omit_parentheses()before pattern matching. The implementation is clean and focused..changeset/fix-nested-ternary-parentheses.md (1)
1-19: LGTM!Clear documentation of the fix with helpful examples distinguishing newly-detected cases from still-valid ones.
crates/biome_js_analyze/tests/specs/style/noNestedTernary/valid.js (1)
14-18: LGTM!The new test cases correctly verify that non-nested ternaries with parentheses remain valid. Good coverage of different parentheses placements.
crates/biome_js_analyze/tests/specs/style/noNestedTernary/invalid.js (1)
5-19: LGTM!Comprehensive test coverage for nested ternaries with parentheses. The cases cover both branches, multiple levels of parentheses, and operator precedence scenarios.
crates/biome_grit_patterns/src/grit_target_language.rs (2)
79-81: LGTM – Clean API migration.The return type change to
Cow<'static, str>and use ofCow::Borrowedaligns perfectly with the newer schemars API pattern used throughout the codebase.
83-89: LGTM – Schema construction is sound.The manual map-based approach works well within the macro context, correctly generating an enum schema with the language names. The API migration from
schemars::r#gen::SchemaGeneratortoschemars::SchemaGeneratoris consistent with the broader refactor.xtask/codegen/src/generate_schema.rs (5)
4-5: LGTM!The imports correctly support the refactored Value-based schema traversal.
35-51: Consistent pattern additions.The new rename patterns for RuleAssistWithOptions, RuleFixConfiguration, and RuleAssistConfiguration follow the established conventions and integrate cleanly.
53-54: More idiomatic.Nice use of
mapfor chaining the transformation.
61-100: Well-structured refactor.The shift to Value-based traversal is cleaner. Good defensive coding with the
if letchecks on lines 63, 70, and 76. Collectingkeys_to_renamebefore mutation (line 77) correctly avoids borrow conflicts. Thebreakat line 95 sensibly prefers$defs(modern standard) overdefinitions.
102-158: Thorough recursive traversal.Excellent comprehensive coverage of the JSON Schema structure—handles both reference formats (
#/definitions/,#/$defs/), processes properties, items (object and array forms), and all subschema combinators. Well done.
| fn json_schema(generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema { | ||
| // Generate schemas for the inner types | ||
| let plain_schema = generator.subschema_for::<RulePlainConfiguration>(); | ||
| let with_options_schema = generator.subschema_for::<RuleWithOptions<T>>(); | ||
|
|
||
| // Create a oneOf schema combining both variants | ||
| schemars::json_schema!({ | ||
| "oneOf": [ | ||
| plain_schema, | ||
| with_options_schema, | ||
| ] | ||
| }) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the SchemaGenerator reference across this impl block
Every new json_schema here points to schemars::generate::SchemaGenerator, which doesn’t exist, so the whole file stops compiling. Could you swap these to schemars::SchemaGenerator (like lib.rs and friends already do)?
For example:
- fn json_schema(generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema {
+ fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema {…and mirror that change for the other methods in this file.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| fn json_schema(generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema { | |
| // Generate schemas for the inner types | |
| let plain_schema = generator.subschema_for::<RulePlainConfiguration>(); | |
| let with_options_schema = generator.subschema_for::<RuleWithOptions<T>>(); | |
| // Create a oneOf schema combining both variants | |
| schemars::json_schema!({ | |
| "oneOf": [ | |
| plain_schema, | |
| with_options_schema, | |
| ] | |
| }) | |
| } | |
| } | |
| fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema { | |
| // Generate schemas for the inner types | |
| let plain_schema = generator.subschema_for::<RulePlainConfiguration>(); | |
| let with_options_schema = generator.subschema_for::<RuleWithOptions<T>>(); | |
| // Create a oneOf schema combining both variants | |
| schemars::json_schema!({ | |
| "oneOf": [ | |
| plain_schema, | |
| with_options_schema, | |
| ] | |
| }) | |
| } | |
| } |
🤖 Prompt for AI Agents
In crates/biome_configuration/src/analyzer/mod.rs around lines 110 to 123, the
impl uses schemars::generate::SchemaGenerator (which doesn't exist); change all
references in this impl block and the other json_schema methods in this file to
schemars::SchemaGenerator instead of schemars::generate::SchemaGenerator, update
any imports or type references accordingly so the generator type resolves, and
re-run build to ensure all occurrences were replaced.
| fn json_schema(_generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema { | ||
| schemars::json_schema!({ | ||
| "type": "string", | ||
| "enum": ["all", "es5", "none"], | ||
| "description": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures for JavaScript/TypeScript files." | ||
| }) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the existing SchemaGenerator module
schemars::generate::SchemaGenerator isn’t a real module, so this impl won’t compile. Please switch to the re-exported schemars::SchemaGenerator (as done elsewhere in the PR). Let's not summon phantom modules today.
Consider:
- fn json_schema(_generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema {
+ fn json_schema(_generator: &mut schemars::SchemaGenerator) -> schemars::Schema {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| fn json_schema(_generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema { | |
| schemars::json_schema!({ | |
| "type": "string", | |
| "enum": ["all", "es5", "none"], | |
| "description": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures for JavaScript/TypeScript files." | |
| }) | |
| } | |
| fn json_schema(_generator: &mut schemars::SchemaGenerator) -> schemars::Schema { | |
| schemars::json_schema!({ | |
| "type": "string", | |
| "enum": ["all", "es5", "none"], | |
| "description": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures for JavaScript/TypeScript files." | |
| }) | |
| } |
🤖 Prompt for AI Agents
In crates/biome_js_formatter/src/context/trailing_commas.rs around lines 112 to
118, the function signature uses the non-existent
schemars::generate::SchemaGenerator type which causes a compile error; change
the parameter type to the re-exported schemars::SchemaGenerator (as used
elsewhere in the codebase) so the signature becomes fn json_schema(_generator:
&mut schemars::SchemaGenerator) -> schemars::Schema, and update any imports if
needed to match the project's other schema implementations.
| fn json_schema(_generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema { | ||
| schemars::json_schema!({ | ||
| "type": "string", | ||
| "enum": ["none", "all"], | ||
| "description": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures for JSON files." | ||
| }) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the SchemaGenerator path consistent
Same deal here: schemars::generate doesn’t exist, so this path blows up at compile time. Please use schemars::SchemaGenerator like the other files.
- fn json_schema(_generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema {
+ fn json_schema(_generator: &mut schemars::SchemaGenerator) -> schemars::Schema {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| fn json_schema(_generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema { | |
| schemars::json_schema!({ | |
| "type": "string", | |
| "enum": ["none", "all"], | |
| "description": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures for JSON files." | |
| }) | |
| } | |
| fn json_schema(_generator: &mut schemars::SchemaGenerator) -> schemars::Schema { | |
| schemars::json_schema!({ | |
| "type": "string", | |
| "enum": ["none", "all"], | |
| "description": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures for JSON files." | |
| }) | |
| } |
🤖 Prompt for AI Agents
In crates/biome_json_formatter/src/context.rs around lines 116 to 122, the
function signature uses schemars::generate::SchemaGenerator which doesn't exist
and causes a compile error; change the parameter type to
schemars::SchemaGenerator (i.e., fn json_schema(_generator: &mut
schemars::SchemaGenerator) -> schemars::Schema) to match other files, and update
any imports if necessary so the SchemaGenerator path is consistent across the
crate.
| if let Some(obj) = schema.as_object() { | ||
| let mut new_obj = obj.clone(); | ||
| // Add negated variants to the enum | ||
| if let Some(enum_values) = new_obj.get_mut("enum").and_then(|v| v.as_array_mut()) { | ||
| let original_len = enum_values.len(); | ||
| for index in 0..original_len { | ||
| if let Some(val) = enum_values[index].as_str() { | ||
| enum_values.push(serde_json::Value::from(format!("!{val}"))); | ||
| } | ||
| } | ||
| } | ||
| schemars::Schema::from(new_obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't compile once the schema feature is on. schema.as_object() gives you a &SchemaObject, and SchemaObject has no get_mut, so cargo check --features schema dies with “no method named get_mut found for struct SchemaObject”. Please stick with the strong-typed API and extend enum_values in-place instead of pretending the schema is a raw JSON map. Example fix:
- let schema = PredefinedSourceMatcher::json_schema(generator);
- if let Some(obj) = schema.as_object() {
- let mut new_obj = obj.clone();
- if let Some(enum_values) = new_obj.get_mut("enum").and_then(|v| v.as_array_mut()) {
- let original_len = enum_values.len();
- for index in 0..original_len {
- if let Some(val) = enum_values[index].as_str() {
- enum_values.push(serde_json::Value::from(format!("!{val}")));
- }
- }
- }
- schemars::Schema::from(new_obj)
- } else {
- schema
- }
+ let mut schema = PredefinedSourceMatcher::json_schema(generator);
+ if let schemars::Schema::Object(schema_obj) = &mut schema {
+ if let Some(enum_values) = schema_obj.enum_values.as_mut() {
+ let additions = enum_values
+ .iter()
+ .filter_map(|value| value.as_str().map(|val| format!("!{val}").into()))
+ .collect::<Vec<_>>();
+ enum_values.extend(additions);
+ }
+ }
+ schemaThe compiler will thank you later.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In crates/biome_rule_options/src/organize_imports/import_groups.rs around lines
324 to 335, the code treats schema.as_object() like a raw JSON map and calls
get_mut on it which fails when the `schema` feature provides a typed
SchemaObject; instead clone or obtain a mutable SchemaObject and manipulate its
enum_values field directly: replace the current obj.clone() + get_mut("enum")
logic with cloning the SchemaObject (e.g. let mut new_obj =
schema.as_object().cloned().unwrap();), then use new_obj.enum_values.as_mut() to
extend the existing Vec<serde_json::Value> by iterating the original length and
pushing the negated string variants (or create a new Vec and set
new_obj.enum_values = Some(new_vec) when none exists), and finally convert with
schemars::Schema::from(new_obj).
| fn json_schema(_generator: &mut schemars::SchemaGenerator) -> schemars::Schema { | ||
| schemars::json_schema!({ | ||
| "oneOf": [ | ||
| { | ||
| "type": "boolean", | ||
| "description": "Whether the hook has a stable result." | ||
| }, | ||
| { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "integer", | ||
| "format": "uint8", | ||
| "minimum": 0, | ||
| "maximum": 255 | ||
| }, | ||
| "minItems": 1, | ||
| "description": "Used to indicate the hook returns an array and some of its indices have stable identities." | ||
| }, | ||
| { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "minItems": 1, | ||
| "description": "Used to indicate the hook returns an object and some of its properties have stable identities." | ||
| } | ||
| ] | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify the minItems: 1 constraint against deserialiser behaviour.
The schema requires at least one item in the array variants (lines 177, 185), but the visit_array method at line 248 accepts empty arrays and deserialises them to StableHookResult::None. This creates a validation mismatch where the deserialiser accepts input that the schema would reject.
Consider either:
- Adding validation to reject empty arrays in the deserialiser, or
- Removing the
minItems: 1constraint from the schema
🏁 Script executed:
#!/bin/bash
# Search for test cases or usages that might clarify the intended behaviour for empty arrays
rg -n -C3 'stable_result.*\[\s*\]' --type rustLength of output: 0
🏁 Script executed:
#!/bin/bash
# Extract the deserializer's visit_array implementation
sed -n '211,249p' crates/biome_rule_options/src/use_exhaustive_dependencies.rsLength of output: 1271
🏁 Script executed:
#!/bin/bash
# Search for how stable_result is used in the codebase
rg -n 'stable_result' --type rust -A2 -B2 | head -50Length of output: 1763
🏁 Script executed:
#!/bin/bash
# Check if there are integration tests or examples that validate this field
fd -e rs -e toml -e json --type f | xargs grep -l 'stable_result\|StableHookResult' | head -20Length of output: 179
🏁 Script executed:
#!/bin/bash
# Check hooks.rs for context on StableHookResult
rg -n -C5 'StableHookResult' crates/biome_js_analyze/src/react/hooks.rs | head -40Length of output: 1394
Remove minItems: 1 from array schema variants.
The schema requires non-empty arrays, but the deserialiser intentionally accepts empty arrays and converts them to StableHookResult::None. This is by design—the consuming code explicitly filters out None values (see line 322 in use_exhaustive_dependencies.rs). The schema constraints at lines 177 and 185 should be removed to reflect the actual behaviour.
🤖 Prompt for AI Agents
In crates/biome_rule_options/src/use_exhaustive_dependencies.rs around lines 162
to 189, the JSON schema currently enforces non-empty arrays via "minItems": 1 on
the two array variants but the deserializer accepts empty arrays (converted to
StableHookResult::None); remove the "minItems": 1 entries from the integer-array
and string-array variants (lines ~177 and ~185) so the schema matches runtime
behavior and allows empty arrays.
dyc3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we just merged a PR that changed how the schema is generated. would you mind fixing the merge conflicts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Oops, almost missed this. This file needs to be renamed to match the rule name.
| #[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 UniqueOperationNameOptions {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This struct too.
|
Yes sorry i failed my previous merge idk what i did, hope its good now |
Summary
Partially implement https://the-guild.dev/graphql/eslint/rules/unique-operation-name
Doesn't check across the whole project.
Test Plan
CI
Docs