Follow project-wide code style conventions to ensure consistency and readability. Key practices include:
Example of clean control flow:
// Instead of:
function isCoreComponent(tag: string): symbol | void {
if (isBuiltInType(tag, 'Teleport')) {
return TELEPORT
} else if (isBuiltInType(tag, 'Suspense')) {
return SUSPENSE
} else if (isBuiltInType(tag, 'KeepAlive')) {
return KEEP_ALIVE
}
}
// Prefer:
function isCoreComponent(tag: string): symbol | void {
if (isBuiltInType(tag, 'Teleport')) {
return TELEPORT
}
if (isBuiltInType(tag, 'Suspense')) {
return SUSPENSE
}
if (isBuiltInType(tag, 'KeepAlive')) {
return KEEP_ALIVE
}
}
Use automated tools like ESLint and Prettier to enforce consistent formatting. When making changes, ensure they align with the existing codebase style rather than introducing new patterns.