Use these settings in JSHint to avoid instanity:
1 2 3 4
If you have settings that apply to only your test environment you can put those in
test/.jshintrc (maybe allowing global var for your test function) .. you can extend a confiuration in another file with this option `”extends” : “../.jshintrc”
Sometimes you just can’t please everyone, including the linter. Here’s how to ignore blocks or lines from the linter:
To ignore a block of code use
1 2 3
to just ignore a single line:
Obviously you shouldn’t let the linter ignore code but you may have a good reason to do so.
Handy thing to have in your .jshintrc file:
1 != “1” right? comparing a number to a string? no, JS says sure its the same using automatic type conversion. Use this flag to warn you and remind you to use triple equals to not do automagic type conversion.
This was just a neat thing I learned today, in JS switch/case statements you need to do a return or break or you will fall through to the next option. Leave a note for the next guy that says you did mean to fall through with a comment
/* falls through */ and you will silence the warning from jslint. Kinda cool, huh?
Thanks for humoring me as I write these notes to myself :)