Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Name component props in camelCase, not PascalCase
Use camelCase for prop names (`anchorProps`); reserve PascalCase for components and types.
Bad example
| 1 | interface HyperlinkProps { |
| 2 | AnchorProps?: AnchorProps; |
| 3 | } |
Explanation (EN)
PascalCase prop names read like component or type references and are inconsistent with the JSX convention that lowercase identifiers are props/attributes.
Objašnjenje (HR)
Imena propova u PascalCase citaju se kao reference na komponente ili tipove i nedosljedna su s JSX konvencijom da su mala slova propovi/atributi.
Good example
| 1 | interface HyperlinkProps { |
| 2 | anchorProps?: AnchorProps; |
| 3 | } |
Explanation (EN)
camelCase prop names are consistent with standard JS/JSX naming and clearly distinguish props from the PascalCase type they reference.
Objašnjenje (HR)
Imena propova u camelCase dosljedna su standardnom JS/JSX imenovanju i jasno razlikuju propove od PascalCase tipa na koji se odnose.
Exceptions / Tradeoffs (EN)
Native DOM/component props that are themselves PascalCase by an external API are kept as-is, but your own props should be camelCase.
Iznimke / Tradeoffi (HR)
Nativni DOM/komponentni propovi koji su sami po sebi PascalCase zbog vanjskog API-ja zadrzavaju se takvi, ali tvoji vlastiti propovi trebaju biti camelCase.