Skip to content

Conversation

@cadunass
Copy link
Contributor

@cadunass cadunass commented Oct 9, 2025

Summary

This PR exposes the formatWithErrors configuration option via CLI flag.

Closes #7706

The flag was previously hidden (#[bpaf(hide)]) but functional. This PR exposes it by:

  • Changing #[bpaf(hide)] to #[bpaf(long("format-with-errors"), argument("true|false"))]
  • Configuration merging was already handled correctly by existing code
  • Added tests to verify the flag works as expected

@changeset-bot
Copy link

changeset-bot bot commented Oct 9, 2025

🦋 Changeset detected

Latest commit: 558586c

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

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

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-CLI Area: CLI A-Project Area: project labels Oct 9, 2025
@cadunass cadunass marked this pull request as ready for review October 9, 2025 04:11
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Walkthrough

Introduces CLI support for the formatter option via a new --format-with-errors flag, enabling formatting even when syntax errors are present. Updates the formatter configuration to expose this flag through bpaf. Adds tests for both format and check commands to validate behaviour when the flag is enabled, asserting file rewriting and capturing snapshots. Includes a changeset for @biomejs/biome indicating a minor version update and documenting the new flag with example usage. No changes to exported/public entity declarations.

Suggested labels

A-Formatter

Suggested reviewers

  • ematipico
  • siketyan

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly summarizes the primary change of exposing the formatWithErrors option via the new CLI flag and clearly matches the modified code and tests.
Linked Issues Check ✅ Passed The pull request implements the explicit long option in the bpaf derive, confirms configuration merging remains functional, and adds tests for both check and format commands, fully satisfying issue #7706.
Out of Scope Changes Check ✅ Passed All modifications directly relate to exposing the formatWithErrors flag, its integration, and test coverage, with no unrelated or extraneous changes detected.
Description Check ✅ Passed The description accurately describes the added CLI flag, attribute change, and test additions, and references the related issue without any unrelated content.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 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 676e130 and 558586c.

⛔ Files ignored due to path filters (5)
  • crates/biome_cli/tests/snapshots/main_commands_check/check_format_with_syntax_errors_when_flag_enabled.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_commands_check/check_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_commands_ci/ci_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_commands_format/format_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_commands_format/should_format_file_with_syntax_errors_when_flag_enabled.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (4)
  • .changeset/icy-views-lick.md (1 hunks)
  • crates/biome_cli/tests/commands/check.rs (1 hunks)
  • crates/biome_cli/tests/commands/format.rs (1 hunks)
  • crates/biome_configuration/src/formatter.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • crates/biome_configuration/src/formatter.rs
  • crates/biome_cli/tests/commands/format.rs
  • .changeset/icy-views-lick.md
🧰 Additional context used
📓 Path-based instructions (4)
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_cli/tests/commands/check.rs
**/tests/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place test files under a tests/ directory in each crate

Files:

  • crates/biome_cli/tests/commands/check.rs
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Before committing, format Rust and TOML files (e.g., via just f/just format)

Files:

  • crates/biome_cli/tests/commands/check.rs
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Document rules, assists, and options via inline rustdoc in Rust source

Files:

  • crates/biome_cli/tests/commands/check.rs
🧬 Code graph analysis (1)
crates/biome_cli/tests/commands/check.rs (3)
crates/biome_fs/src/fs/memory.rs (1)
  • default (37-49)
crates/biome_cli/tests/main.rs (1)
  • run_cli (332-347)
crates/biome_cli/tests/snap_test.rs (1)
  • assert_file_contents (438-449)
🔇 Additional comments (1)
crates/biome_cli/tests/commands/check.rs (1)

3255-3288: LGTM! Test correctly validates the --format-with-errors flag behaviour.

The test properly verifies that:

  • Formatting occurs despite syntax errors when the flag is enabled
  • The command still returns an error to report the syntax issue
  • The file is rewritten with formatted content

This aligns with the PR objectives and follows the established test patterns in the file.


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

As per contribution guidelines, this PR must be sent to next

@cadunass cadunass changed the base branch from main to next October 9, 2025 11:11
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

📜 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 6c76661 and 60544a3.

📒 Files selected for processing (1)
  • .changeset/icy-views-lick.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/**/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/**/*.md: Create changesets using the just new-changeset command; do not author them manually
In changeset markdown, only use headers #### or #####
Changeset descriptions must end every sentence with a full stop (.)
For bug fixes, start the changeset description with a linked issue reference like “Fixed #1234
Prefer past tense for what was done and present tense for current behavior in changesets

Files:

  • .changeset/icy-views-lick.md

@github-actions github-actions bot added A-Linter Area: linter A-Parser Area: parser L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS A-Diagnostic Area: diagnostocis labels Oct 9, 2025
@cadunass cadunass force-pushed the feat/expose-format-with-errors-cli branch from 676e130 to 5da1c2f Compare October 9, 2025 11:21
cadunass and others added 2 commits October 9, 2025 08:29
The formatWithErrors option can now be set via CLI using the --format-with-errors flag.
This flag was previously only available in the configuration file.
@cadunass cadunass force-pushed the feat/expose-format-with-errors-cli branch from 5da1c2f to 860b6da Compare October 9, 2025 11:30
@github-actions github-actions bot removed A-Linter Area: linter A-Parser Area: parser L-CSS Language: CSS A-Diagnostic Area: diagnostocis labels Oct 9, 2025
@cadunass cadunass requested a review from ematipico October 9, 2025 11:51
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 9, 2025

CodSpeed Performance Report

Merging #7719 will not alter performance

Comparing cadunass:feat/expose-format-with-errors-cli (558586c) with next (3b6f5e3)

Summary

✅ 1 untouched
⏩ 139 skipped1

Footnotes

  1. 139 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.

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.

Thank you!

@ematipico ematipico merged commit 188a767 into biomejs:next Oct 9, 2025
12 of 14 checks passed
@github-actions github-actions bot mentioned this pull request Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Project Area: project L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

📎 Expose formatWithErrors via CLI

2 participants