File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
crates/oxc_linter/src/rules/react Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1+ use std:: path:: Path ;
2+
13use oxc_ast:: { AstKind , ast:: * } ;
24use oxc_diagnostics:: OxcDiagnostic ;
35use oxc_macros:: declare_oxc_lint;
@@ -294,11 +296,9 @@ impl OnlyExportComponents {
294296 }
295297
296298 fn should_scan ( f : & str , check_js : bool ) -> bool {
297- use std:: path:: Path ;
298- Path :: new ( f) . extension ( ) . is_some_and ( |ext| ext. eq_ignore_ascii_case ( "tsx" ) )
299- || Path :: new ( f) . extension ( ) . is_some_and ( |ext| ext. eq_ignore_ascii_case ( "jsx" ) )
300- || ( check_js
301- && Path :: new ( f) . extension ( ) . is_some_and ( |ext| ext. eq_ignore_ascii_case ( "js" ) ) )
299+ let ext = Path :: new ( f) . extension ( ) . and_then ( |e| e. to_str ( ) ) ;
300+ matches ! ( ext, Some ( e) if e. eq_ignore_ascii_case( "tsx" ) || e. eq_ignore_ascii_case( "jsx" ) )
301+ || ( check_js && matches ! ( ext, Some ( e) if e. eq_ignore_ascii_case( "js" ) ) )
302302 }
303303
304304 fn starts_with_ascii_upper ( s : & str ) -> bool {
You can’t perform that action at this time.
0 commit comments