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 ruleP1universalStack: react
formsvalidationuxaccessibility
Surface validation error messages, not just an error state
Return a message from validators and render it (e.g. helperText) so users see why a field is invalid, not just a red border.
PR: vinify-frontend · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | const validate = (value) => value.length > 0; // returns boolean, no message |
| 2 | <TextField error={Boolean(error)} /> // red border, no explanation |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | const validate = (value) => value.length > 0 || i18n.required; // message on failure |
| 2 | <TextField error={Boolean(error)} helperText={error?.message} /> |
Explanation (EN)
Objašnjenje (HR)