Skip to content

Commit 3e65a33

Browse files
committed
docs(linter/no-unassigned-import-config): add auto generated config docs
1 parent f472631 commit 3e65a33

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

crates/oxc_linter/src/rules/import/no_unassigned_import.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
use schemars::JsonSchema;
2+
use serde_json::Value;
3+
14
use oxc_ast::{
25
AstKind,
36
ast::{Argument, Expression},
47
};
58
use oxc_diagnostics::OxcDiagnostic;
69
use oxc_macros::declare_oxc_lint;
710
use oxc_span::{CompactStr, Span};
8-
use serde_json::Value;
911

1012
use crate::{AstNode, context::LintContext, rule::Rule};
1113

@@ -18,8 +20,12 @@ fn no_unassigned_import_diagnostic(span: Span, msg: &str) -> OxcDiagnostic {
1820
#[derive(Debug, Default, Clone)]
1921
pub struct NoUnassignedImport(Box<NoUnassignedImportConfig>);
2022

21-
#[derive(Debug, Default, Clone)]
23+
#[derive(Debug, Default, Clone, JsonSchema)]
2224
pub struct NoUnassignedImportConfig {
25+
/// A list of glob patterns to allow unassigned imports for specific modules.
26+
/// For example:
27+
/// `{ "allow": ["*.css"] }` will allow unassigned imports for any module ending with `.css`.
28+
#[serde(rename = "allow", default)]
2329
globs: Vec<CompactStr>,
2430
}
2531

@@ -68,6 +74,7 @@ declare_oxc_lint!(
6874
NoUnassignedImport,
6975
import,
7076
suspicious,
77+
config = NoUnassignedImportConfig
7178
);
7279

7380
impl Rule for NoUnassignedImport {

0 commit comments

Comments
 (0)