{"record":{"id":"f0b595475b72efe4","repo":"oxc-project/oxc","slug":"do-not-export-then","errorCode":null,"errorMessage":"Do not export `then`.","messagePattern":"Do not export `then`\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/no_thenable.rs","lineNumber":21,"sourceCode":"    ast::{\n        Argument, ArrayExpressionElement, AssignmentExpression, AssignmentTarget, BindingPattern,\n        CallExpression, Declaration, Expression, ObjectPropertyKind, PropertyKey, match_expression,\n    },\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn object(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Do not add `then` to an object.\")\n        .with_help(\"If an object is defined as 'thenable', once it's accidentally used in an await expression, it may cause problems\")\n        .with_label(span)\n}\n\nfn export(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Do not export `then`.\")\n        .with_help(\"If an object is defined as 'thenable', once it's accidentally used in an await expression, it may cause problems\")\n        .with_label(span)\n}\n\nfn class(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Do not add `then` to a class.\")\n        .with_help(\"If an object is defined as 'thenable', once it's accidentally used in an await expression, it may cause problems\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoThenable;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Disallow defining a `then` property.\n    ///","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/no_thenable.rs#L3-L39","documentation":"Raised by unicorn/no-thenable (export helper) when a module exports a binding named `then`. ES modules treat a `then` export specially during dynamic import (`import()` unwraps it), which breaks expectations; the faulting input is the `then` export at the labeled span.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/no_thenable.rs:21 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the export so the module namespace is not thenable","Wrap the value in a default or named object export instead of a bare `then` export"],"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"}