mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(linter/import): false positive for indirect export in namespace (#2862)
This commit is contained in:
parent
23651980d1
commit
c4528974cb
2 changed files with 10 additions and 1 deletions
2
crates/oxc_linter/fixtures/import/oxc/indirect-export.js
Normal file
2
crates/oxc_linter/fixtures/import/oxc/indirect-export.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import { a } from '../named-exports'
|
||||
export { a }
|
||||
|
|
@ -198,7 +198,13 @@ fn get_module_request_name(name: &str, module_record: &ModuleRecord) -> Option<S
|
|||
|
||||
false
|
||||
}
|
||||
ExportImportName::Name(name_span) => name_span.name().as_str() == name,
|
||||
ExportImportName::Name(name_span) => {
|
||||
return name_span.name().as_str() == name
|
||||
&& module_record.import_entries.iter().any(|entry| {
|
||||
entry.local_name.name().as_str() == name
|
||||
&& entry.import_name.is_namespace_object()
|
||||
})
|
||||
}
|
||||
_ => false,
|
||||
})
|
||||
{
|
||||
|
|
@ -443,6 +449,7 @@ fn test() {
|
|||
(r#"import * as a from "./deep-es7/a"; console.log(a.b.c.d.e.f)"#, None),
|
||||
(r#"import * as a from "./deep-es7/a"; var {b:{c:{d:{e}}}} = a"#, None),
|
||||
(r#"import { b } from "./deep-es7/a"; var {c:{d:{e}}} = b"#, None),
|
||||
(r"import { a } from './oxc/indirect-export'; console.log(a.nothing)", None),
|
||||
];
|
||||
|
||||
let fail = vec![
|
||||
|
|
|
|||
Loading…
Reference in a new issue