Skip to content

Commit 6252275

Browse files
committed
fix(linter): panic in import/extensions with empty file names (#11720)
fixes #11719 fixes #11718
1 parent 8fb53b6 commit 6252275

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ impl Extensions {
275275
|| ctx.globals().is_enabled(module_name.as_str());
276276

277277
let is_package = module_name.as_str().starts_with('@')
278-
|| (!module_name.as_str().starts_with('.') && !module_name.as_str()[1..].contains('/'));
278+
|| (!module_name.as_str().starts_with('.')
279+
&& !module_name.as_str().get(1..).is_some_and(|v| v.contains('/')));
279280

280281
if is_builtin_node_module || (is_package && ignore_packages) {
281282
return;
@@ -486,6 +487,8 @@ fn test() {
486487
"#,
487488
Some(json!(["always", {"checkTypeImports": true}])),
488489
),
490+
(r"import''", None),
491+
(r"export *from 'íìc'", None),
489492
];
490493

491494
let fail = vec![

0 commit comments

Comments
 (0)