--- jslint.js 2014-07-08 21:12:20.000000000 +0200 +++ lib/core/JSLint.js 2014-07-25 21:41:33.883288847 +0200 @@ -1,3 +1,4 @@ +/*global core*/ // jslint.js // 2014-07-08 @@ -183,7 +184,9 @@ // closure true, if Google Closure idioms should be tolerated // continue true, if the continuation statement should be tolerated // debug true, if debugger statements should be allowed +// defined true, if already defined variables are allowed // devel true, if logging should be allowed (console, alert, etc.) +// emptyblock true, if empty blocks should be allowed // eqeq true, if == should be allowed // evil true, if eval should be allowed // forin true, if for in statements need not filter @@ -203,6 +206,7 @@ // stupid true, if really stupid practices are tolerated // sub true, if all forms of subscript notation are tolerated // todo true, if TODO comments are tolerated +// unvar true, if unused variables should be tolerated // vars true, if multiple var statements per function should be allowed // white true, if sloppy whitespace is tolerated @@ -213,6 +217,7 @@ // For example: /*properties + defined, emptyblock, unvar, JSLINT, JSLint, core, '\b', '\t', '\n', '\f', '\r', '!', '!=', '!==', '"', '%', '\'', '(begin)', '(error)', '*', '+', '-', '/', '<', '<=', '==', '===', '>', '>=', '\\', a, a_label, a_scope, already_defined, and, apply, arguments, arity, ass, @@ -292,7 +297,9 @@ continue : true, couch : true, debug : true, + defined : true, devel : true, + emptyblock: true, eqeq : true, evil : true, forin : true, @@ -312,6 +319,7 @@ stupid : true, sub : true, todo : true, + unvar : true, vars : true, white : true }, @@ -1347,7 +1355,7 @@ // It is an error if the name has already been defined in this scope, except // when reusing an exception variable name. - if (master) { + if (master && !option.defined) { if (master.function === funct) { if (master.kind !== 'exception' || kind !== 'exception' || !master.dead) { @@ -1702,7 +1710,11 @@ right = right || next_token; if ((!option.white) && left.thru !== right.from && left.line === right.line) { - right.warn('unexpected_space_a_b', artifact(left), artifact(right)); + if (!(option.closure && right.comments.length === 1 + && right.comments[0].string.substr(0, 7) === '*@type{')) { + right.warn('unexpected_space_a_b', artifact(left), + artifact(right)); + } } } @@ -2421,7 +2433,7 @@ array = [statement()]; array.disrupt = array[0].disrupt; } - if (kind !== 'catch' && array.length === 0 && !option.debug) { + if (!(option.emptyblock || option.debug) && kind !== 'catch' && array.length === 0) { curly.warn('empty_block'); } block_var.forEach(function (name) { @@ -3175,9 +3187,10 @@ Object.keys(scope).forEach(function (name) { var master = scope[name]; if (!master.used && master.kind !== 'exception' && - (master.kind !== 'parameter' || !option.unparam)) { + ((master.kind === 'var' && !option.unvar) + || (master.kind === 'parameter' && !option.unparam))) { master.warn('unused_a'); - } else if (!master.init) { + } else if (!master.init && (master.kind !== 'var' || !option.unvar)) { master.warn('uninitialized_a'); } }); @@ -4286,3 +4299,7 @@ return itself; }()); +core.JSLint = function JSLint() { + "use strict"; + this.JSLINT = JSLINT; +};