{"record":{"id":"8f843091dcce4911","repo":"oxc-project/oxc","slug":"prefer-re-exporting-directly-from-the-source-modul","errorCode":null,"errorMessage":"Prefer re-exporting directly from the source module.","messagePattern":"Prefer re-exporting directly from the source module\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/prefer_export_from.rs","lineNumber":30,"sourceCode":"        Program, Statement, VariableDeclarationKind, VariableDeclarator, WithClause,\n        WithClauseKeyword,\n    },\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_semantic::{NodeId, SymbolId};\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    fixer::{RuleFix, RuleFixer},\n    rule::{DefaultRuleConfig, Rule},\n    utils::default_true,\n};\n\nfn prefer_export_from_diagnostic(import_span: Span, export_span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Prefer re-exporting directly from the source module.\")\n        .with_labels([import_span.label(\"Imported here.\"), export_span.label(\"Re-exported here.\")])\n}\n\n#[derive(Debug, Clone, JsonSchema, Deserialize)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct PreferExportFrom {\n    /// When false, if any import binding is used somewhere other than a re-export, all variables in the import declaration are ignored.\n    #[serde(default = \"default_true\")]\n    check_used_variables: bool,\n}\n\nimpl Default for PreferExportFrom {\n    fn default() -> Self {\n        Self { check_used_variables: true }\n    }\n}\n\ndeclare_oxc_lint!(","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/prefer_export_from.rs#L12-L48","documentation":"Diagnostic from the unicorn/prefer-export-from lint rule. It fires when a module imports bindings and then immediately re-exports them in separate statements; a combined `export { x } from 'source'` (or `export * from 'source'`) re-exports directly without introducing local bindings. The diagnostic labels both the import statement and the re-export it makes redundant. It is a lint suggestion, not a runtime error.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/prefer_export_from.rs:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Merge the import/export pair into `export { name } from 'source'`","Use `export * from 'source'` when re-exporting everything","Apply the rule's auto-fix, which collapses the two statements"],"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"}