{"record":{"id":"2c40dd69c1b4cff8","repo":"oxc-project/oxc","slug":"assign-arrow-function-to-a-variable-before-exporti","errorCode":null,"errorMessage":"Assign arrow function to a variable before exporting as module default","messagePattern":"Assign arrow function 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":157,"sourceCode":"                ctx.diagnostic(no_anonymous_default_export_diagnostic(\n                    export_decl.span,\n                    \"Unexpected default export of anonymous function\",\n                ));\n            }\n            ExportDefaultDeclarationKind::ClassDeclaration(class_decl)\n                if !self.allow_anonymous_class && class_decl.id.is_none() =>\n            {\n                ctx.diagnostic(no_anonymous_default_export_diagnostic(\n                    export_decl.span,\n                    \"Unexpected default export of anonymous class\",\n                ));\n            }\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\",","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/import/no_anonymous_default_export.rs#L139-L175","documentation":"Fires from import/no-anonymous-default-export when the default export is an arrow function expression and allowArrowFunction is false. Unlike the anonymous function/class cases, this message is actionable advice: assign the arrow function to a named variable first.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/import/no_anonymous_default_export.rs:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Assign the arrow function to a named const, then `export default` that variable","Enable `allowArrowFunction` to permit arrow default exports"],"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"}