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).
Use camelCase props; map snake_case only at the API boundary
Expose camelCase prop and key names; convert to a third-party's snake_case payload at the boundary instead of leaking it into your component API.
Bad example
| 1 | interface Props { |
| 2 | content_format?: string; |
| 3 | special_placement?: string; |
| 4 | } |
| 5 |
|
| 6 | function Ad({ content_format, special_placement }: Props) { |
| 7 | sdk.load({ content_format, special_placement }); |
| 8 | } |
Explanation (EN)
The component adopts the SDK's snake_case naming, leaking an implementation detail into its public prop names.
Objašnjenje (HR)
Komponenta preuzima SDK-ovo snake_case imenovanje, propusta implementacijski detalj u svoja javna imena propova.
Good example
| 1 | interface Props { |
| 2 | contentFormat?: string; |
| 3 | specialPlacement?: string; |
| 4 | } |
| 5 |
|
| 6 | function Ad({ contentFormat, specialPlacement }: Props) { |
| 7 | sdk.load({ |
| 8 | content_format: contentFormat, |
| 9 | special_placement: specialPlacement, |
| 10 | }); |
| 11 | } |
Explanation (EN)
Props stay camelCase; the snake_case mapping happens once at the SDK call, keeping the conversion an internal detail.
Objašnjenje (HR)
Propovi ostaju camelCase; snake_case mapiranje dogada se jednom pri SDK pozivu, drzeci pretvorbu internim detaljem.