-
-
Notifications
You must be signed in to change notification settings - Fork 794
chore: ensure force-ignore syntax works with nested biome.json #7444
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
chore: ensure force-ignore syntax works with nested biome.json #7444
Conversation
|
| Name | Type |
|---|---|
| @biomejs/biome | Minor |
| @biomejs/plugin-api | Major |
| @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 |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
WalkthroughUpdates force-ignore documentation to include Biome-treated files (e.g., nested biome.json) in force-ignoring semantics. Migrates included-files tests to a dynamic filesystem by using TemporaryFs and run_cli_with_dyn_fs instead of MemoryFileSystem. Adds tests errors_on_ignored_nested_biome_json and can_force_ignore_biome_json that construct TemporaryFs setups with includes patterns referencing nested biome.json, run the CLI, expect errors, and snapshot outputs. Introduces public run_cli_with_dyn_fs in the biome_cli crate and public TemporaryFs in the biome_fs crate. No exported/public API removals. Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests
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: 1
🧹 Nitpick comments (2)
.changeset/forced-files-forget.md (1)
9-9: Prefer present tense for current behaviour.Changeset guidelines ask for present tense when describing Biome’s behaviour. Suggest tightening “will not index” to “does not index”.
-The effect of force-ignoring is that the scanner will not index files matching the glob, even in project mode, even if those files are imported by other files, and even if they are files that receive special treatment by Biome, such as nested `biome.json` files. +The effect of force-ignoring is that the scanner does not index files matching the glob, even in project mode, even when those files are imported by other files, and even for files that receive special treatment by Biome, such as nested `biome.json` files.crates/biome_cli/tests/cases/included_files.rs (1)
169-203: Keep test intent; consider parity with other tests and tiny cleanup.
- Optional: add “--write” for parity with neighbouring format tests (avoids behaviour differences if defaults change).
- Nit: inline the file paths; the locals aren’t reused.
@@ - let root_a = "a.js"; - fs.create_file(root_a, UNFORMATTED); + fs.create_file("a.js", UNFORMATTED); @@ - let nested_a = "nested/a.js"; - fs.create_file(nested_a, UNFORMATTED); + fs.create_file("nested/a.js", UNFORMATTED); @@ - Args::from(["format", fs.cli_path()].as_slice()), + Args::from(["format", "--write", fs.cli_path()].as_slice()),
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
crates/biome_cli/tests/snapshots/main_cases_included_files/can_force_ignore_biome_json.snapis excluded by!**/*.snapand included by**crates/biome_cli/tests/snapshots/main_cases_included_files/errors_on_ignored_nested_biome_json.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (2)
.changeset/forced-files-forget.md(1 hunks)crates/biome_cli/tests/cases/included_files.rs(2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
.changeset/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
.changeset/*.md: In changeset files, only use #### or ##### headers; avoid other header levels
Changeset descriptions should use past tense for what you did (e.g., "Added...")
Describe current Biome behavior in present tense within changesets (e.g., "Biome now supports...")
For bug fixes in changesets, start with a link to the issue (e.g., "Fixed #1234: ...")
When referencing rules or assists in changesets, include links to their documentation pages
Include a minimal code block in the changeset when applicable to demonstrate the change
End every sentence in the changeset description with a period
Files:
.changeset/forced-files-forget.md
crates/biome_*/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place core crates under /crates/biome_*/
Files:
crates/biome_cli/tests/cases/included_files.rs
**/tests/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place test files under a tests/ directory in each crate
Files:
crates/biome_cli/tests/cases/included_files.rs
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Format all Rust source files before committing (just f)
Files:
crates/biome_cli/tests/cases/included_files.rs
🧠 Learnings (9)
📚 Learning: 2025-09-07T17:35:00.490Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-09-07T17:35:00.490Z
Learning: Applies to .changeset/*.md : Describe current Biome behavior in present tense within changesets (e.g., "Biome now supports...")
Applied to files:
.changeset/forced-files-forget.md
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_test.rs : Create tests/spec_test.rs implementing the run(spec_input_file, _expected_file, test_directory, _file_type) function as shown and include!("language.rs")
Applied to files:
crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Keep end-to-end LSP tests in biome_lsp’s server.tests.rs
Applied to files:
crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Place watcher tests for workspace methods in src/workspace/watcher.tests.rs
Applied to files:
crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_tests.rs : Create tests/spec_tests.rs in the biome_html_formatter crate that generates tests via tests_macros::gen_tests! for all HTML files at tests/specs/html/**/*.html
Applied to files:
crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-17T08:55:30.118Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-17T08:55:30.118Z
Learning: Applies to **/tests/specs/**/*.snap : Use snapshot spec tests stored as .snap files under tests/specs/ (via cargo insta)
Applied to files:
crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Use quick_test.rs for ad-hoc testing; set RuleFilter to the rule (e.g., RuleFilter::Rule("nursery", "useAwesomeTrick")) and adjust SOURCE
Applied to files:
crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: For debugging: run commands against the daemon (e.g., `cargo run --bin=biome -- lint --use-server <path>`)
Applied to files:
crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: For debugging: start the daemon with `cargo run --bin=biome -- start` and inspect logs in the cache folder
Applied to files:
crates/biome_cli/tests/cases/included_files.rs
🧬 Code graph analysis (1)
crates/biome_cli/tests/cases/included_files.rs (2)
crates/biome_cli/tests/main.rs (2)
run_cli(332-347)run_cli_with_dyn_fs(351-395)crates/biome_cli/tests/snap_test.rs (1)
assert_cli_snapshot(407-409)
⏰ 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). (7)
- GitHub Check: Documentation
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: autofix
🔇 Additional comments (2)
crates/biome_cli/tests/cases/included_files.rs (2)
2-2: Import looks good.Brings in the dyn-fs runner needed by the new tests.
4-4: Import looks good.TemporaryFs is appropriate for exercising the CLI with an OS-backed FS.
| #[test] | ||
| fn can_force_ignore_biome_json() { | ||
| let mut console = BufferConsole::default(); | ||
| let mut fs = TemporaryFs::new("can_force_ignore_biome_json"); | ||
| fs.create_file( | ||
| "biome.json", | ||
| r#"{ "files": { "includes": ["**/*.js", "!!nested/biome.json"] } }"#, | ||
| ); | ||
| fs.create_file( | ||
| "nested/biome.json", | ||
| r#"{ "formatter": { "enabled": false } }"#, | ||
| ); | ||
|
|
||
| let root_a = "a.js"; | ||
| fs.create_file(root_a, UNFORMATTED); | ||
|
|
||
| let nested_a = "nested/a.js"; | ||
| fs.create_file(nested_a, UNFORMATTED); | ||
|
|
||
| let result = run_cli_with_dyn_fs( | ||
| Box::new(fs.create_os()), | ||
| &mut console, | ||
| Args::from(["format", fs.cli_path()].as_slice()), | ||
| ); | ||
|
|
||
| assert!(result.is_err(), "run_cli returned {result:?}"); | ||
|
|
||
| assert_cli_snapshot(SnapshotPayload::new( | ||
| module_path!(), | ||
| "can_force_ignore_biome_json", | ||
| fs.create_mem(), | ||
| console, | ||
| result, | ||
| )); | ||
| } |
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.
Assertion contradicts the test name and changeset semantics.
Force-ignoring nested biome.json should be allowed; this test should pass, not error.
@@
- let root_a = "a.js";
- fs.create_file(root_a, UNFORMATTED);
+ fs.create_file("a.js", UNFORMATTED);
@@
- let nested_a = "nested/a.js";
- fs.create_file(nested_a, UNFORMATTED);
+ fs.create_file("nested/a.js", UNFORMATTED);
@@
- let result = run_cli_with_dyn_fs(
+ let result = run_cli_with_dyn_fs(
Box::new(fs.create_os()),
&mut console,
- Args::from(["format", fs.cli_path()].as_slice()),
+ Args::from(["format", "--write", fs.cli_path()].as_slice()),
);
@@
- assert!(result.is_err(), "run_cli returned {result:?}");
+ assert!(result.is_ok(), "run_cli returned {result:?}");📝 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.
| #[test] | |
| fn can_force_ignore_biome_json() { | |
| let mut console = BufferConsole::default(); | |
| let mut fs = TemporaryFs::new("can_force_ignore_biome_json"); | |
| fs.create_file( | |
| "biome.json", | |
| r#"{ "files": { "includes": ["**/*.js", "!!nested/biome.json"] } }"#, | |
| ); | |
| fs.create_file( | |
| "nested/biome.json", | |
| r#"{ "formatter": { "enabled": false } }"#, | |
| ); | |
| let root_a = "a.js"; | |
| fs.create_file(root_a, UNFORMATTED); | |
| let nested_a = "nested/a.js"; | |
| fs.create_file(nested_a, UNFORMATTED); | |
| let result = run_cli_with_dyn_fs( | |
| Box::new(fs.create_os()), | |
| &mut console, | |
| Args::from(["format", fs.cli_path()].as_slice()), | |
| ); | |
| assert!(result.is_err(), "run_cli returned {result:?}"); | |
| assert_cli_snapshot(SnapshotPayload::new( | |
| module_path!(), | |
| "can_force_ignore_biome_json", | |
| fs.create_mem(), | |
| console, | |
| result, | |
| )); | |
| } | |
| #[test] | |
| fn can_force_ignore_biome_json() { | |
| let mut console = BufferConsole::default(); | |
| let mut fs = TemporaryFs::new("can_force_ignore_biome_json"); | |
| fs.create_file( | |
| "biome.json", | |
| r#"{ "files": { "includes": ["**/*.js", "!!nested/biome.json"] } }"#, | |
| ); | |
| fs.create_file( | |
| "nested/biome.json", | |
| r#"{ "formatter": { "enabled": false } }"#, | |
| ); | |
| fs.create_file("a.js", UNFORMATTED); | |
| fs.create_file("nested/a.js", UNFORMATTED); | |
| let result = run_cli_with_dyn_fs( | |
| Box::new(fs.create_os()), | |
| &mut console, | |
| Args::from(["format", "--write", fs.cli_path()].as_slice()), | |
| ); | |
| assert!(result.is_ok(), "run_cli returned {result:?}"); | |
| assert_cli_snapshot(SnapshotPayload::new( | |
| module_path!(), | |
| "can_force_ignore_biome_json", | |
| fs.create_mem(), | |
| console, | |
| result, | |
| )); | |
| } |
🤖 Prompt for AI Agents
crates/biome_cli/tests/cases/included_files.rs around lines 205 to 239: the test
name and comment indicate force-ignoring nested biome.json should succeed, but
the test currently asserts result.is_err(), causing it to expect failure; change
the assertion to expect success (e.g., assert!(result.is_ok())) and adjust any
subsequent handling of result when passing to assert_cli_snapshot (pass the Ok
value or keep passing result but update snapshot expectations) so the test
reflects a successful run instead of an error.
Summary
Addressed #7414: This is not a functional change, but adds tests and tweaks the wording in the changeset to verify and clarify that force-ignoring can also be used to ignore nested
biome.jsonfiles.Test Plan
Tests are added.
Docs
See biomejs/website#3072