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

2129Re: [jslint] Re: jslint.com issue: copy&paste of displayed /*jslint ... */ line doesn't work as expected

Expand Messages
  • Ger Hobbelt
    Apr 9, 2011
    • 0 Attachment
      On Sat, Apr 9, 2011 at 2:27 PM, Douglas Crockford <douglas@...>wrote:

      > The option object is used to determine the settings. It is overridden by
      > the /*jslint*/ directive. Any setting that is not mentioned in either is
      > assumed to be false.
      >

      Yeah, that's what I thought. Still, we might talk about slightly different
      things here and what you say does not match the behaviour I'm observing:

      Note, please, that I mention the jslint.com *website* so it's not an issue
      with the jslint standalone script, but with the jslint.com website only!
      Using the sample code I provided, it actually (on the site!) behaves like
      this: (>>>><<<< emphasis mine)

      test case #1:

      NOT providing any /*jslint*/ line with the code to be linted.

      Result: behaves exactly as when you'ld have this at the top: (1 error)
      /*jslint undef: false, browser: false, maxerr: 50, indent: 4, white:
      >>>>false<<<< */

      Good.


      test case #2:

      manually ticking the 'disallow unused variables' and 'assume browser' items;
      NOT any /*jslint*/ in the code.

      Result: behaves exactly as when you'ld have this at the top: (no errors)
      /*jslint undef: true, browser: true, maxerr: 50, indent: 4, white:
      >>>>false<<<< */

      Good.

      Note that the /*jslint*/ shown at the bottom of the web page now says:
      /*jslint undef: true, browser: true, maxerr: 50, indent: 4 */



      Assumption: copying that /*jslint*/ line into the code should behave like #2
      again, as we wouldn't really change _anything_; just copying the options
      block settings into the code.
      So:


      test case #3:

      This /*jslint*/ at the top of the code:
      /*jslint undef: true, browser: true, maxerr: 50, indent: 4 */

      Result: behaves exactly as when you'ld have this at the top:
      /*jslint undef: true, browser: true, maxerr: 50, indent: 4, white:
      >>>>true<<<< */

      *BAD*

      I did NOT set the 'strict whitespace' setting _anywhere_ on that page, yet
      it automagically kicks in now. I _have_ to explicitly add 'white: false' in
      the /*jslint*/ to get the #2 behaviour again.



      test case #4:

      This /*jslint*/ at the top of the code:
      /*jslint undef: true, browser: true, maxerr: 50, indent: 4, white:
      >>>>false<<<< */

      Result: behaves exactly like #2.

      Good.



      Unless I completely misunderstood, then this behaviour (#3 vs. #2 & #1) is
      not matching

      > The option object is used to determine the settings. It is overridden by
      > the /*jslint*/ directive. Any setting that is not mentioned in either is
      > assumed to be false.
      >
      > as 'strict whitespace' ('white') is not mentioned in the /*jslint*/
      included at the top of the code, while the option section has the checkbox
      _unchecked_, so it should read as 'white:false', but acts as 'white:true'
      instead. And in case you mean something else _entirely_ with the words
      'option object' (and it has white:true as a preset in there), then it still
      behaves counter to the rest of your line, as it should have identical
      behaviour for #2 and #3 (and #1 as well, with respect to the 'strict
      whitespace' setting, that is). Looks like a bug to me. Tell me I screwed
      up all the way, or can you reproduce the issue?



      (Tested with both Safari5 and FF3)


      --
      Met vriendelijke groeten / Best regards,

      Ger Hobbelt

      --------------------------------------------------
      web: http://www.hobbelt.com/
      http://www.hebbut.net/
      mail: ger@...
      mobile: +31-6-11 120 978
      --------------------------------------------------


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