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

1449Re: [jslint] dot property name

Expand Messages
  • Marcel Duran
    Aug 25, 2010
      Couldn't it be optional?

      I believe this is useful when indenting long chain of methods like some
      popular JS frameworks do.

      The following although correct wouldn't be OK to JSLint:
      function func1(foo) {
      var bar = foo.
      replace('o', '0').
      replace('a', '4');
      return bar;
      }

      A possible workaround would be:
      function func2(foo) {
      var bar = foo.replace(
      'o', '0'
      ).replace(
      'a', '4'
      );
      return bar;
      }

      Not sure how developers are indenting long chains, specially jQuery ones.

      Marcel


      On Wed, Aug 25, 2010 at 3:17 PM, Douglas Crockford <douglas@...>wrote:

      >
      >
      > JSLint now requires that there be no whitespace or line break between a .
      > and a property name. This has always been a good practice, and is now
      > especially desirable because of reserved word relaxation in ES5.
      >
      >
      >



      --
      Marcel Duran


      [Non-text portions of this message have been removed]
    • Show all 9 messages in this topic