Loading ...
Sorry, an error occurred while loading the content.

Re: [jslint] Tabs vs Spaces question

Expand Messages
  • Ben White
    Typically indentation spaces/tabs are all removed when you run them through a minification process, so I personally don t care either way. I think most IDEs
    Message 1 of 15 , Mar 1 10:26 AM
    • 0 Attachment
      Typically indentation spaces/tabs are all removed when you run them through
      a minification process, so I personally don't care either way. I think most
      IDEs use spaces though. It might just be more standard across the board.
      On Mar 1, 2013 1:23 PM, "Kirk Cerny" <kirksemail@...> wrote:

      > **
      >
      >
      > I am sending this again because I can not believe their are no comments
      > about this.
      > The debate between spaces and tabs has been raging for years.
      >
      > I have been using tabs in my JavaScript because that is the convention
      > throughout
      > the web application I am working on. The application includes PHP,
      > JavaScript, CSS, HTML
      > and other languages.
      >
      > I have been JsLinting my JavaScript code for years.
      > I love JsLint.
      > Recently I have started to get the error of Use spaces, not tabs.
      > What is the reason for this?
      > What is the danger of using tabs?
      >
      > Thanks.
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >


      [Non-text portions of this message have been removed]
    • Ben White
      It supports tabs, or did historically... ... [Non-text portions of this message have been removed]
      Message 2 of 15 , Mar 1 10:33 AM
      • 0 Attachment
        It supports tabs, or did historically...
        On Mar 1, 2013 1:30 PM, "Felix E. Klee" <felix.klee@...> wrote:

        > **
        >
        >
        > On Fri, Mar 1, 2013 at 6:23 PM, Kirk Cerny kirksemail@...> wrote:
        > > What is the reason for this?
        >
        > JSLint never supported tabs, as far as I am aware of. You can specify
        > indentation (e.g. `/*jslint indent: 4 */`), but that is for spaces.
        > Possibly it would be a good idea to add another configuration option to
        > specify tabs instead of spaces, or simply: `/*jslint indent: t */`
        >
        >


        [Non-text portions of this message have been removed]
      • Kirk Cerny
        I used webarchive.org to go back and use a previous version of JsLint. The version of JsLint from 2012-10-02, about 5 months ago allows tabs instead of spaces.
        Message 3 of 15 , Mar 1 10:42 AM
        • 0 Attachment
          I used webarchive.org to go back and use a previous version of JsLint.
          The version of JsLint from 2012-10-02, about 5 months ago allows tabs
          instead of spaces.
          http://web.archive.org/web/20121002022418/http://jslint.com/

          The current version does not allow tabs.


          On Fri, Mar 1, 2013 at 11:29 AM, Felix E. Klee <felix.klee@...> wrote:

          > **
          >
          >
          > On Fri, Mar 1, 2013 at 6:23 PM, Kirk Cerny kirksemail@...> wrote:
          > > What is the reason for this?
          >
          > JSLint never supported tabs, as far as I am aware of. You can specify
          > indentation (e.g. `/*jslint indent: 4 */`), but that is for spaces.
          > Possibly it would be a good idea to add another configuration option to
          > specify tabs instead of spaces, or simply: `/*jslint indent: t */`
          >
          >
          >


          [Non-text portions of this message have been removed]
        • Doc Emmett Splendid
          Hi Kirk, I also have a strong preference for tabs, as they carry the semantic notion of one level of indentation . Usually the arguments I see in favour of
          Message 4 of 15 , Mar 1 10:48 AM
          • 0 Attachment
            Hi Kirk,

            I also have a strong preference for tabs, as they carry the semantic notion of "one level of indentation". Usually the arguments I see in favour of spaces are around people using them for stylistic formatting rather than indentation, such as aligning all the colons in object notation:

            ~~~~~~~someProperty : "blah",
            ~~someOtherProperty : "blah",
            ~~~~~~~~~~~~~~~~foo : "bar"

            ...which I personally think is silly, ugly and hard to maintain. The use of tabs encourages semantic indentation over that sort of nonsense.

            There's also the matter that I've seen people use nearly every possible NUMBER of spaces for indentation, and insist that their way is the only way of doing it. Specifically, I've been on projects where the number of spaces for a "level of indentation" was 1, 2, 3, 4, 5, 6 or 8 spaces (7 being the one I'm still waiting to see). So the argument isn't even "spaces vs tabs", but "tabs vs 1 space vs 2 spaces vs 3 spaces vs..." and so on.

            That much said, I tend to use spaces much of the time, because most *teams* use spaces. I gave up the fight for semantic indentation as lost years ago. In essence, I'm on your side, but the real world has declared that indentation should be artificial and arbitrary. JSLint is just affirming that, and as it's a real-world-focused tool, it's probably right.

            Emmett


            ________________________________
            From: Kirk Cerny <kirksemail@...>
            To: jslint_com <jslint_com@yahoogroups.com>
            Sent: Friday, 1 March 2013, 10:23
            Subject: [jslint] Tabs vs Spaces question


             
            I am sending this again because I can not believe their are no comments
            about this.
            The debate between spaces and tabs has been raging for years.

            I have been using tabs in my JavaScript because that is the convention
            throughout
            the web application I am working on. The application includes PHP,
            JavaScript, CSS, HTML
            and other languages.

            I have been JsLinting my JavaScript code for years.
            I love JsLint.
            Recently I have started to get the error of Use spaces, not tabs.
            What is the reason for this?
            What is the danger of using tabs?

            Thanks.

            [Non-text portions of this message have been removed]




            [Non-text portions of this message have been removed]
          • Felix E. Klee
            ... Seems like you are right. I just tested with a minimalist example, where `use strict` is indented with a single tab: (function () { use strict ; }());
            Message 5 of 15 , Mar 1 10:51 AM
            • 0 Attachment
              On Fri, Mar 1, 2013 at 6:42 PM, Kirk Cerny <kirksemail@...> wrote:
              > The version of JsLint from 2012-10-02, about 5 months ago allows tabs
              > instead of spaces.

              Seems like you are right. I just tested with a minimalist example,
              where `use strict` is indented with a single tab:

              (function () {
              'use strict';
              }());

              There is no error message with the JSLint version you referred to,
              while the current version reports two error messages:

              "Use spaces, not tabs."
              "Expected 'use strict' at column 5, not column 2."
            • Felix E. Klee
              On Fri, Mar 1, 2013 at 6:48 PM, Doc Emmett Splendid ... Not to start an argument here, but don t you think that this semantic information is redundant? In a
              Message 6 of 15 , Mar 1 10:56 AM
              • 0 Attachment
                On Fri, Mar 1, 2013 at 6:48 PM, Doc Emmett Splendid
                <emmett.thesane@...> wrote:
                > I also have a strong preference for tabs, as they carry the semantic notion [...]

                Not to start an argument here, but don't you think that this semantic
                information is redundant?

                In a language like JavaScript or C, I see the purpose of indentation
                primarily to make code easier to read. In languages such as Python
                it's different, but then there is no discussion.
              • Ben White
                Previously it would only warn you if you used both spaces and tabs. ... [Non-text portions of this message have been removed]
                Message 7 of 15 , Mar 1 11:06 AM
                • 0 Attachment
                  Previously it would only warn you if you used both spaces and tabs.
                  On Mar 1, 2013 1:56 PM, "Felix E. Klee" <felix.klee@...> wrote:

                  > **
                  >
                  >
                  > On Fri, Mar 1, 2013 at 6:48 PM, Doc Emmett Splendid
                  > emmett.thesane@...> wrote:
                  > > I also have a strong preference for tabs, as they carry the semantic
                  > notion [...]
                  >
                  > Not to start an argument here, but don't you think that this semantic
                  > information is redundant?
                  >
                  > In a language like JavaScript or C, I see the purpose of indentation
                  > primarily to make code easier to read. In languages such as Python
                  > it's different, but then there is no discussion.
                  >
                  >


                  [Non-text portions of this message have been removed]
                • Jakob Kruse
                  Actually, prior to the creation of the indent option, jslint only supported one tab or four spaces for indentation. Personally I only use spaces because
                  Message 8 of 15 , Mar 1 1:26 PM
                  • 0 Attachment
                    Actually, prior to the creation of the indent option, jslint only supported "one tab" or "four spaces" for indentation. Personally I only use spaces because every single tab indented file I have ever seen has at some point gotten some level of space indentation added, and since different users display one tab as a different amount of spaces, it always ends up destroying the indentation.

                    I would be very keen on hearing Mr. Crockfords reasoning though.

                    /Jakob

                    Den 01/03/2013 kl. 19.30 skrev "Felix E. Klee" <felix.klee@...>:

                    > On Fri, Mar 1, 2013 at 6:23 PM, Kirk Cerny kirksemail@...> wrote:
                    > > What is the reason for this?
                    >
                    > JSLint never supported tabs, as far as I am aware of. You can specify
                    > indentation (e.g. `/*jslint indent: 4 */`), but that is for spaces.
                    > Possibly it would be a good idea to add another configuration option to
                    > specify tabs instead of spaces, or simply: `/*jslint indent: t */`
                    >


                    [Non-text portions of this message have been removed]
                  • Kirk Cerny
                    I am not sure what you mean as one tab. Did you try it in the JsLint version from 5 months ago. It accepts my code file tat has at least 5 tab levels of
                    Message 9 of 15 , Mar 1 1:31 PM
                    • 0 Attachment
                      I am not sure what you mean as one tab.
                      Did you try it in the JsLint version from 5 months ago.
                      It accepts my code file tat has at least 5 tab levels of indentation.

                      http://web.archive.org/web/20121002022418/http://jslint.com/


                      On Fri, Mar 1, 2013 at 2:26 PM, Jakob Kruse <kruse@...> wrote:

                      > **
                      >
                      >
                      > Actually, prior to the creation of the indent option, jslint only
                      > supported "one tab" or "four spaces" for indentation. Personally I only use
                      > spaces because every single tab indented file I have ever seen has at some
                      > point gotten some level of space indentation added, and since different
                      > users display one tab as a different amount of spaces, it always ends up
                      > destroying the indentation.
                      >
                      > I would be very keen on hearing Mr. Crockfords reasoning though.
                      >
                      > /Jakob
                      >
                      > Den 01/03/2013 kl. 19.30 skrev "Felix E. Klee" felix.klee@...>:
                      >
                      > > On Fri, Mar 1, 2013 at 6:23 PM, Kirk Cerny kirksemail@...> wrote:
                      > > > What is the reason for this?
                      > >
                      > > JSLint never supported tabs, as far as I am aware of. You can specify
                      > > indentation (e.g. `/*jslint indent: 4 */`), but that is for spaces.
                      > > Possibly it would be a good idea to add another configuration option to
                      > > specify tabs instead of spaces, or simply: `/*jslint indent: t */`
                      > >
                      >
                      > [Non-text portions of this message have been removed]
                      >
                      >
                      >


                      [Non-text portions of this message have been removed]
                    • Kirk Cerny
                      I (the person that asked the question in the first place) like to use spaces. But the code base I am currently on uses tabs. ... [Non-text portions of this
                      Message 10 of 15 , Mar 1 4:08 PM
                      • 0 Attachment
                        I (the person that asked the question in the first place) like to use
                        spaces.
                        But the code base I am currently on uses tabs.


                        On Fri, Mar 1, 2013 at 12:06 PM, Ben White <ben.a.white@...> wrote:

                        > **
                        >
                        >
                        > Previously it would only warn you if you used both spaces and tabs.
                        >
                        > On Mar 1, 2013 1:56 PM, "Felix E. Klee" felix.klee@...> wrote:
                        >
                        > > **
                        > >
                        > >
                        > > On Fri, Mar 1, 2013 at 6:48 PM, Doc Emmett Splendid
                        > > emmett.thesane@...> wrote:
                        > > > I also have a strong preference for tabs, as they carry the semantic
                        > > notion [...]
                        > >
                        > > Not to start an argument here, but don't you think that this semantic
                        > > information is redundant?
                        > >
                        > > In a language like JavaScript or C, I see the purpose of indentation
                        > > primarily to make code easier to read. In languages such as Python
                        > > it's different, but then there is no discussion.
                        > >
                        > >
                        >
                        > [Non-text portions of this message have been removed]
                        >
                        >
                        >


                        [Non-text portions of this message have been removed]
                      • Jakob Kruse
                        What I mean is that it did not support using two or more tab characters to represent one level of indentation. One level, back then, had to be exactly one tab
                        Message 11 of 15 , Mar 2 3:13 AM
                        • 0 Attachment
                          What I mean is that it did not support using two or more tab characters to represent one level of indentation. One level, back then, had to be exactly one tab character or exactly four space characters. I was one of the people that asked for an option to allow any number of space characters.

                          /Jakob

                          Den 01/03/2013 kl. 22.32 skrev "Kirk Cerny" <kirksemail@...>:

                          > I am not sure what you mean as one tab.
                          > Did you try it in the JsLint version from 5 months ago.
                          > It accepts my code file tat has at least 5 tab levels of indentation.
                          >
                          > http://web.archive.org/web/20121002022418/http://jslint.com/
                          >
                          >
                          > On Fri, Mar 1, 2013 at 2:26 PM, Jakob Kruse <kruse@...> wrote:
                          >
                          >> **
                          >>
                          >>
                          >> Actually, prior to the creation of the indent option, jslint only
                          >> supported "one tab" or "four spaces" for indentation. Personally I only use
                          >> spaces because every single tab indented file I have ever seen has at some
                          >> point gotten some level of space indentation added, and since different
                          >> users display one tab as a different amount of spaces, it always ends up
                          >> destroying the indentation.
                          >>
                          >> I would be very keen on hearing Mr. Crockfords reasoning though.
                          >>
                          >> /Jakob
                          >>
                          >> Den 01/03/2013 kl. 19.30 skrev "Felix E. Klee" felix.klee@...>:
                          >>
                          >>> On Fri, Mar 1, 2013 at 6:23 PM, Kirk Cerny kirksemail@...> wrote:
                          >>>> What is the reason for this?
                          >>>
                          >>> JSLint never supported tabs, as far as I am aware of. You can specify
                          >>> indentation (e.g. `/*jslint indent: 4 */`), but that is for spaces.
                          >>> Possibly it would be a good idea to add another configuration option to
                          >>> specify tabs instead of spaces, or simply: `/*jslint indent: t */`
                          >>
                          >> [Non-text portions of this message have been removed]
                          >
                          >
                          > [Non-text portions of this message have been removed]
                          >
                          >
                          >
                          > ------------------------------------
                          >
                          > Yahoo! Groups Links
                          >
                          >
                          >
                        • Merlin
                          Please see my post of Sun Oct 24, 2010 4:01 pm http://tech.groups.yahoo.com/group/jslint_com/message/1562 Harry.
                          Message 12 of 15 , Mar 2 4:18 AM
                          • 0 Attachment
                            Please see my post of Sun Oct 24, 2010 4:01 pm

                            http://tech.groups.yahoo.com/group/jslint_com/message/1562

                            Harry.
                          Your message has been successfully submitted and would be delivered to recipients shortly.