Re: Processing of Tabs
- --- In firstname.lastname@example.org, "Jakob Kruse" <kruse@...> wrote:
>Tabs are not just bad , they are awful. They have been a source of trouble from the early
> I think it would be simpler, and probably better, if jslint could
> "enforce" (check that is) and either-or policy: either indentation is
> performed using spaces alone, or it is performed using tabs alone.
> In case of spaces we now already have an option to adjust the amount
> of spaces used per level. In the case of tabs, exactly one tab
> character per indent level should be the only acceptable content.
> Mixing tab and space characters for indentation is a bad, bad practice
> that will always lead to incorrectly indented code as people edit with
> different tab stop settings. If tabs and spaces are not mixed, there
> is really no reason for jslint to "detab" a file.
days of computers. Unless you know where the tab-stops were placed while the text was
being created, you can't reconstruct the layout of a line of text. Word processors
remember where the tab-stops were placed, plain text editors (in general) do not.
However, most text editors allow the use of tabs, and it is not apparent whether a
particular visible indentation was caused by tabs or spaces or some combination of the
If my text looks correct in my favorite text editor, I want it to be accepted as such by
One solution would be for JSLint to regard tabs as illegal and to insist on spaces only.
In that case, I could detab my text before presenting it to JSLint. My favorite editor will do
that for me - it knows where the tab-stops were placed.
I greatly dislike the idea of having single tabs denote indentation. To use that reliably, I
would have to have the editor make tabs visible. I really do not want that.
The "standard" detab solution has been around for about 40 years. I much prefer it,
although it does mean that you need to know the tab-stops or tab interval.
In text to be presented to JSLint it would be simple enough to have a
/*jslint tabstops: 4 */
Less satisfactory would be to assume that the tab interval was the same as the indentation