Skip to content

alerts

Reports uses of the global alert/confirm/prompt dialog APIs.

✅ This rule is included in the browser logical presets.

The legacy browser dialog APIs alert, confirm, and prompt are synchronous, blocking, and provide a poor user experience in modern web applications. They should be avoided in production code in favor of non-blocking UI patterns (for example, custom modals) or other mechanisms for collecting user input or showing messages.

B0ale5<3(sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4DHello, worl1<1"sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meec-li">dAE53< (sp ansty="le--0:#C792EA;--1:#8844">AB0confi5<3(sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4DAre you sur1<1"sp ansty="le--0:#D6DEEB;--1:#403F">53))< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEretu5<3;d ivclassNa="meec-li">5<3}d ivclassNa="meec-li">dAEconsB0naAE <= sp ansty="le--0:#82AAFF;--1:#3B61">B0prom5<3(sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4DWhat's your nam1<1"sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meco"><);d>
6E72con4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B<0log spans="tyle--0:#D6DEEB;--1:#40">31<111" spans="tyle--0:#ECC48D;--1:#98">4E4DHello, wo1<111" spans="tyle--0:#D6DEEB;--1:#40">3F<53) ;divclass="Nameec-">c443F<53 ( spans="tyle--0:#C792EA;--1:#88">4<4AE! spans="tyle--0:#D6DEEB;--1:#40">344AEa361B0myCustomM31<111" spans="tyle--0:#ECC48D;--1:#98">4E4DAre you s1<111" spans="tyle--0:#D6DEEB;--1:#40">3F53)<)) {divclass="Nameec-">de44AEre33c44AEco61B044AE = aw61B0myCustomI31<111" spans="tyle--0:#ECC48D;--1:#98">4E4DWhat's your n1<111" spans="tyle--0:#D6DEEB;--1:#40">3F<53) ;divclass="Name">

This rule is not configurable.

If you’re writing quick temporary debugging snippets that never ship to users, or an internal-only page where the user experience does not matter, you might accept using alert/confirm/prompt locally. For production code and libraries, prefer non-blocking alternatives.