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

Re: Strict white space bug?

Expand Messages
  • biggeleben
    ... Ok, that s a pragmatic solution :) However, the Strict Whitespace option is very helpful. Please think of tons of code and a bunch of developers of which
    Message 1 of 6 , Dec 30, 2010
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
      >
      >> [...]
      >
      > JSLint doesn't like silly indentation schemes.
      > Turn off the Strict Whitespace option.
      >

      Ok, that's a pragmatic solution :) However, the "Strict Whitespace" option is very helpful. Please think of tons of code and a bunch of developers of which some always need a punch to remember code conventions. Turning off that option reopens the door for messy code. Have you ever thought about splitting up this particular option into "Strict Whitespace" and "Strict indentation"?

      I just downloaded the JSLint code and played around a bit. The indentation check relies on "option.white" as well. Patching that single if clause keeps "Strict Whitespace" turned on without caring about indentation. That would be so great as a permanent feature!

      For complex JQuery chains, we still need those "silly" indentation schemes to get readable code. I could patch the JSLint code to even work with silly indentation (just an experiment). But afterwards, I recognized that strict indentation might be not as important as using "inline white spaces" properly, since developers tend to indent things right at least on the block level.
    • spence.randall@ymail.com
      Given the following code (view with fixed width): var tester = (function () { var names = Alex,Brandon,Carl + Don,Edward,Frank,Gale +
      Message 2 of 6 , Apr 28 1:22 PM
      • 0 Attachment
        Given the following code (view with fixed width):

        var tester = (function () {
        var names = 'Alex,Brandon,Carl' +
        'Don,Edward,Frank,Gale' +
        'Hank,Ian,Jack,Ken,Leo'.split(','),
        other = function (test) {
        var string = '';
        return string + test;
        };
        return {
        names: names,
        other: other
        };
        }());

        JSLint reports Error:

        Problem at line 6 character 13: Expected 'var' at column 17, not column 13.
        Problem at line 7 character 13: Expected 'return' at column 17, not column 13.
        Problem at line 8 character 9: Expected '}' at column 13, not column 9.

        Change the code to this:

        var tester = (function () {
        var names = 'Alex,Brandon,Carl,Don,Edward,Frank,Gale,Hank,Ian,Jack,Ken,Leo'.split(','),
        other = function (test) {
        var string = '';
        return string + test;
        };
        return {
        names: names,
        other: other
        };
        }());

        And it doesn't produce an error.
      • Douglas Crockford
        Thanks for pointing out those two problems. Please try it now.
        Message 3 of 6 , Apr 28 2:23 PM
        • 0 Attachment
          Thanks for pointing out those two problems. Please try it now.
        Your message has been successfully submitted and would be delivered to recipients shortly.