Skip to content

Commit 6eab134

Browse files
committed
fix(linter): count own indirect export entries to the threshould for oxc/no-barrel-file
1 parent 0260308 commit 6eab134

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

crates/oxc_linter/src/rules/oxc/no_barrel_file.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ impl Rule for NoBarrelFile {
9696
let mut total: usize = 0;
9797

9898
for module_request in module_requests {
99+
// the own module is counted as well
100+
total += 1;
101+
99102
if let Some(remote_module) =
100103
module_record.loaded_modules.read().unwrap().get(module_request.name())
101104
{

crates/oxc_linter/src/snapshots/oxc_no_barrel_file.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
source: crates/oxc_linter/src/tester.rs
33
---
4-
oxc(no-barrel-file): Barrel file detected, 6 modules are loaded.
4+
oxc(no-barrel-file): Barrel file detected, 10 modules are loaded.
55
╭─[index.ts:1:15]
66
1export * from "./deep/a.js";
77
· ──────┬──────
@@ -14,6 +14,6 @@ source: crates/oxc_linter/src/tester.rs
1414
· ╰── 1 modules
1515
4export * from "./deep/d.js";
1616
╰────
17-
help: Loading 6 modules is slow for runtimes and bundlers.
17+
help: Loading 10 modules is slow for runtimes and bundlers.
1818
The configured threshold is 1.
1919
See also: <https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7>.

0 commit comments

Comments
 (0)