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

1451Re: [jslint] dot property name

Expand Messages
  • Mark Volkmann
    Aug 25, 2010
      On Wed, Aug 25, 2010 at 5:44 PM, Marcel Duran <contact@...> wrote:
      > 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;
      > }

      This is how I indent long chains of method calls.

      > 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

      --
      R. Mark Volkmann
      Object Computing, Inc.
    • Show all 9 messages in this topic