DEV Community

Cover image for 🧙‍♂️✨ Welcome to the magical world of indentation! 🌟📜
nyxb
nyxb

Posted on

🧙‍♂️✨ Welcome to the magical world of indentation! 🌟📜

🔮 Ever found yourself in a mystic quest to decide if 2 or 4 spaces is best for your new code adventure? You've come to the right place!

I could cast a spell 🪄 and tell you which of the two is the ultimate choice. But as you probably know, it's a matter of individual preference for personal/solo quests, and coding guidelines if you're embarking on an epic journey with an organization (assuming they have coding guidelines).

As a code wizard 🧙‍♂️, my choice is to wield 2-space indentation for front-end spells and 4-space indentation for backend enchantments. However, 4-space indentation can sometimes create more margin than needed. On the other hand, 2-space indentation may not provide enough space, reducing the readability of your magical incantations.

Why not harness the power of both realms? Embrace 3 spaces/tab! ⚡️ It's a no-brainer, right? The 2 and 4 space conventions have been widely adopted across the enchanted coding kingdoms. Don't waste time debating whether 3-space indentation is valid for coding. I've been using 3 spaces in my new projects, and I make sure to share this secret with my fellow adventurers at the start of each new quest.

For those interested, you can find my ESLint configuration and read about the epic battle between Prettier and ESLint in this thrilling tale: Prettier - A Double-Edged Sword for Code Formatting 🗡️

That said, I'll save the space vs tab indentation comparison for another thrilling tale.

I'd be delighted to hear your thoughts on 3 space/tab indentation in the comments section below! 📣 Thanks for joining me on this fantastic journey! 🌈

Top comments (0)