{"record":{"id":"fae310d8e6ff6146","repo":"oxc-project/oxc","slug":"assign-call-result-to-a-variable-before-exporting","errorCode":null,"errorMessage":"Assign call result to a variable before exporting as module default","messagePattern":"Assign call result to a variable before exporting as module default","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/import/no_anonymous_default_export.rs","lineNumber":169,"sourceCode":"            }\n            ExportDefaultDeclarationKind::ArrowFunctionExpression(_)\n                if !self.allow_arrow_function =>\n            {\n                ctx.diagnostic(no_anonymous_default_export_diagnostic(\n                    export_decl.span,\n                    \"Assign arrow function to a variable before exporting as module default\",\n                ));\n            }\n            ExportDefaultDeclarationKind::ObjectExpression(_) if !self.allow_object => {\n                ctx.diagnostic(no_anonymous_default_export_diagnostic(\n                    export_decl.span,\n                    \"Assign object to a variable before exporting as module default\",\n                ));\n            }\n            ExportDefaultDeclarationKind::CallExpression(_) if !self.allow_call_expression => {\n                ctx.diagnostic(no_anonymous_default_export_diagnostic(\n                    export_decl.span,\n                    \"Assign call result to a variable before exporting as module default\",\n                ));\n            }\n            ExportDefaultDeclarationKind::NewExpression(_) if !self.allow_new => {\n                ctx.diagnostic(no_anonymous_default_export_diagnostic(\n                    export_decl.span,\n                    \"Assign instance to a variable before exporting as module default\",\n                ));\n            }\n            ExportDefaultDeclarationKind::ArrayExpression(_) if !self.allow_array => {\n                ctx.diagnostic(no_anonymous_default_export_diagnostic(\n                    export_decl.span,\n                    \"Assign array to a variable before exporting as module default\",\n                ));\n            }\n            _ => {\n                if let Some(expr) = export_decl.declaration.as_expression()\n                    && !self.allow_literal\n                    && (expr.is_literal() || matches!(expr, Expression::TemplateLiteral(_)))","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/import/no_anonymous_default_export.rs#L151-L187","documentation":"Fires from import/no-anonymous-default-export when the default export is the result of a function call (e.g. `export default connect()(Comp)`) and allowCallExpression (default false) disallows it. The message advises binding the result to a variable before exporting.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/import/no_anonymous_default_export.rs:169 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Assign the call result to a named const, then export default that variable","Enable `allowCallExpression` if call-result default exports are acceptable"],"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"}