Skip to content

Commit aa59c7e

Browse files
committed
docs(linter): Add configuration option docs for no-barrel-file rule.
1 parent 55ee962 commit aa59c7e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use oxc_diagnostics::{LabeledSpan, OxcDiagnostic};
22
use oxc_macros::declare_oxc_lint;
33
use oxc_span::Span;
4+
use schemars::JsonSchema;
45

56
use crate::{
67
ModuleRecord,
@@ -16,8 +17,12 @@ fn no_barrel_file(total: usize, threshold: usize, labels: Vec<LabeledSpan>) -> O
1617
.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>."))
1718
.with_labels(labels)
1819
}
19-
#[derive(Debug, Clone)]
20+
21+
#[derive(Debug, Clone, JsonSchema)]
22+
#[serde(rename_all = "camelCase", default)]
2023
pub struct NoBarrelFile {
24+
/// The maximum number of modules that can be re-exported via `export *`
25+
/// before the rule is triggered.
2126
threshold: usize,
2227
}
2328

@@ -33,7 +38,7 @@ declare_oxc_lint!(
3338
/// Disallow the use of barrel files where the file contains `export *` statements,
3439
/// and the total number of modules exceed a threshold.
3540
///
36-
/// The default threshold is 100;
41+
/// The default threshold is 100.
3742
///
3843
/// ### Why is this bad?
3944
///
@@ -64,7 +69,8 @@ declare_oxc_lint!(
6469
/// ```
6570
NoBarrelFile,
6671
oxc,
67-
restriction
72+
restriction,
73+
config = NoBarrelFile,
6874
);
6975

7076
impl Rule for NoBarrelFile {

0 commit comments

Comments
 (0)