Widget Tester Widget (version 8.2) with JSLint 2009-04-30 is now at http://tinyurl.com/5unocx . This version has the option to download and use the latest...
var global; (function () { var local; }()); Note that it lists local as Unused, but not global. I'm not sure if this is considered a bug or not, but it seems a...
In a formal sense, it's a bug, but how could it be fixed? A global variable might be used by a different script, or by a bit of Javascript in an event...
test = function () {}; self.test = function () {}; window.test = function () {}; test(); JSLint sees the first three lines as different, even though they are...
The /*global */ tag solves the reverse problem: how tell if a variable used here is declared elsewhere. Perhaps we need a /*external */ tag that asserts a...
... Yes, and there's an "assume a browser" option that specifies browser objects (like window). You also don't need a var to declare a global variable, but...
Actually, that is very common. The purpose of most libraries is to declare global variables for use elsewhere. /Jakob From: jslint_com@yahoogroups.com...
Again, the ”assume a browser” option of JSLint, AFAIK, only means that you don’t have to explicitly define the global object “window” and others. It...
... What are you proposing, that JSLint not allow access to window and self when assuming a browser? I think that is a reasonable restriction. A better...
... Using JavaScript also in a server-side context, "test", "self.test" and "window.test" are three different things. For me the actual behaviour is ok. ...
... No, my proposal is that since declaring a global variable with var is exactly the same as assigning a property to the window object, JSLint should be...
Declaring a global variable with var is not the same as assigning a property to the window object. In a browser, the two actions have the same effect, but a....
You're right, of course, but even a library should avoid polluting the global names space any more than necessary. I prefer to have all the library's...
... Yes, you do. Without "var", you're not creating a variable, but a property of the global object, which in the case of browsers is window (aka self). ... ...
The "Assume a browser" no longer supplies 'window' and 'self'. Having multiple representations of global variable access is a source of confusion. When feature...
Douglas, I appreciate your diligence in keeping the list up-to-date with the latest changes as you deploy them. Is there any chance that you could be persuaded...
... In your example, if foo is not declared, it will result in a ReferenceError being thrown. This won't happen if you test with the typeof operator. I think...
Hello! I think really neat would be something that generates the jslint-options-string (/*jslint ... */). I am writing a small Javascript Library and had the...
... I see; thank you. Another question, why use: if (typeof console === 'object') { Instead of: if (console instanceof Object) { ? As far as I know, if...
I disagree. Not with the ”single object” approach, that is a very good practice, but that libraries usually refer to themselves. I have a multitude of...
Really? Your libraries never have externally available functions or data that they themselves use? You could always do this, I suppose: var myModule = (...
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...
... 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...
Internet Explorer has a window.execScript() method that basically does the same thing as eval(), except that it always executes scripts in the global scope: ...