{"record":{"id":"a742ae754e700b6a","repo":"oxc-project/oxc","slug":"assign-object-to-a-variable-before-exporting-as-mo","errorCode":null,"errorMessage":"Assign object to a variable before exporting as module default","messagePattern":"Assign object 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":163,"sourceCode":"                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\",\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\",","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/import/no_anonymous_default_export.rs#L145-L181","documentation":"Fires from import/no-anonymous-default-export when the default export is an inline object literal and allowObject is false. The message instructs assigning the object to a variable first so the export has an identifiable name in stack traces and tooling.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/import/no_anonymous_default_export.rs:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Assign the object to a named const, then export default that variable","Enable `allowObject` if anonymous object 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-14T05:17:10.506Z"}