
Code Formatting Is Not About Aesthetics. It's About Reducing Bugs.
A developer on my team once introduced a bug that took four hours to find. The code looked like this: if ( user . isAdmin ) deleteAllRecords (); sendNotification ( " Records purged " ); The indentation made it look like both lines were inside the if block. They were not. sendNotification ran unconditionally because JavaScript does not use indentation for scoping. Only the first statement after a braceless if is conditional. Every user -- admin or not -- received a "Records purged" notification. Consistent formatting would have prevented this. Either braces would have made the scope explicit, or a formatter would have corrected the indentation to reflect the actual behavior: if ( user . isAdmin ) deleteAllRecords (); sendNotification ( " Records purged " ); // clearly unconditional This is why code formatting matters. Not because pretty code is easier to look at (though it is), but because misleading formatting causes real bugs that waste real time. What beautifiers actually do A code b
Continue reading on Dev.to Tutorial
Opens in a new tab




