oxc-project/oxc · error · OxcDiagnostic

No named exports found in module '{module_name}'

Error message

No named exports found in module '{module_name}'

What it means

oxlint's `import/export` rule flags `export * from '...'` re-exports whose target module record contains no named exports. Since `export *` never re-exports a target's default export, star-exporting a module with only a default (or nothing named) exports nothing, and the diagnostic names the module.

Source

Thrown at crates/oxc_linter/src/rules/import/export.rs:18

use std::path::PathBuf;

use rustc_hash::{FxHashMap, FxHashSet};

use oxc_diagnostics::{LabeledSpan, OxcDiagnostic};
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use oxc_str::CompactStr;

use crate::{
    ModuleRecord,
    context::LintContext,
    module_record::{ExportEntry, ExportExportName},
    rule::Rule,
};

fn no_named_export(module_name: &str, span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn(format!("No named exports found in module '{module_name}'"))
        .with_help("Remove the `export *` re-export, or add named exports to the target module.")
        .with_label(span)
}

/// <https://github.com/import-js/eslint-plugin-import/blob/v2.29.1/docs/rules/export.md>
#[derive(Debug, Default, Clone)]
pub struct Export;

declare_oxc_lint!(
    /// ### What it does
    ///
    /// Reports funny business with exports, like repeated exports of names or defaults.
    ///
    /// ### Why is this bad?
    ///
    /// Having multiple exports of the same name can lead to ambiguity and confusion
    /// in the codebase. It makes it difficult to track which export is being used
    /// and can result in runtime errors if the wrong export is referenced.

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Re-export the default explicitly: `export { default as helper } from './utils';`
  2. Add named exports to the target module so `export *` has something to propagate
  3. Delete the star export if nothing should be re-exported

Example fix

// before — utils.ts only has a default export, export * re-exports nothing
// utils.ts: export default function helper() {}
export * from './utils';

// after
export { default as helper } from './utils';
Defensive patterns

Strategy: validation

Validate before calling

// .oxlintrc.json
{
  "plugins": ["import"],
  "rules": { "import/export": "error" }
}
// CI gate: npx oxlint src/ && npx tsc --noEmit

Prevention

When it happens

Trigger: `export * from './utils';` where utils.ts contains only `export default ...` (or no named exports at all); requires the target module to be resolvable in the same lint run so its export entries can be inspected.

Common situations: Index files star-exporting utility modules that were later changed to default-export; scaffolding that adds `export *` boilerplate; a module rewritten to a single default export without updating its consumers' barrels.

Related errors


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/a544df82e91f3450. Report an issue: GitHub.