Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/violet-lions-travel.md
Original file line number Diff line number Diff line change
@@ -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.
46 changes: 46 additions & 0 deletions crates/biome_cli/tests/cases/linter_domains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <TIME>. No fixes applied.
```
6 changes: 4 additions & 2 deletions crates/biome_service/src/file_handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,11 @@ impl<'a> ProcessLint<'a> {
diagnostics: Default::default(),
// Do not report unused suppression comment diagnostics if:
// - it is a syntax-only analyzer pass, or
// - if a single rule is run.
// - if a single rule is run, or
// - if rules or domains are skipped.
ignores_suppression_comment: !params.categories.contains(RuleCategory::Lint)
|| !params.only.is_empty(),
|| !params.only.is_empty()
|| !params.skip.is_empty(),
rules: params
.settings
.as_ref()
Expand Down