Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I find it interesting to reflect on the fact that I’m not entirely sure what the Prettier, Black and cargo fmt defaults even are when no in front of the code. If it’s formatted reasonably then I’m happy enough.
-
Xoka12784yAlways use the "Auto format" keyboard shortcut after writing a few lines of codes. Never really counted how many spaces added by the IDE. but since it looks pretty after auto formatting, I'm happy.
& it also surprises me, how on earth people code without formatting them :/ -
I still haven't figured out why people like to use 2 spaces. Except to increase indent level, which I don't see as a good thing.
-
Hazarth95374yYes, normal languages use 4 spaces because It's easier to look at.
JS devs use 2 spaces because the language requires endless nesting and with 4 spaces you get off screen twice as fast...
With a normal language that isn't garbage like JS we don't usually go deeper than 2-4 nestings deep
It's also funny that there is a universal solution to this problem of different preferences since ever that everyone forgets about and avoids like wildfire. Tabs.. which are consistent and the way they display is configurable without the need to reformat anything. But "nooo spaces are better"... "Hey, why don't we use 2 instead of 4?!"
Fuck this shit, Im easily annoyed this morning -_- -
I kinda like tabs better... You can set their width to anything you like in your IDE settings, you can't remove half a tab...
-
I like 4 more than 2 because it is easier to match the level of indentation visually.
With 2 spaces it is easy to jump to the wrong level while scanning with the eye vertically. -
4 spaces in Typescript and if anyone adds over 4 levels of indentation into the project I'll break their head off.
-
MrAwesome54y@SuspiciousBug I actually did this for years in a solo PHP codebase, using 3 spaces. Then one day I had to hire help, and realized how silly it was as a personal preference. Then I grew up and just started using the PHP storm PSR2/Laravel formatting preset with like... one tiny mod for readability.
-
@Xoka yeah I use eslint + prettier + vscode and my default spacing for tabs is 2 spaces only in the config
-
MrAwesome54yNext level - set your local IDE to auto format to look however you want while you work on it, and have a pre commit hook that auto formats back to the team/project standard on the way in to source control.
I was a PHP guy most of my career and likes 4 spaces in tabs. Now that I'm a JS guy now I like 2 spaces in tabs and dislikes 4 now lol. It makes coding more compact.
I don't see the reason to use 4 anymore. Do you also like 2 spaces in tabs?
rant