-
-
Save munro/3100600 to your computer and use it in GitHub Desktop.
/*jshint undef: false */ | |
var hello = 123, | |
world = 3421; | |
foo = 321, | |
bar = 421; | |
// passes! |
var hello = 123, | |
world = 3421, | |
foo = 321, | |
bar = 421; |
var hello = 123, | |
world = 3421; | |
window.foo = 321, | |
window.bar = 421; |
/*jslint undef: true */ | |
var hello = 123, | |
world = 3421; | |
foo = 421; | |
/** | |
* Fails: | |
* Expected 'foo' at column 1, not column 5. | |
* foo = 421; | |
*/ |
This result was expected.
To be fair undef: false
is a terrible option, but that's why people use JSHint, they like their warm_and_fuzzy
flags.
I don't think you know what to be fair
means. When JSHint was forked JSLint shared the exact same behavior (undef
was false by default) and we don't like to break backwards compatibility.
Aw yea! I thought undef
existed in JSLint, but I didn't find it after looking for a second. I have to manipulate the example a bit, because JSLint doesn't allow ,
in statements. But anyways, this is where JSLint is superior, because indentation leads to certain expectations. Though, expectations are subjective. ;)
I actually was typing "To be fair, JSLint has this option ...", but I couldn't find it after looking at their site for a second. But you found it! 'Cause somebody on the internet is wrong, dammit! Also, your comment about expectations leads to some interesting concepts on why I believe JSLint to be superior to JSHint and CoffeeScript when it comes to writing quality JavaScript code. I'll distill my thoughts in a blog post later this week.
Woo, I broke it for real this time! I couldn't remember the exact syntax I encountered in the wild.