Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2universalStack: React
uxdialogreactno-alert
Use a styled confirmation dialog instead of window.confirm
Replace native window.confirm/alert with the app's styled dialog component for a consistent UX and to avoid the no-alert lint suppression.
PR: vinify-frontend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | const handleClose = () => { |
| 2 | // eslint-disable-next-line no-alert |
| 3 | if (window.confirm('Cancel import?')) onCancel(); |
| 4 | }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | const [confirmOpen, setConfirmOpen] = useState(false); |
| 2 | // ... |
| 3 | <ConfirmDialog open={confirmOpen} message="Cancel import?" onConfirm={onCancel} /> |
Explanation (EN)
Objašnjenje (HR)