Maintain consistent style patterns throughout the codebase to improve readability, reduce maintenance overhead, and prevent errors. Key areas to focus on:
Maintain consistent style patterns throughout the codebase to improve readability, reduce maintenance overhead, and prevent errors. Key areas to focus on:
const Installer = @This();
instead of:
pub const Installer = struct {
// Bad - duplicates in options list
GLOBAL_OPTIONS[LONG_OPTIONS]="--extension-order --jsx-factory --jsx-fragment --extension-order --jsx-factory --jsx-fragment"
// Good - no duplicates
GLOBAL_OPTIONS[LONG_OPTIONS]="--extension-order --jsx-factory --jsx-fragment"
// Bad - inconsistent namespace qualification
if (comptime Environment.debug_checks) {
// Good - consistent qualification
if (comptime bun.Environment.debug_checks) {
// Consider switch statements for multiple conditions
fn isValidRedirectStatus(status: u16) bool {
return switch (status) {
301, 302, 303, 307, 308 => true,
else => false,
};
}
Consistent style makes code easier to read, review, and maintain for the entire team.
Enter the URL of a public GitHub repository