1

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?

Comments
  • 2
    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.
  • 4
    Always 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 :/
  • 2
    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.
  • 1
    As a compromise, I use 3 spaces.
  • 3
    Yes, 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 -_-
  • 3
    I might try indenting based on the Fibonacci sequence. Will discourage nesting.
  • 0
    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...
  • 0
    4 spaced tab
  • 0
    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.
  • 0
    I'm doing everything on a single line.
  • 1
    4 spaces in Typescript and if anyone adds over 4 levels of indentation into the project I'll break their head off.
  • 1
    @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.
  • 0
    @Xoka yeah I use eslint + prettier + vscode and my default spacing for tabs is 2 spaces only in the config
  • 0
    Next 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.
  • 0
    I do 8 space tabs when I have the option
Add Comment