stxAlert sits directly beside stxConfirm in the runtime — same signature, same _createDialog call, both on window — but the codemod has a confirm rule and no alert rule. So the native call it replaces is invisible.
function stxAlert(message, options) {
return _createDialog(message, options, false);
}
function stxConfirm(message, options) {
return _createDialog(message, options, true);
}Scale
One app: 30 alert() calls in a single file, none reported. Same app, same run, the confirm rule correctly flagged all 3 of its confirm() sites. The adoption gap #1843 describes is identical for both primitives; only one of them is detected.
The calls are the ordinary kind — validation feedback and success notices:
alert('Please enter both email and password')
alert('Please enter a valid email address')
alert('Failed to subscribe. Please try again later.')
alert('Link copied to clipboard!')Rewritable, but not blindly — and differently from confirm
Worth being precise, because the caveat is not the same one:
confirmis dangerous because the return value flips.if (confirm(m))→if (stxConfirm(m))is always true. Hence "needs a human", which is right.alerthas no return value to get wrong. The difference is that nativealert()blocks andstxAlert()returns a Promise. A bare statement is safe:alert('Saved') // → stxAlert('Saved')What changes is code that leaned on the block:
alert('About to reload') location.reload() // used to run after dismissal; now runs immediately
So the honest classification is somewhere between the two existing buckets: safe to rewrite when the call is an expression statement and nothing follows it in the same block, needs a human when it does.
Suggested fix
Add an alert rule. Conservative version: report-only, matching the ten existing report rules — that alone closes the detection gap, and per the module docblock "reporting is most of the value anyway".
If it should rewrite, the guard is a local one: rewrite when the call is an expression statement that is the last statement in its block, report otherwise with the blocking-semantics reason. That mirrors how the confirm rule already explains itself rather than guessing.