oxc-project/oxc · error · OxcDiagnostic
Do not export `then`.
Error message
Do not export `then`.
What it means
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.
Source
Thrown at crates/oxc_linter/src/rules/unicorn/no_thenable.rs:21
ast::{
Argument, ArrayExpressionElement, AssignmentExpression, AssignmentTarget, BindingPattern,
CallExpression, Declaration, Expression, ObjectPropertyKind, PropertyKey, match_expression,
},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::{GetSpan, Span};
use crate::{AstNode, context::LintContext, rule::Rule};
fn object(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Do not add `then` to an object.")
.with_help("If an object is defined as 'thenable', once it's accidentally used in an await expression, it may cause problems")
.with_label(span)
}
fn export(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Do not export `then`.")
.with_help("If an object is defined as 'thenable', once it's accidentally used in an await expression, it may cause problems")
.with_label(span)
}
fn class(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Do not add `then` to a class.")
.with_help("If an object is defined as 'thenable', once it's accidentally used in an await expression, it may cause problems")
.with_label(span)
}
#[derive(Debug, Default, Clone)]
pub struct NoThenable;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow defining a `then` property.
///View on GitHub (pinned to e1e7af627c)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/unicorn/no_thenable.rs:21 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/f0b595475b72efe4.
Report an issue: GitHub.