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

JSLint indentation rules (in plain text)

Expand Messages
  • Pierre Martineau
    (I apologize for the multiple posts - I did not know I could send good old plain text) Are JSLint indentation rules documented anywhere? (in particular rules
    Message 1 of 3 , Nov 15, 2011
    • 0 Attachment
      (I apologize for the multiple posts - I did not know I could send good old plain text)

      Are JSLint indentation rules documented anywhere? (in particular rules regarding objects or arrays that span multiple lines?)

      Not knowing the rules, I have tried to infer them by running test cases, but I find the results inconclusive. JSLint seems to be more permissive when the first item of an array is on the same line as the opening bracket, as tests 1 and 5 below suggest; is this a hint that this is the (less?) preferred format?

      /*jslint maxerr: 50, indent: 4 */
      var a;
      //0 pass
      a = ["a",
      "b",
      "c"
      ];
      //1 pass
      a = ["a",
      "b",
      "c"
      ];
      //2 fail
      a = ["a",
      "b",
      "c"
      ]; // Problem: Expected ']' at column 5, not column 1.
      //3 pass
      a = [
      "a",
      "b",
      "c"
      ];
      //4 fails
      a = [
      "a",
      "b",
      "c"
      ]; // Problem: Expected ']' at column 1, not column 5.
      //5 pass
      var a = ["a",
      "b",
      "c"
      ];
      //6 fail
      var a = [
      "a",
      "b", // Problem: Expected 'b' at column 9, not column 20.
      "c" // Problem: Expected 'c' at column 9, not column 13.
      ]; // Problem: Expected ']' at column 5, not column 9.
      //7 fail
      var a = ["a",
      "b",
      "c" // Problem: Expected 'c' at column 9, not column 5.
      ];
      //8 fail
      var a = [
      "a",
      "b", // Problem: Expected 'b' at column 5, not column 20.
      "c"
      ]; // Problem: Expected ']' at column 1, not column 9.


      Thanks.
    • Erik Eckhardt
      Unfortunately, due to the limitations of HTML and this email list, your indents have been lost and we don t know what you re pointing out. Try replacing the
      Message 2 of 3 , Nov 15, 2011
      • 0 Attachment
        Unfortunately, due to the limitations of HTML and this email list, your
        indents have been lost and we don't know what you're pointing out.

        Try replacing the spaces with periods. You could also try pasting in a
        non-breaking space but that is risky... maybe two versions could work.

        On Tue, Nov 15, 2011 at 8:04 PM, Pierre Martineau <pierrem@...>wrote:

        > **
        >
        >
        > (I apologize for the multiple posts - I did not know I could send good old
        > plain text)
        >
        > Are JSLint indentation rules documented anywhere? (in particular rules
        > regarding objects or arrays that span multiple lines?)
        >
        > Not knowing the rules, I have tried to infer them by running test cases,
        > but I find the results inconclusive. JSLint seems to be more permissive
        > when the first item of an array is on the same line as the opening bracket,
        > as tests 1 and 5 below suggest; is this a hint that this is the (less?)
        > preferred format?
        >
        > /*jslint maxerr: 50, indent: 4 */
        > var a;
        > //0 pass
        > a = ["a",
        > "b",
        > "c"
        > ];
        > //1 pass
        > a = ["a",
        > "b",
        > "c"
        > ];
        > //2 fail
        > a = ["a",
        > "b",
        > "c"
        > ]; // Problem: Expected ']' at column 5, not column 1.
        > //3 pass
        > a = [
        > "a",
        > "b",
        > "c"
        > ];
        > //4 fails
        > a = [
        > "a",
        > "b",
        > "c"
        > ]; // Problem: Expected ']' at column 1, not column 5.
        > //5 pass
        > var a = ["a",
        > "b",
        > "c"
        > ];
        > //6 fail
        > var a = [
        > "a",
        > "b", // Problem: Expected 'b' at column 9, not column 20.
        > "c" // Problem: Expected 'c' at column 9, not column 13.
        > ]; // Problem: Expected ']' at column 5, not column 9.
        > //7 fail
        > var a = ["a",
        > "b",
        > "c" // Problem: Expected 'c' at column 9, not column 5.
        > ];
        > //8 fail
        > var a = [
        > "a",
        > "b", // Problem: Expected 'b' at column 5, not column 20.
        > "c"
        > ]; // Problem: Expected ']' at column 1, not column 9.
        >
        > Thanks.
        >
        >


        [Non-text portions of this message have been removed]
      • Doc Emmett Splendid
        I just use pastie or similar, even within the same company: http://pastie.org/ (and now... I m hungry for a pastie) ________________________________ From: Erik
        Message 3 of 3 , Nov 15, 2011
        • 0 Attachment
          I just use pastie or similar, even within the same company:
          http://pastie.org/

          (and now... I'm hungry for a pastie)


          ________________________________
          From: Erik Eckhardt <erik@...>
          To: jslint_com@yahoogroups.com
          Sent: Tuesday, 15 November 2011, 22:03
          Subject: Re: [jslint] JSLint indentation rules (in plain text)

          Unfortunately, due to the limitations of HTML and this email list, your
          indents have been lost and we don't know what you're pointing out.

          Try replacing the spaces with periods. You could also try pasting in a
          non-breaking space but that is risky... maybe two versions could work.

          On Tue, Nov 15, 2011 at 8:04 PM, Pierre Martineau <pierrem@...>wrote:

          > **
          >
          >
          > (I apologize for the multiple posts - I did not know I could send good old
          > plain text)
          >
          > Are JSLint indentation rules documented anywhere? (in particular rules
          > regarding objects or arrays that span multiple lines?)
          >
          > Not knowing the rules, I have tried to infer them by running test cases,
          > but I find the results inconclusive. JSLint seems to be more permissive
          > when the first item of an array is on the same line as the opening bracket,
          > as tests 1 and 5 below suggest; is this a hint that this is the (less?)
          > preferred format?
          >
          > /*jslint maxerr: 50, indent: 4 */
          > var a;
          > //0 pass
          > a = ["a",
          > "b",
          > "c"
          > ];
          > //1 pass
          > a = ["a",
          > "b",
          > "c"
          > ];
          > //2 fail
          > a = ["a",
          > "b",
          > "c"
          > ]; // Problem: Expected ']' at column 5, not column 1.
          > //3 pass
          > a = [
          > "a",
          > "b",
          > "c"
          > ];
          > //4 fails
          > a = [
          > "a",
          > "b",
          > "c"
          > ]; // Problem: Expected ']' at column 1, not column 5.
          > //5 pass
          > var a = ["a",
          > "b",
          > "c"
          > ];
          > //6 fail
          > var a = [
          > "a",
          > "b", // Problem: Expected 'b' at column 9, not column 20.
          > "c" // Problem: Expected 'c' at column 9, not column 13.
          > ]; // Problem: Expected ']' at column 5, not column 9.
          > //7 fail
          > var a = ["a",
          > "b",
          > "c" // Problem: Expected 'c' at column 9, not column 5.
          > ];
          > //8 fail
          > var a = [
          > "a",
          > "b", // Problem: Expected 'b' at column 5, not column 20.
          > "c"
          > ]; // Problem: Expected ']' at column 1, not column 9.
          >
          > Thanks.

          >


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



          ------------------------------------

          Yahoo! Groups Links



          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.