Top "Jslint" questions

JSLint is a "code quality" tool for JavaScript developed by Douglas Crockford, a well-known developer also responsible for JSON, JSMin, ADSafe and parts of YUI.

What's wrong with var x = new Array();

In JSLint, it warns that var x = new Array(); (That's not a real variable name) should be var result = []; What …

javascript jslint
JSLint Error: Unexpected 'this'

Having trouble understanding why JSLint is surprised by my use of this in the following code: For both property assignments, …

javascript constructor jslint
JSLint "insecure ^" in regular expression

JSLint reports Insecure '^' for the following line. Why is that? Or is it just going to complain any …

javascript regex jslint regex-negation
jsLint error: “somefunction() was used before it was defined”

Why does JSLint complain if something uses a function that hasn't been defined already? The point is that the function …

javascript jslint
What is the reason behind JSLint saying there are "too many var statements"

JSLint (with the onevar flag turned on) is flagging some javascript code that I have with the following: Problem at …

javascript refactoring jslint
Dealing with duplicate declaration warning for loop variables

Consider the following code: for (var i=0; i<100; i++) { // your code here } // some other code here for (var i=0; …

javascript jslint
Is JSLint available for offline use?

I'd like to use JSLint, but I am wary of tools that have access to my unfiltered source code. Is …

javascript compiler-errors jslint lint
Should I worry about "window is not defined" JSLint strict mode error?

This won't pass JSLint in strict mode: "use strict"; (function (w) { w.alert(w); }(window)); The error--from jslint.com--looks like …

javascript global jslint strict
JSLint with multiple files

JSLint works fine for just one JavaScript file. Recently, I've started breaking my program into several pieces. I don't want …

javascript jslint
Why does JSLint complain about "Unexpected 'else' after 'return'"?

JSLint complains that the following (useless example) code is invalid: (function (x) { "use strict"; if (x === 1) { return 1; } else if (x === 2) { …

javascript jslint