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 ruleP2stack specificStack: React
reactnamingpropsconventions
Name event-handler props with an on-prefix and drop redundant context
Name callback props onClick/onSelect/onChange; omit context the component name already implies (e.g. onSelect rather than onLocationSelected inside a LocationCard).
PR: vinify-frontend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | interface LocationCardProps { |
| 2 | onLocationSelected?: () => void; |
| 3 | isLocationSelected?: boolean; |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | interface LocationCardProps { |
| 2 | onClick?: (location: Location) => void; |
| 3 | isSelected?: boolean; |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)