no-window-alert
window.alert() should use a proper notification component.
| Severity | Dimension | Files |
|---|---|---|
| Error | Consistency | .tsx .jsx .ts |
What it flags
A line like this:
window.alert('Saved')
is reported as:
window.alert() — use a Toast or Dialog component instead
How to fix it
Replace with a design system notification component.
preset AI suggests a fix: Replace window.alert() with Toast component. Browser alerts block the UI and cannot be styled. Use a Toast or Dialog component from the design system.
Before:
window.alert('Saved')
After:
toast({ title: "message" })
Related
- All rules: every built-in rule, by dimension.
- Set up enforcement: connect an AI tool and make validation required.
Last reviewed by @jschuyler