Prompt
Always use curly braces for conditional statements and loops, even for single-line bodies. This maintains consistency throughout the codebase and improves readability. Avoid inline conditionals.
Instead of:
if (areThereNoFileIn && this.fileIsRequired) return;
if (this.moduleTokenCache.has(key)) return this.moduleTokenCache.get(key);
Use:
if (areThereNoFileIn && this.fileIsRequired) {
return;
}
if (this.moduleTokenCache.has(key)) {
return this.moduleTokenCache.get(key);
}
This style:
- Maintains consistent formatting across the codebase
- Makes code more readable and maintainable
- Reduces the risk of errors when modifying conditions
- Makes it easier to add additional statements later without restructuring