{"record":{"id":"00aa97bf8ab11f96","repo":"oxc-project/oxc","slug":"multiple-named-export-declarations-consolidate-al","errorCode":null,"errorMessage":"Multiple named export declarations; consolidate all named exports into a single export declaration","messagePattern":"Multiple named export declarations; consolidate all named exports into a single export declaration","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/import/group_exports.rs","lineNumber":20,"sourceCode":"    AstKind,\n    ast::{ImportOrExportKind, MemberExpression},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\nuse rustc_hash::FxHashMap;\n\nuse crate::{context::LintContext, rule::Rule};\n\nfn group_exports_diagnostic(span: Span, is_commonjs: bool) -> OxcDiagnostic {\n    let (msg, help) = if is_commonjs {\n        (\n            \"Multiple CommonJS exports; consolidate all exports into a single assignment to `module.exports`\",\n            \"Combine multiple assignments into a single `module.exports = { ... }` statement\",\n        )\n    } else {\n        (\n            \"Multiple named export declarations; consolidate all named exports into a single export declaration\",\n            \"Use a single export declaration with multiple specifiers: `export { spec1, spec2 }`\",\n        )\n    };\n    OxcDiagnostic::warn(msg).with_help(help).with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct GroupExports;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Reports when named exports are not grouped together in a single export declaration\n    /// or when multiple assignments to CommonJS module.exports\n    /// or exports object are present in a single file.\n    ///\n    /// ### Why is this bad?\n    ///","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/import/group_exports.rs#L2-L38","documentation":"Fires from import/group-exports when an ES module contains multiple separate named export declarations for the same kind. The helper selects this message (vs the CommonJS variant) when is_commonjs is false, labeling the span of the redundant export declaration.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/import/group_exports.rs:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Consolidate the named exports into a single `export { ... }` or `export const ...` declaration","Merge multiple export statements covering the same bindings"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}