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).
backend ruleP1stack specificStack: typescript
validationinput-sanitizationdtocorrectness
Trim string inputs and reject blank values with the right validators
Combine a trimming transformer with a not-empty validator so whitespace-only inputs are rejected and stored trimmed, instead of a min-length check that still accepts padded blanks.
PR: vinify-backend · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | @MinLength(1) // " " passes and is stored with spaces |
| 2 | public name!: string; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | @Trim() |
| 2 | @IsNotEmpty() |
| 3 | public name!: string; |
Explanation (EN)
Objašnjenje (HR)