Skip to content

Conversation

@denbezrukov
Copy link
Contributor

Summary

Port performance improvement from Ruff. astral-sh/ruff#7048

Refactored formatter to use strict Token element for better performance. The new Token variant is optimized for static, ASCII-only text (keywords, operators, punctuation) with the following constraints:

  • ASCII only (no Unicode characters)
  • No newlines (\n, \r)
  • No tab characters (\t)

This enables faster printing and fitting logic by using bulk string operations (push_str, len()) instead of character-by-character iteration with Unicode width calculations.

The documentation changes were partly written by Claude Code

Test Plan

CI green

Docs

@changeset-bot
Copy link

changeset-bot bot commented Nov 3, 2025

🦋 Changeset detected

Latest commit: edd7a45

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

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

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

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

@github-actions github-actions bot added A-Project Area: project A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS L-JSON Language: JSON and super languages L-HTML Language: HTML L-Grit Language: GritQL A-Type-Inference Area: type inference labels Nov 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 50901 50901 0
Passed 49697 49697 0
Failed 1162 1162 0
Panics 42 42 0
Coverage 97.63% 97.63% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6320 6320 0
Passed 2106 2106 0
Failed 4214 4214 0
Panics 0 0 0
Coverage 33.32% 33.32% 0.00%

ts/babel

Test result main count This PR count Difference
Total 835 835 0
Passed 742 742 0
Failed 93 93 0
Panics 0 0 0
Coverage 88.86% 88.86% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18813 18813 0
Passed 14065 14065 0
Failed 4747 4747 0
Panics 1 1 0
Coverage 74.76% 74.76% 0.00%

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 3, 2025

CodSpeed Performance Report

Merging #7968 will not alter performance

Comparing dbezrukov/token-formatter (edd7a45) with main (547c2da)1

Summary

✅ 53 untouched
⏩ 85 skipped2

Footnotes

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

  2. 85 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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

The PR renames and reshapes the formatter's textual primitives across the workspace: StaticTextToken for ASCII-only static fragments, DynamicTextText for owned/dynamic content with source positions, and corresponding helper functions (text()/token() and dynamic_text()text()) are updated. Calls in all language formatters and formatter internals were migrated to use the new variants and helpers; punctuation and punctuation-emission paths were switched to token(...) where appropriate. No behavioural control-flow changes were introduced; most edits are API/representation and documentation/example updates.

Possibly related PRs

Suggested labels

A-Tooling

Suggested reviewers

  • ematipico
  • dyc3
  • arendjr

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title 'refactor(formatter): introduce Token element' directly and clearly describes the main change in the changeset. It uses the conventional commit format and accurately summarises the primary refactoring effort—introducing a new Token element to the formatter. The title is concise, specific, and allows readers scanning history to immediately understand the core change.
Description check ✅ Passed The pull request description is comprehensive and directly related to the changeset. It explains the motivation (porting performance improvements from Ruff), the purpose of the Token element (optimised for static ASCII-only text), key constraints (no Unicode, newlines, or tabs), and performance benefits (bulk string operations instead of character-by-character iteration). The description clearly connects to the extensive changes across multiple formatter modules and provides context for reviewers.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dbezrukov/token-formatter

📜 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 eed542b and edd7a45.

