How to suppress “{variable} is better written in dot notation.”

If it’s a feature and not a bug, place this at the top of your file. /*jshint sub:true*/ If it’s a bug, you should refactor your code foo[‘tracker’] = bar // from this… foo.tracker = bar; // to this! Good post on the reasons here: https://stackoverflow.com/a/2001410/94668 As suggested by: @ThorSummoner you can use below in … Read more

Jshint.com requires “use strict”. What does this mean? [duplicate]

Add “use strict” at the top of your js file (at line 1 of your .js file): “use strict”; … function initialize_page() { var signin_found; /*Used to determine which page is loaded / reloaded*/ signin_found=document.getElementById(‘signin_button’); if(signin_found) { More about “use strict” in another question here on stackoverflow: What does “use strict” do in JavaScript, and … Read more

Why is JSHINT complaining that this is a strict violation?

JSHint says “Possible strict violation” because you are using this inside something that, as far as it can tell, is not a method. In non-strict mode, calling gotoPage(5) would bind this to the global object (window in the browser). In strict mode, this would be undefined, and you would get in trouble. Presumably, you mean … Read more

How to disable the warning ‘define’ is not defined using JSHint and RequireJS

Just to expand a bit, here’s a .jshintrc setup for Mocha: { …. “globals” : { /* MOCHA */ “describe” : false, “it” : false, “before” : false, “beforeEach” : false, “after” : false, “afterEach” : false } } From the JSHint Docs – the false (the default) means the variable is read-only. If you … Read more