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

1733Re: [jslint] New Edition

Expand Messages
  • Felix E. Klee
    Jan 8, 2011
    • 0 Attachment
      On Sat, Jan 8, 2011 at 1:17 AM, Douglas Crockford
      <douglas@...> wrote:
      > at the moment, JSLint does not consider indentation

      In fact that's a very good omission. The last version would report that
      the following code is not properly indented. Reason: the return
      statements are not positioned on a multiple of 4 spaces, if that is the
      indentation depth.

      f(x,
      function() {
      return 1;
      });
      f2(x,
      function() {
      return 2;
      });

      But:

      1. The fix is strange to read:

      f(x,
      function() {
      return 1;
      });
      f2(x,
      function() {
      return 2;
      });

      2. Specifying this indentation rule to auto-indenting editors is
      impossible or at least non-trivial.

      > This is a big change. All of my code looks good on the new edition,
      > but I haven't tested with yours. If I broke something, please report
      > it. Thank you.

      Seems to work great over here, thanks! I only had to correct the
      placement of some curly braces. But I understand that this is necessary
      for avoiding trouble with automatic semicolon insertion. Example:

      if (x == 1 &&
      y == 2)
      { // <-- better readable here, but to be avoided due to JS limitations
    • Show all 12 messages in this topic