📒 Files selected for processing (66)
  • .changeset/lemon-planes-knock.md (1 hunks)
  • crates/biome_css_formatter/src/comments.rs (2 hunks)
  • crates/biome_css_formatter/src/css/auxiliary/declaration_with_semicolon.rs (1 hunks)
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs (1 hunks)
  • crates/biome_css_formatter/src/lib.rs (1 hunks)
  • crates/biome_css_formatter/src/utils/string_utils.rs (2 hunks)
  • crates/biome_css_formatter/src/verbatim.rs (2 hunks)
  • crates/biome_css_semantic/src/format_semantic_model.rs (3 hunks)
  • crates/biome_formatter/src/arguments.rs (2 hunks)
  • crates/biome_formatter/src/buffer.rs (8 hunks)
  • crates/biome_formatter/src/builders.rs (53 hunks)
  • crates/biome_formatter/src/format_element.rs (4 hunks)
  • crates/biome_formatter/src/format_element/document.rs (23 hunks)
  • crates/biome_formatter/src/format_extensions.rs (3 hunks)
  • crates/biome_formatter/src/formatter.rs (4 hunks)
  • crates/biome_formatter/src/lib.rs (5 hunks)
  • crates/biome_formatter/src/macros.rs (11 hunks)
  • crates/biome_formatter/src/printer/mod.rs (30 hunks)
  • crates/biome_formatter/src/separated.rs (1 hunks)
  • crates/biome_formatter/src/source_map.rs (1 hunks)
  • crates/biome_graphql_formatter/src/comments.rs (2 hunks)
  • crates/biome_graphql_formatter/src/graphql/auxiliary/union_member_types.rs (1 hunks)
  • crates/biome_graphql_formatter/src/graphql/lists/argument_definition_list.rs (1 hunks)
  • crates/biome_graphql_formatter/src/graphql/lists/argument_list.rs (1 hunks)
  • crates/biome_graphql_formatter/src/graphql/lists/list_value_element_list.rs (1 hunks)
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs (1 hunks)
  • crates/biome_graphql_formatter/src/graphql/lists/variable_definition_list.rs (1 hunks)
  • crates/biome_graphql_formatter/src/graphql/value/string_value.rs (4 hunks)
  • crates/biome_graphql_formatter/src/verbatim.rs (2 hunks)
  • crates/biome_grit_formatter/src/comments.rs (3 hunks)
  • crates/biome_grit_formatter/src/verbatim.rs (2 hunks)
  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs (1 hunks)
  • crates/biome_html_formatter/src/html/auxiliary/string.rs (1 hunks)
  • crates/biome_html_formatter/src/utils/children.rs (1 hunks)
  • crates/biome_html_formatter/src/utils/formatters.rs (1 hunks)
  • crates/biome_html_formatter/src/verbatim.rs (2 hunks)
  • crates/biome_js_formatter/src/comments.rs (2 hunks)
  • crates/biome_js_formatter/src/context/trailing_commas.rs (2 hunks)
  • crates/biome_js_formatter/src/js/classes/extends_clause.rs (1 hunks)
  • crates/biome_js_formatter/src/js/expressions/arrow_function_expression.rs (8 hunks)
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs (1 hunks)
  • crates/biome_js_formatter/src/js/expressions/new_expression.rs (1 hunks)
  • crates/biome_js_formatter/src/js/expressions/unary_expression.rs (1 hunks)
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs (1 hunks)
  • crates/biome_js_formatter/src/js/statements/labeled_statement.rs (1 hunks)
  • crates/biome_js_formatter/src/js/statements/return_statement.rs (1 hunks)
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs (2 hunks)
  • crates/biome_js_formatter/src/lib.rs (1 hunks)
  • crates/biome_js_formatter/src/ts/declarations/external_module_declaration.rs (1 hunks)
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs (1 hunks)
  • crates/biome_js_formatter/src/ts/lists/type_member_list.rs (1 hunks)
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs (1 hunks)
  • crates/biome_js_formatter/src/ts/types/union_type.rs (2 hunks)
  • crates/biome_js_formatter/src/utils/array.rs (1 hunks)
  • crates/biome_js_formatter/src/utils/conditional.rs (2 hunks)
  • crates/biome_js_formatter/src/utils/jsx.rs (1 hunks)
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs (1 hunks)
  • crates/biome_js_formatter/src/utils/mod.rs (1 hunks)
  • crates/biome_js_formatter/src/utils/test_each_template.rs (3 hunks)
  • crates/biome_js_formatter/src/verbatim.rs (2 hunks)
  • crates/biome_js_semantic/src/format_semantic_model.rs (5 hunks)
  • crates/biome_js_type_info/src/format_type_info.rs (46 hunks)
  • crates/biome_jsdoc_comment/src/format_jsdoc_comment.rs (1 hunks)
  • crates/biome_json_formatter/src/comments.rs (2 hunks)
  • crates/biome_json_formatter/src/verbatim.rs (2 hunks)
  • crates/biome_module_graph/src/format_module_graph.rs (15 hunks)
✅ Files skipped from review due to trivial changes (1)
  • crates/biome_formatter/src/buffer.rs
