diff --git a/crates/oxc_linter/src/rules/import/export.rs b/crates/oxc_linter/src/rules/import/export.rs index dfd246618..fabe27333 100644 --- a/crates/oxc_linter/src/rules/import/export.rs +++ b/crates/oxc_linter/src/rules/import/export.rs @@ -247,7 +247,9 @@ fn test() { let fail = vec![ (r#"let foo; export { foo }; export * from "./export-all""#), // (r#"export * from "./malformed.js""#), - (r#"export * from "./default-export""#), + // This case has been comment out in eslint-plugin-import + // https://github.com/import-js/eslint-plugin-import/blob/7a21f7e10f18c04473faadca94928af6b8e28009/tests/src/rules/export.js#L101-L109 + // (r#"export * from "./default-export""#), (r#"let foo; export { foo as "foo" }; export * from "./export-all""#), (" export type Foo = string; diff --git a/crates/oxc_semantic/src/module_record/builder.rs b/crates/oxc_semantic/src/module_record/builder.rs index 3503e477f..47ae9c027 100644 --- a/crates/oxc_semantic/src/module_record/builder.rs +++ b/crates/oxc_semantic/src/module_record/builder.rs @@ -291,6 +291,9 @@ impl ModuleRecordBuilder { ..ExportEntry::default() }; self.add_export_entry(export_entry); + if let Some(id) = id { + self.add_export_binding(id.name.clone(), id.span); + } } fn visit_export_named_declaration(&mut self, decl: &ExportNamedDeclaration) { diff --git a/crates/oxc_semantic/tests/symbols.rs b/crates/oxc_semantic/tests/symbols.rs index 4db98a302..a14cfee04 100644 --- a/crates/oxc_semantic/tests/symbols.rs +++ b/crates/oxc_semantic/tests/symbols.rs @@ -5,7 +5,14 @@ pub use util::SemanticTester; #[test] fn test_class_simple() { - SemanticTester::js("export class Foo {}") + SemanticTester::js("export class Foo {};") + .has_root_symbol("Foo") + .contains_flags(SymbolFlags::Class | SymbolFlags::Export) + .has_number_of_references(0) + .is_exported() + .test(); + + SemanticTester::js("export default class Foo {};") .has_root_symbol("Foo") .contains_flags(SymbolFlags::Class | SymbolFlags::Export) .has_number_of_references(0)