Use descriptive, semantic names for all code elements that clearly indicate their purpose and behavior. Follow consistent casing patterns throughout the codebase:
Use descriptive, semantic names for all code elements that clearly indicate their purpose and behavior. Follow consistent casing patterns throughout the codebase:
// Poor naming
function getServiceClock() {
return new Date(Date.now() + this.config.systemClockOffset);
}
// Better naming
function getSkewCorrectedDate() {
return new Date(Date.now() + this.config.systemClockOffset);
}
// Poor type handling - skipping shapes that match JavaScript primitives
if (['string', 'boolean', 'number', 'Date', 'Blob'].indexOf(shapeKey) >= 0) {
return '';
}
// Better type handling - using prefix to preserve shape names
if (['string', 'boolean', 'number', 'Date', 'Blob'].indexOf(shapeKey) >= 0) {
code += 'export type _' + shapeKey + ' = ' + getTypeMapping(shape.type) + ';\n';
return code;
}
Enter the URL of a public GitHub repository