🚧 Files skipped from review as they are similar to previous changes (35)
  • crates/biome_css_formatter/src/comments.rs
  • crates/biome_js_formatter/src/js/statements/labeled_statement.rs
  • crates/biome_json_formatter/src/comments.rs
  • crates/biome_js_formatter/src/js/statements/return_statement.rs
  • crates/biome_js_formatter/src/ts/lists/type_member_list.rs
  • crates/biome_formatter/src/format_extensions.rs
  • crates/biome_grit_formatter/src/verbatim.rs
  • crates/biome_graphql_formatter/src/graphql/lists/list_value_element_list.rs
  • crates/biome_css_semantic/src/format_semantic_model.rs
  • crates/biome_formatter/src/lib.rs
  • crates/biome_js_formatter/src/verbatim.rs
  • crates/biome_js_formatter/src/utils/array.rs
  • crates/biome_js_formatter/src/lib.rs
  • crates/biome_js_formatter/src/comments.rs
  • crates/biome_formatter/src/arguments.rs
  • crates/biome_graphql_formatter/src/graphql/lists/argument_list.rs
  • crates/biome_formatter/src/formatter.rs
  • crates/biome_js_formatter/src/js/expressions/new_expression.rs
  • crates/biome_js_semantic/src/format_semantic_model.rs
  • crates/biome_jsdoc_comment/src/format_jsdoc_comment.rs
  • crates/biome_js_formatter/src/utils/test_each_template.rs
  • crates/biome_html_formatter/src/utils/children.rs
  • crates/biome_js_formatter/src/utils/mod.rs
  • crates/biome_js_formatter/src/js/expressions/arrow_function_expression.rs
  • crates/biome_css_formatter/src/utils/string_utils.rs
  • crates/biome_js_formatter/src/ts/declarations/external_module_declaration.rs
  • crates/biome_js_formatter/src/ts/types/union_type.rs
  • crates/biome_formatter/src/source_map.rs
  • crates/biome_css_formatter/src/verbatim.rs
  • crates/biome_graphql_formatter/src/graphql/lists/argument_definition_list.rs
  • crates/biome_js_formatter/src/utils/conditional.rs
  • crates/biome_css_formatter/src/lib.rs
  • crates/biome_json_formatter/src/verbatim.rs
  • crates/biome_graphql_formatter/src/graphql/lists/variable_definition_list.rs
  • crates/biome_graphql_formatter/src/graphql/auxiliary/union_member_types.rs
🧰 Additional context used
📓 Path-based instructions (5)
crates/biome_js_formatter/**/*.rs

📄 CodeRabbit inference engine (crates/biome_js_formatter/CONTRIBUTING.md)

crates/biome_js_formatter/**/*.rs: Implement the Format trait for your node type and use JsFormatter with write!/format_args! to define formatting
Import and use the FormatNode trait 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, return None instead
Use dbg_write! to debug and inspect the emitted IR during formatting

Files:

  • crates/biome_js_formatter/src/js/classes/extends_clause.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.rs
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files before committing (e.g., via just f)

Files:

  • crates/biome_js_formatter/src/js/classes/extends_clause.rs
  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_css_formatter/src/css/auxiliary/declaration_with_semicolon.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_graphql_formatter/src/graphql/value/string_value.rs
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/format_element.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.rs
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Document rules, assists, and their options with inline rustdoc in the Rust source

Files:

  • crates/biome_js_formatter/src/js/classes/extends_clause.rs
  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_css_formatter/src/css/auxiliary/declaration_with_semicolon.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_graphql_formatter/src/graphql/value/string_value.rs
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/format_element.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.rs
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/*.md: In changeset files, only use #### or ##### headers
Changesets should describe user-facing changes; internal-only changes do not need changesets
Use past tense for what you did in the changeset description and present tense for current behavior
For bug fixes, start the changeset description with a link to the issue (e.g., Fixed #1234: ...)
When referencing a rule or assist in a changeset, include a link to the rule/assist page on the website
Include a code block in the changeset when applicable to illustrate the change
End every sentence in a changeset with a full stop (.)

Files:

  • .changeset/lemon-planes-knock.md
crates/biome_formatter/src/**/*.rs

📄 CodeRabbit inference engine (crates/biome_formatter/CONTRIBUTING.md)

After generation, remove usages of format_verbatim_node and implement real formatting with biome_formatter utilities

Files:

  • crates/biome_formatter/src/macros.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/format_element.rs
  • crates/biome_formatter/src/printer/mod.rs
