{"record":{"id":"db2355536229ca4b","repo":"oxc-project/oxc","slug":"multiple-exports-of-name-name","errorCode":null,"errorMessage":"Multiple exports of name '{name}'.","messagePattern":"Multiple exports of name '(.+?)'\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/import/export.rs","lineNumber":106,"sourceCode":"            } else {\n                all_export_names.insert(star_export_entry.span, export_names);\n            }\n        });\n\n        for (name, span) in named_export {\n            let mut spans = all_export_names\n                .iter()\n                .filter_map(|(star_export_entry_span, export_names)| {\n                    if export_names.contains(name) { Some(*star_export_entry_span) } else { None }\n                })\n                .collect::<Vec<_>>();\n\n            if !spans.is_empty() {\n                spans.push(*span);\n                let labels = spans.into_iter().map(LabeledSpan::underline).collect::<Vec<_>>();\n\n                ctx.diagnostic(\n                    OxcDiagnostic::warn(format!(\"Multiple exports of name '{name}'.\"))\n                        .with_help(\"Rename or remove the duplicate export so each name is exported only once.\")\n                        .with_labels(labels),\n                );\n            }\n        }\n    }\n}\n\nstruct ExportNameSpans {\n    spans: Vec<Span>,\n    has_named_specifier: bool,\n}\n\nfn diagnose_duplicate_named_exports(ctx: &LintContext<'_>, module_record: &ModuleRecord) {\n    let mut export_names: FxHashMap<(CompactStr, bool), ExportNameSpans> = FxHashMap::default();\n\n    module_record\n        .local_export_entries","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/import/export.rs#L88-L124","documentation":"The star-conflict branch of `import/export`'s duplicate-name check: a name that this module exports directly also appears among the named exports of a module reached through `export *`. The diagnostic labels both the local export span and every conflicting star-export span (built with `LabeledSpan::underline`) so the shadowing is visible.","triggerScenarios":"`export const a = 1;` together with `export * from './mod';` where mod also exports `a` — the star re-export of that name is shadowed by the local export, and both sites are reported.","commonSituations":"Barrel index files adding star exports next to local constants; two package versions re-exporting the same helper name; adding a new local export that collides with one already re-exported from a dependency.","solutions":["Rename or remove the local export so it no longer collides with the star-exported name","Replace `export *` with an explicit named list that omits the colliding name","Namespace the re-export: `export * as mod from './mod';`"],"exampleFix":"// before — 'a' exists locally and is also exported by mod\nexport const a = 1;\nexport * from './mod';\n\n// after\nexport const a = 1;\nexport { b, c } from './mod'; // explicit list, omit 'a'","handlingStrategy":"validation","validationCode":"// .oxlintrc.json\n{\n  \"plugins\": [\"import\"],\n  \"rules\": { \"import/export\": \"error\" }\n}\n// CI gate: npx oxlint src/ && npx tsc --noEmit  // tsc also flags ambiguous star re-exports","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Before adding an export next to an export *, check the star target for the same name","Prefer explicit named re-exports in barrels over star exports","Run both oxlint and tsc in CI — the compiler also reports ambiguous module exports","Keep barrel files small and reviewed"],"tags":["lint","oxlint","import-plugin","esm","exports","barrel-file"],"backgroundTag":"duplicate-export","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}