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

Re: [jslint] JSLint doesn't check if global variables are used.

Expand Messages
  • pauanyu
    ... I agree, but the idea was to be more of a helpful hint. If you declare a variable but don t use it, JSLint doesn t throw an error. Instead, it lists the
    Message 1 of 10 , May 5, 2009
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "Jakob Kruse" <kruse@...> wrote:
      >
      > Yes, really. I fail to see why I would want to reference the global from within its own declaration?
      >
      > That said, this discussion has gotten quite a bit off track. The only possible purpose of declaring a global variable/function/object/whatever is so that it can be accessed globally â€" from everywhere, and in particular, from elsewhere. I find the current behavior of JSLint (not forcing me to declare globals twice for clarity) to be correct. Declaring a global in some file and not using it in that file (but possibly in every other file loaded) should not result in errors or warnings.
      >
      > /Jakob
      >

      I agree, but the idea was to be more of a helpful hint. If you declare a variable but don't use it, JSLint doesn't throw an error. Instead, it lists the Unused variables in the useful summary at the bottom.

      Although it would be great to have this same helpful hint with global variables, it's been shown in this thread that such a system would almost certainly be needlessly complex, without very much gain.
    Your message has been successfully submitted and would be delivered to recipients shortly.