{"record":{"id":"15c6818fd7d1ec0f","repo":"oxc-project/oxc","slug":"this-rule-can-t-verify-that-export-only-export","errorCode":null,"errorMessage":"This rule can't verify that `export *` only exports components.","messagePattern":"This rule can't verify that `export \\*` only exports components\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/only_export_components.rs","lineNumber":17,"sourceCode":"use oxc_ast::{AstKind, ast::*};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_semantic::NodeId;\nuse oxc_span::{GetSpan, Span};\nuse rustc_hash::FxHashSet;\nuse schemars::JsonSchema;\nuse serde::{Deserialize, Serialize};\n\nuse crate::{\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n    utils::is_react_component_name,\n};\n\nfn export_all_components_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"This rule can't verify that `export *` only exports components.\")\n        .with_label(span)\n}\n\nfn named_export_components_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components.\")\n        .with_label(span)\n}\n\nfn anonymous_components_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\n        \"Fast refresh can't handle anonymous components. Add a name to your export.\",\n    )\n    .with_label(span)\n}\n\nfn local_components_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Fast refresh only works when a file only exports components. Move your component(s) to a separate file.\")\n        .with_label(span)","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/only_export_components.rs#L1-L35","documentation":"Raised by react/only_export_components when a module contains an `export *` re-export. At the throw site React Fast Refresh cannot statically know whether the star-exported module only exports components, so any hot-reload boundary through this file is invalidated and Fast Refresh falls back to a full reload. export_all_components_diagnostic is emitted from analyze_exports for every ExportAllDeclaration found in the analyzed module.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/react/only_export_components.rs:17 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace `export *` with explicit named exports of components only.","Split component and non-component exports into separate files."],"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"}