{"record":{"id":"49389382a4fe7f32","repo":"oxc-project/oxc","slug":"expected-the-component-literal-to-be-directly-expo","errorCode":null,"errorMessage":"Expected the component literal to be directly exported.","messagePattern":"Expected the component literal to be directly exported\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/require_direct_export.rs","lineNumber":27,"sourceCode":"    },\n    match_expression,\n};\nuse oxc_ast_visit::VisitJs;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_semantic::ScopeFlags;\nuse oxc_span::Span;\n\nuse crate::{\n    AstNode,\n    ast_util::is_method_call,\n    context::{ContextHost, LintContext},\n    frameworks::FrameworkOptions,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn require_direct_export_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected the component literal to be directly exported.\")\n        .with_help(\n            \"Export the component object directly instead of assigning it to a variable first.\",\n        )\n        .with_label(span)\n}\n\n#[derive(Debug, Clone, Default, JsonSchema, Deserialize)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct RequireDirectExport {\n    /// When set `true`, disallow functional component functions.\n    disallow_functional_component_function: bool,\n}\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// This rule requires that the component object be directly exported.\n    ///","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/require_direct_export.rs#L9-L45","documentation":"Emitted by run/check_expression/check_call_expression in the vue require-direct-export rule when the component object literal is not exported directly — e.g. it is assigned to a variable that is then exported, or wrapped in a factory call. It is a structural guard so tooling can statically find the component definition.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/require_direct_export.rs:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inline the component object into the export, e.g. export default { ... } instead of const c = { ... }; export default c","Avoid wrapping the component literal in helper calls at export time"],"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"}