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

873Re: JSLint forin option in scripts

Expand Messages
  • woomla
    Sep 1, 2009
      --- In jslint_com@yahoogroups.com, "douglascrockford" <douglas@...> wrote:

      > >
      > > "use strict";
      > > var prop, foo;
      > >
      > > /*jslint forin:true */
      > > for (prop in foo) {
      > > foo[prop] = "foo";
      > > }
      > > /*jslint forin:false */
      > >

      > I didn't intend for /*jslint*/ to be used this way. Mostly it just seems to work. In this case, there was an interaction with the token lookahead and block processing.
      > Let me know if you find any more cases of this.

      I always use /*jslint*/ this way. I think it is a great way to parse multiple files or one file with several scripts from different people in it. Mostly I use it to set indent.

      My work around is to put the /*jslint forin:false */ line after the next statement (or maybe even further away). That takes care of the lookahead issue. It would be great if there will be a fix for that.

      A small issue with that is that when changing a property and resetting it, you basically don't know the previous state. By trial and error you can figure it out but a nice solution would be to possibility to restore a state. (I'll post a new message for this).
    • Show all 5 messages in this topic