According to the JSHint website it is "an open-source project that is supported and maintained by the JavaScript developer community.". However, the license still contains the following clause: "The Software shall be used for Good, not Evil." So it is not using an OSI approved license, and a such I would not consider it open source. That clause adds a restriction on how you can use the software, and a very vague rest…
JSHint: An Community Driven Fork of JSLint
11–20 of 30 posts
Re: JSHint: An Community Driven Fork of JSLint
#12According to the JSHint website it is "an open-source project that is supported and maintained by the JavaScript developer community.". However, the license still contains the following clause: "The Software shall be used for Good, not Evil." So it is not using an OSI approved license, and a such I would not consider it open source. That clause adds a restriction on how you can use the software, and a very vague rest…
Re: JSHint: An Community Driven Fork of JSLint
#13Earlier quoted context omitted.
Is there any reference for the reasoning behind error-ing on the standard for loop?
It's concerned about the declaration of i within the loop's first term. Since JavaScript only has function-level scope, that variable leaks into the broader context, which can lead to unexpected behavior.
Re: JSHint: An Community Driven Fork of JSLint
#14Re: JSHint: An Community Driven Fork of JSLint
#15Earlier quoted context omitted.
I think Crockford is right about that error. Declaration of variables in the loop could lead to this type of error: http://cam.ly/blog/2011/01/javascript-interview-question/ (All of the 4 will do alert('4') when clicked, when the programmer expects alert('1'), alert('2'), etc.) If the variable had been declared at the top, that error probably would not happen.
That error would have happened despite if the var was declared at the top or in the loop addEventListener("stuff", function() { return function(index) { alert(index); } }(i); is the fix, either way
Re: JSHint: An Community Driven Fork of JSLint
#16One thing I hated about jslint is that it would exit after catching a few "errors" too many, even if the errors were not actually syntactically incorrect. it's basically impossible to use if you're using jslint over large js projects that you don't own (I rarely go into someone else's js library to fix all of jslint's complaints!) I'm guessing Crockford's code is extremely pristine, or that he's never used anyone els…
/*jshint maxerr:1000 */
I should probably add it to the docs on jshint.com.Re: JSHint: An Community Driven Fork of JSLint
#17Re: JSHint: An Community Driven Fork of JSLint
#18Earlier quoted context omitted.
It's concerned about the declaration of i within the loop's first term. Since JavaScript only has function-level scope, that variable leaks into the broader context, which can lead to unexpected behavior.
Not if you actually, you know, know what you're doing. This dumbing down of programming does not work--if you have clueless people working on code, it'll end up broken, no matter how many tool-enforced 'best practices' they follow.