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
11 changes: 9 additions & 2 deletions crates/oxc_linter/src/rules/import/no_unassigned_import.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use schemars::JsonSchema;
use serde_json::Value;

use oxc_ast::{
AstKind,
ast::{Argument, Expression},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::{CompactStr, Span};
use serde_json::Value;

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

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

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

Expand Down Expand Up @@ -68,6 +74,7 @@ declare_oxc_lint!(
NoUnassignedImport,
import,
suspicious,
config = NoUnassignedImportConfig
);

impl Rule for NoUnassignedImport {
Expand Down
Loading