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).
Avoid redundant overlapping validation decorators
Don't combine validators whose checks are subsumed by a stricter one (e.g. @IsString on top of @IsEnum).
Bad example
| 1 | @IsEnum(Environment) |
| 2 | @IsString() |
| 3 | environment: Environment; |
Explanation (EN)
`@IsEnum` already restricts the value to the enum's string members, so `@IsString` is dead weight that suggests a looser contract than exists.
Objašnjenje (HR)
`@IsEnum` već ograničava vrijednost na string članove enuma, pa je `@IsString` mrtav teret koji sugerira labaviji ugovor nego što postoji.
Good example
| 1 | @IsEnum(Environment) |
| 2 | environment: Environment; |
Explanation (EN)
A single decorator expresses the exact constraint, keeping the DTO's intent clear.
Objašnjenje (HR)
Jedan dekorator izražava točno ograničenje, čime namjera DTO-a ostaje jasna.