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

2678Re: [jslint] JSLint indentation rules (in plain text)

Expand Messages
  • Erik Eckhardt
    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]
    • Show all 3 messages in this topic