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

Re: [jslint] undef not working?

Expand Messages
  • Felix E. Klee
    ... According to JSLint source code, in strict mode, the `undef` flag is set to `false: function use_strict() { if (next_token.string === use strict ) { if
    Message 1 of 3 , Aug 18, 2012
    • 0 Attachment
      On Sat, Aug 18, 2012 at 8:09 AM, ormico <tzmoore@...> wrote:
      > Is this a bug in http://jslint.com or am I misunderstanding what this
      > flag does. [...]

      According to JSLint source code, in strict mode, the `undef` flag is set
      to `false:

      function use_strict() {
      if (next_token.string === 'use strict') {
      if (strict_mode) {
      warn('unnecessary_use');
      }
      edge();
      advance();
      semicolon();
      strict_mode = true;
      option.undef = false;
      return true;
      }
      return false;
      }
    • Felix E. Klee
      Some thoughts: While in strict mode, variables need to be defined before being used, your code obviously *does not* violate that rule. So, in my opinion, what
      Message 2 of 3 , Aug 18, 2012
      • 0 Attachment
        Some thoughts: While in strict mode, variables need to be defined before
        being used, your code obviously *does not* violate that rule. So, in my
        opinion, what we see is at least a documentation bug: JSLint
        documentation should state that in strict mode, the `undef` flag is set
        to `false`.
      Your message has been successfully submitted and would be delivered to recipients shortly.