From 94da4085a2456afb681421216f3f2416e29583a1 Mon Sep 17 00:00:00 2001 From: Said Atrahouch Date: Wed, 3 Dec 2025 16:48:53 +0100 Subject: [PATCH 1/2] fix(linter/oxc): not emit error when the threshold is zero and we haven't detected a barrel file --- crates/oxc_linter/src/rules/oxc/no_barrel_file.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/oxc_linter/src/rules/oxc/no_barrel_file.rs b/crates/oxc_linter/src/rules/oxc/no_barrel_file.rs index ae0a391fe0575..8a77fcd9f5ece 100644 --- a/crates/oxc_linter/src/rules/oxc/no_barrel_file.rs +++ b/crates/oxc_linter/src/rules/oxc/no_barrel_file.rs @@ -118,7 +118,7 @@ impl Rule for NoBarrelFile { } let threshold = self.threshold; - if total >= threshold { + if total > threshold { if labels.is_empty() { labels.push(Span::new(0, 0).label("File defined here.")); } @@ -148,6 +148,17 @@ fn test() { (r#"export type { foo } from "foo";"#, None), (r#"export type * from "foo"; export type { bar } from "bar";"#, None), (r#"import { foo, bar, baz } from "../import/export-star/models";"#, None), + ( + r#"import boo from "foo"; + const test = 0;"#, + Some(serde_json::json!([{"threshold": 0}])), + ), + (r#"export const test = 0;"#, Some(serde_json::json!([{"threshold": 0}]))), + ( + r#"export const test = 0; + export const other = 1;"#, + Some(serde_json::json!([{"threshold": 0}])), + ), ]; let settings = Some(serde_json::json!([{"threshold": 1}])); From 2f36306cdd08c47d94ead75ecd4d1bb49d3a4e69 Mon Sep 17 00:00:00 2001 From: Cameron Clark Date: Wed, 3 Dec 2025 16:29:57 +0000 Subject: [PATCH 2/2] fix lint --- crates/oxc_linter/src/rules/oxc/no_barrel_file.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/oxc_linter/src/rules/oxc/no_barrel_file.rs b/crates/oxc_linter/src/rules/oxc/no_barrel_file.rs index 8a77fcd9f5ece..5fc406bc9b1ff 100644 --- a/crates/oxc_linter/src/rules/oxc/no_barrel_file.rs +++ b/crates/oxc_linter/src/rules/oxc/no_barrel_file.rs @@ -153,10 +153,10 @@ fn test() { const test = 0;"#, Some(serde_json::json!([{"threshold": 0}])), ), - (r#"export const test = 0;"#, Some(serde_json::json!([{"threshold": 0}]))), + (r"export const test = 0;", Some(serde_json::json!([{"threshold": 0}]))), ( - r#"export const test = 0; - export const other = 1;"#, + r"export const test = 0; + export const other = 1;", Some(serde_json::json!([{"threshold": 0}])), ), ];