{"record":{"id":"fcc8a80e3d0df03c","repo":"oxc-project/oxc","slug":"reexporting-namespace-as-default-is-restricted","errorCode":null,"errorMessage":"Reexporting namespace as default is restricted.","messagePattern":"Reexporting namespace as default is restricted\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/eslint/no_restricted_exports.rs","lineNumber":47,"sourceCode":"    Named,\n    DefaultFrom,\n    NamedFrom,\n    NamespaceFrom,\n}\n\nfn no_restricted_default_exports_diagnostic(\n    span: Span,\n    export_type: DefaultExportType,\n) -> OxcDiagnostic {\n    let warn = match export_type {\n        DefaultExportType::DefaultFrom => \"Reexporting 'default' export is restricted.\",\n        DefaultExportType::Direct => \"Exporting 'default' is restricted.\",\n        DefaultExportType::Named => \"Exporting named value as default is restricted.\",\n        DefaultExportType::NamedFrom => \"Reexporting named export as default is restricted.\",\n        DefaultExportType::NamespaceFrom => \"Reexporting namespace as default is restricted.\",\n    };\n\n    OxcDiagnostic::warn(warn).with_help(\"Use named export instead.\").with_label(span)\n}\n\nfn no_restricted_named_exports_diagnostic(span: Span, name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"'{name}' is restricted from being used as an exported name.\"))\n        .with_help(\"Rename this export.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct NoRestrictedExports(Box<NoRestrictedExportsConfig>);\n\n#[derive(Debug, Default, Clone, JsonSchema, Deserialize)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct NoRestrictedExportsConfig {\n    /// An array of strings, where each string is a name to be restricted.\n    ///\n    /// Example of **incorrect** code for `\"restrictedNamedExports\": [\"foo\"]`:\n    ///","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/no_restricted_exports.rs#L29-L65","documentation":"The `NamespaceFrom` branch of `no-restricted-exports`. It fires when the config sets `restrictedDefaultExports.namespaceFrom` and the module re-exports an entire namespace as default: `export * as default from 'mod';`.","triggerScenarios":"`restrictedDefaultExports: { \"namespaceFrom\": true }` in .oxlintrc plus `export * as default from './api';`.","commonSituations":"Aggregator entry points that forward a whole module as default; style guides banning all default-export shapes.","solutions":["Re-export the namespace under a name: `export * as api from './api';`.","Or forward specific members: `export { getUsers } from './api';`.","Remove `namespaceFrom` from the config if the pattern is deliberate."],"exampleFix":"// before\nexport * as default from './api';\n\n// after\nexport * as api from './api';","handlingStrategy":"validation","validationCode":"// Detect `export * as default from '...'`\nconst src = require('node:fs').readFileSync(file, 'utf8');\nif (/export\\s*\\*\\s*as\\s+default\\s*from/.test(src)) {\n  console.error('namespace-as-default re-export is banned');\n  process.exitCode = 1;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give namespace re-exports a real name (`export * as api from './api';`).","Turn on `restrictedDefaultExports.namespaceFrom` to lock the convention in."],"tags":["lint","eslint","no-restricted-exports","es-modules","configuration"],"backgroundTag":"restricted-export-config","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"}