Skip to content

Improve platform validation normalization and type safety #240

@TheBinaryAVA

Description

@TheBinaryAVA

Issue Description

Summary

The current platform validation works correctly for exact matches, but there are a few edge cases and improvements that could make it more robust and developer-friendly.

Current Issues

1. Case sensitivity

Platform validation currently fails for values like:

['GitHub']
['GITHUB']

because validation only accepts lowercase exact matches.

### 2. Whitespace handling

Inputs containing leading/trailing whitespace fail validation:

[' github ']
### 3. Duplicate validation behavior

Invalid duplicated values can produce multiple errors:

['abc', 'abc']

Current output:

Unknown platform
Duplicate platform

This may create noisy validation results.

###4. Missing platform type safety

PLATFORMS is currently inferred as string[], which misses:

autocomplete support
compile-time validation
stricter platform typing
Proposed Changes
Normalize platform input using:
trim()
toLowerCase()
Add typed platform constants using as const
Introduce a Platform type
Improve duplicate validation flow
Optionally skip duplicate checks for invalid entries

###Expected Benefits
Better UX for user input
More resilient validation
Stronger TypeScript support
Cleaner error reporting

- enhancement
- typescript
- validation
- good first issue



```bash
fix/platform-validation-normalization

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions