File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -1175,7 +1175,8 @@ impl RuleRunner for crate::rules::import::no_unassigned_import::NoUnassignedImpo
11751175}
11761176
11771177impl RuleRunner for crate :: rules:: import:: no_webpack_loader_syntax:: NoWebpackLoaderSyntax {
1178- const NODE_TYPES : Option < & AstTypesBitset > = None ;
1178+ const NODE_TYPES : Option < & AstTypesBitset > =
1179+ Some ( & AstTypesBitset :: from_types ( & [ AstType :: CallExpression , AstType :: ImportDeclaration ] ) ) ;
11791180 const RUN_FUNCTIONS : RuleRunFunctionsImplemented = RuleRunFunctionsImplemented :: Run ;
11801181}
11811182
Original file line number Diff line number Diff line change @@ -54,11 +54,6 @@ declare_oxc_lint!(
5454
5555impl Rule for NoWebpackLoaderSyntax {
5656 fn run < ' a > ( & self , node : & AstNode < ' a > , ctx : & LintContext < ' a > ) {
57- // not in top level
58- if node. scope_id ( ) != ctx. scoping ( ) . root_scope_id ( ) {
59- return ;
60- }
61-
6257 match node. kind ( ) {
6358 AstKind :: CallExpression ( call_expr) => {
6459 if let Expression :: Identifier ( identifier) = & call_expr. callee {
@@ -74,6 +69,11 @@ impl Rule for NoWebpackLoaderSyntax {
7469 return ;
7570 } ;
7671
72+ // not in top level
73+ if node. scope_id ( ) != ctx. scoping ( ) . root_scope_id ( ) {
74+ return ;
75+ }
76+
7777 if ident. value . contains ( '!' ) {
7878 ctx. diagnostic ( no_named_as_default_diagnostic (
7979 ident. value . as_str ( ) ,
@@ -83,6 +83,11 @@ impl Rule for NoWebpackLoaderSyntax {
8383 }
8484 }
8585 AstKind :: ImportDeclaration ( import_decl) => {
86+ // not in top level
87+ if node. scope_id ( ) != ctx. scoping ( ) . root_scope_id ( ) {
88+ return ;
89+ }
90+
8691 if import_decl. source . value . contains ( '!' ) {
8792 ctx. diagnostic ( no_named_as_default_diagnostic (
8893 & import_decl. source . value ,
You can’t perform that action at this time.
0 commit comments