Skip to content
markdown guide

Its 2020, stop talking about it and start using editorconfig.


You are absolutely right. The question is though: should we put tabs or spaces in the config? ;-)


Whatever you feel like it. It doesnt matter. And if project already has one, forget about it and do your job.


I was about reply the same :p

Using config is fine.!


I'm collaborating with different projects.

I'm using the tabs in some project and space in some project

Editor config saving me daily. Without mixing up I'm using target things properly.


I use spaces because I stick to conventions, but I would prefer tabs because:

  • That the purpose of tabs.
  • Count as one character.
  • Accessibility: IDEs can display tabs with selected width.

I read a post about a guy with a severe sight issue, who, to be able to code, had a very large font size configured in his IDE.
But at this font size, four spaces are huge, and he had to scroll horizontally all the time.
So each time he edited a file, he changed spaces to tabs (which were displayed with a width of one space), and changed back tabs to spaces before to commit !

For most of us, the battle of tabs vs spaces is totally vain.
For some of us, it can change their everyday experience.


Thank you so much for bringing this reason to my attention.

I will use tabs for all my indentation going forward.


I use spaces, but I've heard a compelling argument favouring tabs.

Tab width can be customized easily in any editor. This is useful for people with visual impairments:

If someone needs larger fonts, then, to fit relevant code in the screen, reducing the tab width might help. With spaces, this kind of customization is hard to accomplish.

This same argument works for 80 character lines.

In the end, I don't really care. I would gladly switch to tabs if that helps people with visual impairments to contribute to open source or private code bases. I only care about consistency.


Use Go so you don't have to decide 😂

The formatting tool uses tabs and that's the standard

I use spaces in all the other languages but I'm super okay with Go which decided to kill this conversation from day 1 😂


Spaces. IDEs can be configured to show tabs differently, so what one person sees on their machine might not be the same as someone else. Then diffs in source control are confusing.

Use the tab key and set your IDE to convert them to spaces on the fly. Best of both worlds.


IDEs showing tabs how I like is a good thing! If the code base has 2 space indentation, why should I be forced to view my code that way if my IDE can just display it with 4 spaces and commit to GitHub with 2 spaces?


This is really only a problem when tabs and spaces are mixed in the same file.

You have your IDE set to show tabs as 2 spaces, I have mine set to 4.

Original code is:

(\t)(\t)function sayHello() {

You see:

    function sayHello() {

I see:

        function sayHello() {

The problem is inconsistency across different development environments. After seeing some of the comments about tabs for those with visual impairment, I might have had my mind changed here though.


if my IDE can just display it with 4 spaces and commit to GitHub with 2 spaces?

I thought you were using tabs? If you're converting tabs to spaces at the time you commit, then you're still commiting spaces. I'd be plenty happy with that as well.

Sorry for the confusion, when I say 4 spaces vs 2 spaces, I mean the tab character \t displays as that number of spaces.

There is no conversion, the linter keeps everything as tabs so there's to worry of mixing tabs and spaces and everyone can display their indentation how they like.

I think this entire debate isn't really worth discussing given the current state of linting/developer tooling.

I would agree if I hadn't seen so much production code with issues like the examples I gave. It seems trivial, but it's a mess when the code is more complex than a simple alert('hello');.

I totally agree this debate is irrelevant IF everyone would use the tooling available though.

I prefer tabs

And 2*2 config

Means size of tab


I remember hearing about this topic being discussed in the syntaxfm podcast episode Hasty treat - Bike Shedding.

I’m for tabs, however, it probably doesn’t matter which one you actually use.


I don't think there's any technical aspect to consider. It boils down to preference mostly. Sure, arguments can be done for both sides, like tabs being awesome because everyone can configure the desired tab length in their code editor, or horrible because they show as eight spaces in GitHub pull-requests. But I have never heard an argument for either side that had any real technical implications.


The issue arose from a number of factors, but primarily boils down to the visual differences which occur in badly configured IDEs

I personally use the tab key to indent, but configure my IDE based on the linting rules of the project I am working on.


It really dosnt matter, as long as a code base is maintained and standardized.
There is literally nothing worse than seeing a Tabs Vs Spaces comment on a PR, I would hate to know how much time effort and frustration and company times has been lost to this argument.


I’m all for tabs. Tabs are semantically meant for indentation and count as 1 character vs the 4 spaces thus resulting in smaller file sizes


hmmmm.... your raw files accessed without any compilation? In general everything I work has some form of minification step involved, it makes zero difference to size or perf.


I like spaces because when i copy paste something to terminal some time tabs caused errors. especially in ruby console

Classic DEV Post from Feb 14

CSS in JS - have we done something wrong?

Hello folks, its not standard for me article, as I prefer to not get into these kind of discussions,...

Pandiyan Murugan profile image
Click the follow to get more interesting content!