1+ use schemars:: JsonSchema ;
2+ use serde_json:: Value ;
3+
14use oxc_ast:: {
25 AstKind ,
36 ast:: { Argument , Expression } ,
47} ;
58use oxc_diagnostics:: OxcDiagnostic ;
69use oxc_macros:: declare_oxc_lint;
710use oxc_span:: { CompactStr , Span } ;
8- use serde_json:: Value ;
911
1012use 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 ) ]
1921pub struct NoUnassignedImport ( Box < NoUnassignedImportConfig > ) ;
2022
21- #[ derive( Debug , Default , Clone ) ]
23+ #[ derive( Debug , Default , Clone , JsonSchema ) ]
2224pub 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
7380impl Rule for NoUnassignedImport {
0 commit comments