Prompt
Maintain consistent style patterns throughout the codebase to improve readability, reduce maintenance overhead, and prevent errors. Key areas to focus on:
- Use consistent struct declarations: For top-level structs, prefer:
const Installer = @This();instead of:
pub const Installer = struct { - Eliminate redundancies: Remove duplicate declarations such as repeated flags, option definitions, or multiple type declarations.
// 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" - Maintain consistent formatting: Ensure proper spacing, consistent namespace qualifiers, and appropriate control structures.
// Bad - inconsistent namespace qualification if (comptime Environment.debug_checks) { // Good - consistent qualification if (comptime bun.Environment.debug_checks) { - Use appropriate control structures: Choose the most readable structure for the logic being expressed.
// 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.