diff --git a/.changeset/violet-lions-travel.md b/.changeset/violet-lions-travel.md new file mode 100644 index 000000000000..0236391d823c --- /dev/null +++ b/.changeset/violet-lions-travel.md @@ -0,0 +1,5 @@ +--- +"@biomejs/biome": patch +--- + +Fixed [#9258](https://github.com/biomejs/biome/issues/9258): `--skip` no longer causes `suppressions/unused` warnings for suppression comments targeting skipped rules or domains. diff --git a/crates/biome_cli/tests/cases/linter_domains.rs b/crates/biome_cli/tests/cases/linter_domains.rs index 96b51d49b987..2c7392f27800 100644 --- a/crates/biome_cli/tests/cases/linter_domains.rs +++ b/crates/biome_cli/tests/cases/linter_domains.rs @@ -454,6 +454,52 @@ describe("foo", () => { )); } +/// Regression test for https://github.com/biomejs/biome/issues/9258 +/// Skipping a domain should not report suppression comments for rules in that +/// domain as unused. +#[test] +fn skip_domain_does_not_report_unused_suppression() { + let mut console = BufferConsole::default(); + let fs = MemoryFileSystem::default(); + let config = Utf8Path::new("biome.json"); + fs.insert( + config.into(), + r#"{ + "linter": { + "domains": { + "test": "all" + } + } +} +"# + .as_bytes(), + ); + let test1 = Utf8Path::new("test1.js"); + fs.insert( + test1.into(), + r#"// biome-ignore lint/suspicious/noFocusedTests: reason +describe.only("bar", () => {}); +"# + .as_bytes(), + ); + + let (fs, result) = run_cli( + fs, + &mut console, + Args::from(["check", "--skip=test", test1.as_str()].as_slice()), + ); + + assert!(result.is_ok(), "run_cli returned {result:?}"); + + assert_cli_snapshot(SnapshotPayload::new( + module_path!(), + "skip_domain_does_not_report_unused_suppression", + fs, + console, + result, + )); +} + /// Verifies that explicit domain enables are additive with whole-group enables: /// the plain group contributes only non-domain rules, and the domain adds its /// domain-tagged rules back explicitly. diff --git a/crates/biome_cli/tests/snapshots/main_cases_linter_domains/skip_domain_does_not_report_unused_suppression.snap b/crates/biome_cli/tests/snapshots/main_cases_linter_domains/skip_domain_does_not_report_unused_suppression.snap new file mode 100644 index 000000000000..dacfd410407d --- /dev/null +++ b/crates/biome_cli/tests/snapshots/main_cases_linter_domains/skip_domain_does_not_report_unused_suppression.snap @@ -0,0 +1,29 @@ +--- +source: crates/biome_cli/tests/snap_test.rs +expression: redactor(content) +--- +## `biome.json` + +```json +{ + "linter": { + "domains": { + "test": "all" + } + } +} +``` + +## `test1.js` + +```js +// biome-ignore lint/suspicious/noFocusedTests: reason +describe.only("bar", () => {}); + +``` + +# Emitted Messages + +```block +Checked 1 file in