grunt-jslint
Advanced tools
Comparing version 1.1.14 to 1.1.15
@@ -61,7 +61,20 @@ | ||
vm.runInContext(code, ctx); | ||
//vm.runInContext(code, ctx); | ||
var script = new vm.Script(code); | ||
script.runInContext(ctx); | ||
JSLINT = jslint.JSLINT = ctx.JSLINT; | ||
jslint.edition = JSLINT.edition; | ||
if (ctx.jslint) { | ||
JSLINT = jslint.JSLINT = ctx.jslint; | ||
jslint.edition = JSLINT("", {}).edition; | ||
} else if (ctx.JSLINT) { | ||
JSLINT = jslint.JSLINT = ctx.JSLINT; | ||
jslint.edition = JSLINT.edition; | ||
} else { | ||
throw new Error("JSLint not found"); | ||
} | ||
if (cb) { | ||
@@ -183,3 +196,5 @@ cb(null, jslint.edition); | ||
var violations = JSLINT.errors; | ||
var violations = JSLINT.errors | ||
? JSLINT.errors | ||
: JSLINT.data().warnings; | ||
var res = []; | ||
@@ -186,0 +201,0 @@ |
@@ -18,3 +18,6 @@ | ||
issues.forEach(function (issue) { | ||
var msg = issue.reason || 'Unused variable "' + issue.name + '"'; | ||
var msg = issue.message || issue.reason || 'Unused variable "' + issue.name + '"'; | ||
var column = typeof issue.column === "number" | ||
? issue.column | ||
: issue.character; | ||
@@ -24,3 +27,3 @@ xml.push([ | ||
' line="' + issue.line + '"', | ||
' column="' + issue.character + '"', | ||
' column="' + column + '"', | ||
' severity="warning"', | ||
@@ -27,0 +30,0 @@ ' message="' + util.escapeForXml(msg) + '"', |
@@ -19,3 +19,6 @@ | ||
var reason = util.message(issue), | ||
evidence = issue.evidence || ''; | ||
evidence = issue.evidence || '', | ||
char = typeof issue.column === "number" | ||
? issue.column | ||
: issue.character; | ||
@@ -25,3 +28,3 @@ xml.push([ | ||
' line="' + issue.line + '"', | ||
' char="' + issue.character + '"', | ||
' char="' + char + '"', | ||
' reason="' + util.escapeForXml(reason) + '"', | ||
@@ -28,0 +31,0 @@ ' evidence="' + util.escapeForXml(evidence) + '"', |
@@ -26,3 +26,7 @@ | ||
+ ':' | ||
+ (failure.character || ''); | ||
+ ( | ||
typeof failure.column === "number" | ||
? failure.column | ||
: failure.character | ||
); | ||
@@ -29,0 +33,0 @@ xml.push([ |
@@ -25,4 +25,6 @@ | ||
buf += red(file + ':' + issue.line); | ||
if (issue.character) { | ||
buf += red(':' + issue.character); | ||
if (issue.column) { | ||
buf += red(':' + issue.column); | ||
} else if (issue.character) { | ||
buf += red(':' + issue.character); | ||
} | ||
@@ -29,0 +31,0 @@ buf += '\t'; |
@@ -29,3 +29,3 @@ | ||
exports.message = function (issue) { | ||
var msg = issue.reason || 'Unused variable "' + issue.name + '"'; | ||
var msg = issue.message || issue.reason || 'Unused variable "' + issue.name + '"'; | ||
return exports.escapeForXml(msg); | ||
@@ -32,0 +32,0 @@ }; |
{ | ||
"name": "grunt-jslint", | ||
"description": "Validates JavaScript files with JSLint", | ||
"version": "1.1.14", | ||
"version": "1.1.15", | ||
"homepage": "https://github.com/stephenmathieson/grunt-jslint", | ||
@@ -37,3 +37,3 @@ "author": { | ||
"dependencies": { | ||
"jslint": "~0.8.1" | ||
"jslint": "^0.10.3" | ||
}, | ||
@@ -45,3 +45,3 @@ "devDependencies": { | ||
"jscoverage": "~0.5.9", | ||
"vows": "~0.8.1", | ||
"vows": "~0.9.0-rc3", | ||
"which": "~1.0.5", | ||
@@ -48,0 +48,0 @@ "win-spawn": "~2.0.0", |
@@ -11,3 +11,3 @@ | ||
task: 'jslint:server', | ||
errors: 4 | ||
errors: 3 | ||
}); |
@@ -18,3 +18,3 @@ | ||
* var runner = require('./acceptance-runner'); | ||
* | ||
* | ||
* // a passing test | ||
@@ -26,3 +26,3 @@ * var test = { | ||
* runner(test); | ||
* | ||
* | ||
* // a failing test with a custom grunt task | ||
@@ -42,4 +42,4 @@ * var test = { | ||
* runner(test); | ||
* | ||
* | ||
* | ||
* @api public | ||
@@ -46,0 +46,0 @@ * @param {Object} opts |
var thing=true; | ||
var stuff=false; | ||
var f=function(){ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,0 +6,0 @@ if(thing){ |
@@ -63,3 +63,3 @@ 'use strict'; | ||
assert.equal(violation.reason, '\'someglobal\' was used before it was defined.'); | ||
assert.equal(violation.message, 'Undeclared \'someglobal\'.'); | ||
} | ||
@@ -147,9 +147,9 @@ } | ||
report.forEach(function (issue) { | ||
assert.ok(issue.id); | ||
assert.ok(issue.raw); | ||
assert.ok(issue.evidence); | ||
assert.ok(issue.line); | ||
assert.ok(issue.character); | ||
assert.ok(issue.reason); | ||
assert.ok(issue.file); | ||
assert.ok(issue.name);//assert.ok(issue.id); | ||
//assert.ok(issue.raw); | ||
//assert.ok(issue.evidence); | ||
assert.ok(typeof issue.line === "number"); | ||
assert.ok(issue.column);//assert.ok(issue.character); | ||
assert.ok(issue.message);//assert.ok(issue.reason); | ||
assert.ok(issue.file); | ||
}); | ||
@@ -182,4 +182,5 @@ }, | ||
} | ||
}, | ||
'sloppy': { | ||
} | ||
// NOTE: JSLint removed the ability to make "use strict" optional -- Skateside | ||
/*'sloppy': { | ||
topic: function () { | ||
@@ -200,3 +201,3 @@ var file = getFixture('sloppy.js'); | ||
} | ||
} | ||
}*/ | ||
}, | ||
@@ -251,6 +252,6 @@ | ||
'should report on unused parameters': function (err, report) { | ||
assert.equal(report[0].reason, 'Unused \'c\'.'); | ||
assert.equal(report[0].message, 'Unused \'c\'.'); | ||
}, | ||
'should report on unused vars': function (err, report) { | ||
assert.equal(report[1].reason, 'Unused \'b\'.'); | ||
assert.equal(report[1].message, 'Unused \'b\'.'); | ||
} | ||
@@ -257,0 +258,0 @@ }, |
@@ -18,8 +18,8 @@ /*jslint unparam:true*/ | ||
function validateIssue(issue) { | ||
assert.ok(issue.id); | ||
assert.ok(issue.raw); | ||
assert.ok(issue.evidence); | ||
assert.ok(issue.line); | ||
assert.ok(issue.character); | ||
assert.ok(issue.reason); | ||
assert.ok(issue.name);//assert.ok(issue.id); | ||
//assert.ok(issue.raw); | ||
//assert.ok(issue.evidence); | ||
assert.ok(typeof issue.line === "number"); | ||
assert.ok(issue.column);//assert.ok(issue.character); | ||
assert.ok(issue.message);//assert.ok(issue.reason); | ||
assert.ok(issue.file); | ||
@@ -26,0 +26,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62879
41
1586
+ Addedbuffer-shims@1.0.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedjslint@0.10.3(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedprocess-nextick-args@1.0.7(transitive)
+ Addedreadable-stream@2.1.5(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedglob@4.5.3(transitive)
- Removedisarray@0.0.1(transitive)
- Removedjslint@0.8.1(transitive)
- Removedminimatch@2.0.10(transitive)
- Removedreadable-stream@1.0.34(transitive)
Updatedjslint@^0.10.3