Prompt
Choose names that reflect the semantic purpose and meaning rather than implementation details or arbitrary values. Use enum constants instead of string literals, select precise identifiers that clearly convey intent, and name functions/variables based on their actual purpose.
Examples:
- Use
operationName === DocumentActionType.deleteinstead ofoperationName === 'delete' - Use
provider_type === 'local_file'instead of checking multiple properties when a single semantic property exists - Name functions like
handleUploadinstead ofhandleImageCroppedwhen the function’s purpose extends beyond just cropping - Choose descriptive names like
'sketch'instead of technical terms like'handDrawn' - Define enums for related constants:
enum LookType { Classic = 'classic', Sketch = 'sketch' }
This approach improves code readability, reduces magic strings, and makes the codebase more maintainable by clearly expressing the developer’s intent.