{"record":{"id":"397b2df1cd31d0ba","repo":"oxc-project/oxc","slug":"component-must-be-the-default-export","errorCode":null,"errorMessage":"Component must be the default export.","messagePattern":"Component must be the default export\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/require_default_export.rs","lineNumber":17,"sourceCode":"use oxc_ast::{AstKind, ast::Expression};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{\n    context::{ContextHost, LintContext},\n    frameworks::FrameworkOptions,\n    rule::Rule,\n};\n\nfn missing_default_export_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Missing default export.\").with_label(span)\n}\n\nfn must_be_default_export_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Component must be the default export.\").with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequireDefaultExport;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Require components to be the default export.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Using SFCs (Single File Components) without a default export is\n    /// not supported in Vue 3. Components should be exported as the default export.\n    ///\n    /// ### Examples\n    ///\n    /// Examples of **incorrect** code for this rule:","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/require_default_export.rs#L1-L35","documentation":"Emitted by run_once of the vue require-default-export rule when the file does export something but the component is not the default export (e.g. only named exports exist). It is a structural guard ensuring the Vue component is the module's default export.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/require_default_export.rs:17 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the component definition the default export, e.g. export default { ... } instead of a named export","Move helper exports into a separate module so the component file only has the default export"],"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"}