{"record":{"id":"16cb2a0f2ade40a6","repo":"oxc-project/oxc","slug":"empty-exports-do-nothing-in-module-files","errorCode":null,"errorMessage":"Empty exports do nothing in module files","messagePattern":"Empty exports do nothing in module files","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/typescript/no_useless_empty_export.rs","lineNumber":9,"sourceCode":"use oxc_ast::{AstKind, AstType, ast::Statement};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{AstNode, context::LintContext, rule::Rule, rules::ContextHost};\n\nfn no_useless_empty_export_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Empty exports do nothing in module files\")\n        .with_help(\"Remove this empty export.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoUselessEmptyExport;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Disallow empty exports that don't change anything in a module file.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// An empty `export {}` statement is sometimes useful in TypeScript code to\n    /// turn a file that would otherwise be a script file into a module file.\n    /// Per the [TypeScript Handbook Modules page](https://www.typescriptlang.org/docs/handbook/modules/introduction.html):\n    ///","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/typescript/no_useless_empty_export.rs#L1-L27","documentation":"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.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/typescript/no_useless_empty_export.rs:9 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the empty export statement.","Add real exports or imports if the file was meant to be a module."],"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"}