oxc-project/oxc · error · OxcDiagnostic
Empty exports do nothing in module files
Error message
Empty exports do nothing in module files
What it means
Raised by typescript/no_useless_empty_export when an `export {}` statement appears in a module that already has other exports (or where it serves no isolation purpose). At the throw site the empty export is normally used only to make a file a module for `isolatedModules`/ambient-declaration purposes; in a module with real exports it changes nothing and is dead code. no_useless_empty_export_diagnostic fires from run() on every empty export statement not providing module-formation value.
Source
Thrown at crates/oxc_linter/src/rules/typescript/no_useless_empty_export.rs:9
use oxc_ast::{AstKind, AstType, ast::Statement};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use crate::{AstNode, context::LintContext, rule::Rule, rules::ContextHost};
fn no_useless_empty_export_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Empty exports do nothing in module files")
.with_help("Remove this empty export.")
.with_label(span)
}
#[derive(Debug, Default, Clone)]
pub struct NoUselessEmptyExport;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow empty exports that don't change anything in a module file.
///
/// ### Why is this bad?
///
/// An empty `export {}` statement is sometimes useful in TypeScript code to
/// turn a file that would otherwise be a script file into a module file.
/// Per the [TypeScript Handbook Modules page](https://www.typescriptlang.org/docs/handbook/modules/introduction.html):
///View on GitHub (pinned to e1e7af627c)
Solutions
- Remove the empty export statement.
- Add real exports or imports if the file was meant to be a module.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/typescript/no_useless_empty_export.rs:9 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/16cb2a0f2ade40a6.
Report an issue: GitHub.