🧠 Learnings (42)
📓 Common learnings
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
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`)
📚 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_formatter/src/js/classes/extends_clause.rs
  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • .changeset/lemon-planes-knock.md
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_css_formatter/src/css/auxiliary/declaration_with_semicolon.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_graphql_formatter/src/graphql/value/string_value.rs
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/format_element.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.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 : Do not attempt to fix code; if a mandatory token/node is missing, return `None` instead

Applied to files:

  • crates/biome_js_formatter/src/js/classes/extends_clause.rs
  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • .changeset/lemon-planes-knock.md
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_css_formatter/src/css/auxiliary/declaration_with_semicolon.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/graphql/value/string_value.rs
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/format_element.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.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_js_formatter/src/js/classes/extends_clause.rs
  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • .changeset/lemon-planes-knock.md
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_css_formatter/src/css/auxiliary/declaration_with_semicolon.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_graphql_formatter/src/graphql/value/string_value.rs
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/format_element.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.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 : Import and use the `FormatNode` trait for AST nodes

Applied to files:

  • crates/biome_js_formatter/src/js/classes/extends_clause.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • .changeset/lemon-planes-knock.md
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_graphql_formatter/src/graphql/value/string_value.rs
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/format_element.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.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_formatter/src/js/classes/extends_clause.rs
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_formatter/src/format_element.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_js_formatter/src/js/classes/extends_clause.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.rs
📚 Learning: 2025-10-24T21:24:58.650Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-24T21:24:58.650Z
Learning: Applies to crates/biome_analyze/crates/*_analyze/**/src/**/lint/**/*.rs : Set the language field in declare_lint_rule! to the most appropriate dialect (js/jsx/ts/tsx)

Applied to files:

  • crates/biome_js_formatter/src/js/classes/extends_clause.rs
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_css_formatter/src/css/auxiliary/declaration_with_semicolon.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.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_formatter/src/js/classes/extends_clause.rs
  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • .changeset/lemon-planes-knock.md
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_css_formatter/src/css/auxiliary/declaration_with_semicolon.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_graphql_formatter/src/graphql/value/string_value.rs
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/format_element.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.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/context.rs : Create HtmlFormatContext in context.rs with comments and source_map fields and implement FormatContext and CstFormatContext

Applied to files:

  • crates/biome_js_formatter/src/js/classes/extends_clause.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.rs
  • crates/biome_formatter/src/printer/mod.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_formatter/src/js/classes/extends_clause.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_module_graph/src/format_module_graph.rs
📚 Learning: 2025-10-24T21:24:58.650Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-24T21:24:58.650Z
Learning: Applies to crates/biome_analyze/crates/*_analyze/**/src/**/lint/**/*.rs : Avoid avoidable string allocations; compare against &str or TokenText rather than allocating Strings

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • crates/biome_js_formatter/src/utils/jsx.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_graphql_formatter/src/graphql/value/string_value.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/format_element.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.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/cst.rs : Create FormatHtmlSyntaxNode in cst.rs implementing FormatRule<HtmlSyntaxNode> and AsFormat/IntoFormat for HtmlSyntaxNode using the provided plumbing

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/printer/mod.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 : Implement FormatLanguage for HtmlFormatLanguage with associated types: SyntaxLanguage=HtmlLanguage, Context=HtmlFormatContext, FormatRule=FormatHtmlSyntaxNode

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/format_element.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.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/comments.rs : Define HtmlCommentStyle implementing CommentStyle in comments.rs

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.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/comments.rs : Expose a public HtmlComments type alias: `pub type HtmlComments = Comments<HtmlLanguage>;`

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_js_formatter/src/js/expressions/unary_expression.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/tests/language.rs : Create tests/language.rs defining `HtmlTestFormatLanguage` and implement the TestFormatLanguage trait

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_html_formatter/src/utils/formatters.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/format_element.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 : Use `dbg_write!` to debug and inspect the emitted IR during formatting

Applied to files:

  • crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs
  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_js_formatter/src/js/statements/expression_statement.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_module_graph/src/format_module_graph.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:

  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_formatter/src/separated.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.rs
📚 Learning: 2025-10-26T15:28:00.951Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-10-26T15:28:00.951Z
Learning: Applies to **/*.rs : Document rules, assists, and their options with inline rustdoc in the Rust source

Applied to files:

  • crates/biome_grit_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/comments.rs
📚 Learning: 2025-10-24T21:24:58.650Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-24T21:24:58.650Z
Learning: Applies to crates/biome_analyze/crates/biome_rule_options/lib/**/*.rs : Prefer Box<[Box<str>]> over Vec<String> for options string lists to reduce memory usage

Applied to files:

  • crates/biome_js_formatter/src/utils/member_chain/groups.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_graphql_formatter/src/graphql/value/string_value.rs
  • crates/biome_html_formatter/src/html/auxiliary/string.rs
📚 Learning: 2025-10-26T15:28:00.951Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-10-26T15:28:00.951Z
Learning: Applies to .changeset/*.md : Changesets should describe user-facing changes; internal-only changes do not need changesets

Applied to files:

  • .changeset/lemon-planes-knock.md
📚 Learning: 2025-10-24T21:24:58.650Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-24T21:24:58.650Z
Learning: Applies to crates/biome_analyze/crates/*_analyze/**/src/**/lint/**/*.rs : Rule documentation: first paragraph must be a single line summary

Applied to files:

  • crates/biome_graphql_formatter/src/comments.rs
📚 Learning: 2025-10-24T21:24:58.650Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-24T21:24:58.650Z
Learning: Applies to crates/biome_analyze/crates/*_analyze/**/src/**/lint/**/*.rs : Avoid deep indentation by using combinators (map, filter, and_then) rather than nested if-let/unwrap chains

Applied to files:

  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
📚 Learning: 2025-10-24T21:24:58.650Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-24T21:24:58.650Z
Learning: Applies to crates/biome_analyze/crates/*_analyze/**/src/**/lint/**/*.rs : Use options/full_options/use_options code block modifiers as specified to demonstrate configuration in docs; keep modifier order consistent

Applied to files:

  • crates/biome_graphql_formatter/src/comments.rs
  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_formatter/src/separated.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 : Expose a documented public function `format_node(options: HtmlFormatOptions, root: &HtmlSyntaxNode) -> FormatResult<Formatted<HtmlFormatContext>>` delegating to `biome_formatter::format_node`

Applied to files:

  • crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs
  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_formatter/src/printer/mod.rs
  • crates/biome_module_graph/src/format_module_graph.rs
📚 Learning: 2025-10-25T07:22:18.540Z
Learnt from: ematipico
Repo: biomejs/biome PR: 7852
File: crates/biome_css_parser/src/syntax/property/mod.rs:161-168
Timestamp: 2025-10-25T07:22:18.540Z
Learning: In the Biome CSS parser, lexer token emission should not be gated behind parser options like `is_tailwind_directives_enabled()`. The lexer must emit correct tokens regardless of parser options to enable accurate diagnostics and error messages when the syntax is used incorrectly.

Applied to files:

  • crates/biome_css_formatter/src/css/auxiliary/declaration_with_semicolon.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 : Define the HtmlFormatter type alias: `type HtmlFormatter<'buf> = Formatter<'buf, HtmlFormatContext>;`

Applied to files:

  • crates/biome_js_formatter/src/context/trailing_commas.rs
  • crates/biome_graphql_formatter/src/verbatim.rs
  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_module_graph/src/format_module_graph.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_html_formatter/src/verbatim.rs
📚 Learning: 2025-09-13T16:16:06.459Z
Learnt from: ematipico
Repo: biomejs/biome PR: 7467
File: crates/biome_service/src/file_handlers/html.rs:456-466
Timestamp: 2025-09-13T16:16:06.459Z
Learning: The biome_formatter printer deduplicates consecutive LineMode::Hard elements by checking if the current line is already empty (line_width > 0) before printing a newline. This prevents multiple consecutive hard line breaks from creating extra blank lines in the output.

Applied to files:

  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_formatter/src/printer/mod.rs
📚 Learning: 2025-09-13T16:16:06.459Z
Learnt from: ematipico
Repo: biomejs/biome PR: 7467
File: crates/biome_service/src/file_handlers/html.rs:456-466
Timestamp: 2025-09-13T16:16:06.459Z
Learning: In biome_formatter, the printer correctly handles consecutive LineMode::Hard elements without creating extra blank lines. Multiple consecutive FormatElement::Line(LineMode::Hard) elements in the formatting code do not result in duplicate blank lines in the output because the printer has logic to track line states and handle indentation properly.

Applied to files:

  • crates/biome_html_formatter/src/verbatim.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_formatter/src/printer/mod.rs
📚 Learning: 2025-10-03T12:28:56.788Z
Learnt from: ematipico
Repo: biomejs/biome PR: 7670
File: crates/biome_service/src/file_handlers/html.rs:744-748
Timestamp: 2025-10-03T12:28:56.788Z
Learning: In Biome's codebase, when creating tokens with new text content, use the factory pattern with functions like `ident(text)` from the respective `*_factory` crates (e.g., `biome_html_factory::make::ident`). There is no `.with_text()` method on tokens. The `ident()` function creates a new detached token with the IDENT kind, which is the standard approach for token construction.

Applied to files:

  • crates/biome_css_formatter/src/css/value/url_value_raw.rs
  • crates/biome_formatter/src/macros.rs
  • crates/biome_js_type_info/src/format_type_info.rs
  • crates/biome_formatter/src/format_element/document.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_formatter/src/format_element.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/tests/spec_tests.rs : In tests/spec_tests.rs, generate tests with `tests_macros::gen_tests! {"tests/specs/html/**/*.html", crate::spec_test::run, ""}`

Applied to files:

  • crates/biome_formatter/src/macros.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/tests/spec_test.rs : Implement a `run` function in tests/spec_test.rs that wires SpecSnapshot and includes!("language.rs") as shown

Applied to files:

  • crates/biome_formatter/src/macros.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/tests/** : Create a tests directory containing a specs subfolder and the files spec_test.rs, spec_tests.rs, and language.rs

Applied to files:

  • crates/biome_formatter/src/macros.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}.rs : When inference is missing or cannot determine a type, use TypeData::Unknown; use TypeData::UnknownKeyword only when the user explicitly wrote unknown.

Applied to files:

  • crates/biome_js_type_info/src/format_type_info.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_js_type_info/src/format_type_info.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: When using ResolvedTypeData.as_raw_data(), ensure subsequent resolutions carry the correct ResolverId; do not use raw TypeData with a resolver without explicitly applying the right ResolverId to avoid panics.

Applied to files:

  • crates/biome_js_type_info/src/format_type_info.rs
📚 Learning: 2025-09-13T16:16:06.459Z
Learnt from: ematipico
Repo: biomejs/biome PR: 7467
File: crates/biome_service/src/file_handlers/html.rs:456-466
Timestamp: 2025-09-13T16:16:06.459Z
Learning: In biome_formatter, consecutive LineMode::Hard elements are automatically collapsed to a single newline by the printer. The printer has a test "it_prints_consecutive_hard_lines_as_one" that demonstrates this behavior - multiple consecutive hard line breaks result in only one newline in the output, not extra blank lines.

Applied to files:

  • crates/biome_formatter/src/printer/mod.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:

  • crates/biome_module_graph/src/format_module_graph.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_module_graph/src/format_module_graph.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:

  • crates/biome_module_graph/src/format_module_graph.rs
🧬 Code graph analysis (28)
crates/biome_js_formatter/src/js/classes/extends_clause.rs (1)
crates/biome_formatter/src/builders.rs (3)
  • token (251-259)
  • if_group_breaks (1943-1952)
  • soft_block_indent (1260-1265)
crates/biome_html_formatter/src/html/auxiliary/self_closing_element.rs (1)
crates/biome_formatter/src/builders.rs (1)
  • token (251-259)
crates/biome_js_formatter/src/jsx/expressions/tag_expression.rs (1)
crates/biome_formatter/src/builders.rs (2)
  • if_group_breaks (1943-1952)
  • token (251-259)
crates/biome_grit_formatter/src/comments.rs (1)
crates/biome_formatter/src/builders.rs (1)
  • text (279-283)
crates/biome_js_formatter/src/utils/member_chain/groups.rs (1)
crates/biome_formatter/src/builders.rs (1)
  • token (251-259)
crates/biome_js_formatter/src/utils/jsx.rs (1)
crates/biome_formatter/src/builders.rs (1)
  • token (251-259)
crates/biome_graphql_formatter/src/comments.rs (3)
crates/biome_formatter/src/lib.rs (1)
  • write (1428-1435)
crates/biome_formatter/src/builders.rs (2)
  • text (279-283)
  • hard_line_break (99-101)
crates/biome_formatter/src/source_map.rs (1)
  • source_offset (155-172)
crates/biome_graphql_formatter/src/graphql/lists/object_value_member_list.rs (1)
crates/biome_formatter/src/builders.rs (3)
  • if_group_fits_on_line (2024-2033)
  • token (251-259)
  • space (606-608)
crates/biome_css_formatter/src/css/auxiliary/declaration_with_semicolon.rs (1)
crates/biome_formatter/src/builders.rs (1)
  • token (251-259)
crates/biome_js_formatter/src/context/trailing_commas.rs (1)
crates/biome_formatter/src/builders.rs (2)
  • if_group_breaks (1943-1952)
  • token (251-259)
crates/biome_graphql_formatter/src/verbatim.rs (1)
crates/biome_formatter/src/builders.rs (1)
  • text (279-283)
crates/biome_graphql_formatter/src/graphql/value/string_value.rs (3)
crates/biome_js_syntax/src/generated/nodes.rs (1)
  • string_token (12483-12485)
crates/biome_formatter/src/formatter.rs (1)
  • join (73-75)
crates/biome_formatter/src/builders.rs (3)
  • token (251-259)
  • hard_line_break (99-101)
  • text (279-283)
crates/biome_js_formatter/src/js/expressions/bigint_literal_expression.rs (1)
crates/biome_formatter/src/builders.rs (1)
  • text (279-283)
crates/biome_html_formatter/src/verbatim.rs (1)
crates/biome_formatter/src/builders.rs (1)
  • text (279-283)
crates/biome_html_formatter/src/html/auxiliary/string.rs (1)
crates/biome_formatter/src/builders.rs (2)
  • token (251-259)
  • located_token_text (358-371)
crates/biome_css_formatter/src/css/value/url_value_raw.rs (2)
crates/biome_rowan/src/syntax/token.rs (1)
  • token_text (121-123)
crates/biome_formatter/src/builders.rs (1)
  • text (279-283)
crates/biome_js_formatter/src/ts/types/bigint_literal_type.rs (1)
crates/biome_formatter/src/builders.rs (1)
  • text (279-283)
crates/biome_formatter/src/macros.rs (3)
crates/biome_formatter/src/lib.rs (1)
  • write (1428-1435)
crates/biome_formatter/src/builders.rs (8)
  • token (251-259)
  • text (279-283)
  • space (606-608)
  • group (1760-1766)
  • soft_line_break (67-69)
  • soft_block_indent (1260-1265)
  • should_expand (1787-1790)
  • hard_line_break (99-101)
crates/biome_formatter/src/buffer.rs (1)
  • into_vec (197-199)
crates/biome_js_type_info/src/format_type_info.rs (2)
crates/biome_formatter/src/lib.rs (3)
  • write (1428-1435)
  • format (1468-1484)
  • fmt (125-130)
crates/biome_formatter/src/builders.rs (9)
  • token (251-259)
  • text (279-283)
  • space (606-608)
  • block_indent (1189-1194)
  • hard_line_break (99-101)
  • format_with (2304-2312)
  • soft_block_indent (1260-1265)
  • soft_line_break_or_space (188-190)
  • soft_line_break (67-69)
crates/biome_js_formatter/src/js/statements/expression_statement.rs (2)
crates/biome_formatter/src/lib.rs (1)
  • write (1428-1435)
crates/biome_formatter/src/builders.rs (1)
  • token (251-259)
crates/biome_js_formatter/src/ts/expressions/type_assertion_expression.rs (1)
crates/biome_formatter/src/builders.rs (2)
  • token (251-259)
  • block_indent (1189-1194)
crates/biome_formatter/src/format_element/document.rs (1)
crates/biome_formatter/src/builders.rs (6)
  • text (279-283)
  • token (251-259)
  • soft_line_break_or_space (188-190)
  • space (606-608)
  • group (1760-1766)
  • soft_block_indent (1260-1265)
crates/biome_html_formatter/src/utils/formatters.rs (1)
crates/biome_formatter/src/builders.rs (1)
  • text (279-283)
crates/biome_formatter/src/separated.rs (1)
crates/biome_formatter/src/builders.rs (4)
  • if_group_breaks (1943-1952)
  • token (251-259)
  • with_group_id (1776-1779)
  • with_group_id (2096-2099)
crates/biome_formatter/src/format_element.rs (2)
crates/biome_formatter/src/format_element/document.rs (4)
  • fmt (212-222)
  • fmt (274-630)
  • fmt (636-646)
  • fmt (652-661)
crates/biome_formatter/src/builders.rs (1)
  • text (279-283)
crates/biome_js_formatter/src/js/expressions/unary_expression.rs (1)
crates/biome_formatter/src/builders.rs (2)
  • token (251-259)
  • soft_block_indent (1260-1265)
crates/biome_formatter/src/printer/mod.rs (1)
crates/biome_formatter/src/builders.rs (2)
  • text (279-283)
  • token (251-259)
crates/biome_module_graph/src/format_module_graph.rs (2)
crates/biome_formatter/src/lib.rs (2)
  • write (1428-1435)
  • format (1468-1484)
crates/biome_formatter/src/builders.rs (7)
  • token (251-259)
  • format_with (2304-2312)
  • space (606-608)
  • group (1760-1766)
  • block_indent (1189-1194)
  • hard_line_break (99-101)
  • text (279-283)
⏰ 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). (19)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test Node.js API
  • GitHub Check: Parser conformance
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_formatter)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
crates/biome_css_formatter/src/verbatim.rs (1)

117-121: text panics on multi-line verbatim content

builders::text calls debug_assert_no_newlines, but verbatim chunks routinely include \n even after normalize_newlines. The first multiline suppressed CSS node will now trip the assert. Please stick with a newline-tolerant code path (e.g. keep the old constructor or split the content before passing it to text).

crates/biome_graphql_formatter/src/verbatim.rs (1)

118-122: Same newline assertion issue as the CSS verbatim printer

text(..) rejects strings containing line terminators, yet GraphQL verbatim nodes are often multi-line. This will assert in debug builds. Please keep using a constructor that tolerates newlines (or split the content) before landing this refactor.

🧹 Nitpick comments (4)
.changeset/lemon-planes-knock.md (1)

7-9: Add full stops to list items for consistency.

The guideline requires ending every sentence in a changeset with a full stop. The constraint list items should end with periods:

- ASCII only (no Unicode characters)
- No newlines (`\n`, `\r`)
- No tab characters (`\t`)
+ ASCII only (no Unicode characters).
+ No newlines (`\n`, `\r`).
+ No tab characters (`\t`).
crates/biome_module_graph/src/format_module_graph.rs (1)

126-126: Inconsistent path qualification.

The fully-qualified path is unnecessary here since biome_formatter::prelude::* is imported at line 3. Use token("=>") to match the rest of the file.

Apply this diff:

-                        biome_formatter::prelude::token("=>"),
+                        token("=>"),
crates/biome_css_semantic/src/format_semantic_model.rs (1)

128-137: Verify the to_string().as_str() pattern.

Whilst CI is green, the pattern self.0.to_string().as_str() (lines 129, 132, 135) typically creates lifetime issues in Rust, as the temporary String is dropped whilst still borrowed. If the write! macro handles this specially, it might be worth documenting. Otherwise, consider binding to variables:

let s0 = self.0.to_string();
let s1 = self.1.to_string();
let s2 = self.2.to_string();
write!(
    f,
    [
        token("("),
        text(s0.as_str(), TextSize::default()),
        token(","),
        space(),
        text(s1.as_str(), TextSize::default()),
        token(","),
        space(),
        text(s2.as_str(), TextSize::default()),
        token(")")
    ]
)
crates/biome_formatter/src/macros.rs (1)

91-91: Tidy the dbg example to match the new variant name

We no longer print StaticToken. Let’s update the blurb so future readers aren’t chasing ghosts.

-/// // ^-- prints: [src/main.rs:7][0] = StaticToken("Hello")
+/// // ^-- prints: [src/main.rs:7][0] = Token("Hello")

@denbezrukov denbezrukov force-pushed the dbezrukov/token-formatter branch from e528443 to 5525b72 Compare November 3, 2025 14:30
@denbezrukov denbezrukov force-pushed the dbezrukov/token-formatter branch from 5525b72 to a58e46a Compare November 3, 2025 14:32
@denbezrukov denbezrukov changed the title refactor(formatter): Introduce Token element refactor(formatter): introduce Token element Nov 3, 2025
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

This PR might generate conflicts really fast considering how many changes. If everything is green, I'm happy to merge it! The new changes look good to me

@denbezrukov
Copy link
Contributor Author

@ematipico
I'm wondering that I don't see any performance changes in CodSpeed, but the PR is also the first part of 3 PRs and it's easier to port if we have this one, what do you think?
The next one is astral-sh/ruff#6552

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Formatter Area: formatter A-Project Area: project A-Type-Inference Area: type inference L-CSS Language: CSS L-Grit Language: GritQL L-HTML Language: HTML L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants