Skip to content
Merged
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
12 changes: 9 additions & 3 deletions crates/oxc_linter/src/rules/oxc/no_barrel_file.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use oxc_diagnostics::{LabeledSpan, OxcDiagnostic};
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use schemars::JsonSchema;

use crate::{
ModuleRecord,
Expand All @@ -16,8 +17,12 @@ fn no_barrel_file(total: usize, threshold: usize, labels: Vec<LabeledSpan>) -> O
.with_help(format!("Loading {total} modules is slow for runtimes and bundlers.\nThe configured threshold is {threshold}.\nSee also: <https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7>."))
.with_labels(labels)
}
#[derive(Debug, Clone)]

#[derive(Debug, Clone, JsonSchema)]
#[serde(rename_all = "camelCase", default)]
pub struct NoBarrelFile {
/// The maximum number of modules that can be re-exported via `export *`
/// before the rule is triggered.
threshold: usize,
}

Expand All @@ -33,7 +38,7 @@ declare_oxc_lint!(
/// Disallow the use of barrel files where the file contains `export *` statements,
/// and the total number of modules exceed a threshold.
///
/// The default threshold is 100;
/// The default threshold is 100.
///
/// ### Why is this bad?
///
Expand Down Expand Up @@ -64,7 +69,8 @@ declare_oxc_lint!(
/// ```
NoBarrelFile,
oxc,
restriction
restriction,
config = NoBarrelFile,
);

impl Rule for NoBarrelFile {
Expand Down
Loading