grunt-jslint
Advanced tools
Comparing version 1.1.2 to 1.1.4
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ // init_ui.js |
@@ -0,0 +0,0 @@ // intercept.js |
@@ -7,2 +7,4 @@ 'use strict'; | ||
var nodelint = require('jslint/lib/nodelint'); | ||
// define public API | ||
@@ -18,11 +20,4 @@ var jslint = module.exports = {}; | ||
*/ | ||
var JSLINT = jslint.JSLINT = (function () { | ||
var file = path.join(__dirname, '..', 'jslint', 'jslint.js'); | ||
var ctx = vm.createContext(); | ||
var js = fs.readFileSync(file).toString(); | ||
var JSLINT; | ||
vm.runInContext(js, ctx); | ||
return ctx.JSLINT; | ||
}()); | ||
/** | ||
@@ -34,5 +29,24 @@ * Expose the current version of JSLint | ||
*/ | ||
jslint.edition = JSLINT.edition; | ||
jslint.edition = ''; | ||
/** | ||
* Load (or reload) the actual jslint linter module | ||
* | ||
* @api private | ||
* @param {String} edition | ||
*/ | ||
function loadJSLint(edition, callback) { | ||
JSLINT = jslint.JSLINT = nodelint.load(edition); | ||
jslint.edition = JSLINT.edition; | ||
if (callback) { | ||
callback(null, jslint.edition); | ||
} | ||
} | ||
jslint.loadJSLint = loadJSLint; | ||
loadJSLint('latest'); // default - can be overridden by setting 'edition' in grunt options | ||
/** | ||
* Run `JSLINT` on the given `files` | ||
@@ -55,2 +69,6 @@ * | ||
if (opts.edition) { | ||
loadJSLint(opts.edition); | ||
} | ||
files.forEach(function (file) { | ||
@@ -57,0 +75,0 @@ jslint.validate(file, opts, function (err, violations) { |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ exports.checkstyle = require('./check-style'); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
{ | ||
"name": "grunt-jslint", | ||
"description": "Validates JavaScript files with JSLint", | ||
"version": "1.1.2", | ||
"version": "1.1.4", | ||
"homepage": "https://github.com/stephenmathieson/grunt-jslint", | ||
@@ -31,3 +31,5 @@ "author": { | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"jslint": "~0.2" | ||
}, | ||
"devDependencies": { | ||
@@ -37,3 +39,4 @@ "grunt": "~0.4.1", | ||
"xml2js": "~0.2.8", | ||
"better-assert": "~1.0.0" | ||
"better-assert": "~1.0.0", | ||
"jscoverage": "~0.3.8" | ||
}, | ||
@@ -40,0 +43,0 @@ "keywords": [ |
@@ -0,0 +0,0 @@ /*! |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ var foo = someglobal.foo; |
@@ -0,0 +0,0 @@ (function () { |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ // attempt at replicating https://github.com/stephenmathieson/grunt-jslint/issues/22 |
@@ -0,0 +0,0 @@ var thing=true; |
@@ -7,5 +7,13 @@ 'use strict'; | ||
var validate = require('..').validate, | ||
var jslint = require('..'), | ||
validate = jslint.validate, | ||
suite = vows.describe('validate'); | ||
function getFixture(file) { | ||
return path.join(__dirname, 'fixtures', file); | ||
} | ||
// added for testing edition selection | ||
var initialEdition; | ||
suite.addBatch({ | ||
@@ -28,3 +36,3 @@ | ||
topic: function () { | ||
var file = path.join(__dirname, 'fixtures', 'globals.js'), | ||
var file = getFixture('globals.js'), | ||
opts = { | ||
@@ -47,3 +55,3 @@ directives: { | ||
topic: function () { | ||
var file = path.join(__dirname, 'fixtures', 'globals.js'); | ||
var file = getFixture('globals.js'); | ||
@@ -63,5 +71,58 @@ validate(file, {}, this.callback); | ||
'select edition': { | ||
'with default edition': { | ||
topic: function () { | ||
jslint.loadJSLint('latest', this.callback); | ||
}, | ||
'should not error': function (err, report) { | ||
assert.ifError(err); | ||
}, | ||
'should have an edition': function (err, report) { | ||
initialEdition = report; | ||
assert.ok(report); | ||
} | ||
}, | ||
'with explicit edition': { | ||
topic: function () { | ||
jslint.loadJSLint('2013-02-03', this.callback); | ||
}, | ||
'should not error': function (err, report) { | ||
assert.ifError(err); | ||
}, | ||
'should have selected edition': function (err, report) { | ||
assert.equal('2013-02-03', report); | ||
} | ||
}, | ||
'with latest edition': { | ||
topic: function () { | ||
jslint.loadJSLint('latest', this.callback); | ||
}, | ||
'should not error': function (err, report) { | ||
assert.ifError(err); | ||
}, | ||
'should be back to default(initial) edition': function (err, report) { | ||
assert.equal(initialEdition, report); | ||
} | ||
}, | ||
'via runner': { | ||
topic: function () { | ||
var file = getFixture('clean.js'); | ||
jslint.runner([file], {edition: 'latest'}, this.callback); | ||
}, | ||
'should not error': function (err, report) { | ||
assert.ifError(err); | ||
}, | ||
'should have no errors': function (err, report) { | ||
assert.isObject(report); | ||
assert.isObject(report.files); | ||
assert.equal(1, report.file_count); | ||
assert.equal(0, report.failures); | ||
} | ||
} | ||
}, | ||
'no directives': { | ||
topic: function () { | ||
var file = path.join(__dirname, 'fixtures', 'white.js'); | ||
var file = getFixture('white.js'); | ||
validate(file, {}, this.callback); | ||
@@ -98,3 +159,3 @@ }, | ||
topic: function () { | ||
var file = path.join(__dirname, 'fixtures', 'white.js'); | ||
var file = getFixture('white.js'); | ||
validate(file, { | ||
@@ -116,3 +177,3 @@ 'directives': { | ||
topic: function () { | ||
var file = path.join(__dirname, 'fixtures', 'sloppy.js'); | ||
var file = getFixture('sloppy.js'); | ||
validate(file, { | ||
@@ -136,3 +197,3 @@ 'directives': { | ||
topic: function () { | ||
var file = path.join(__dirname, 'fixtures', 'shebang'); | ||
var file = getFixture('shebang'); | ||
validate(file, { shebang: true }, this.callback); | ||
@@ -151,3 +212,3 @@ }, | ||
topic: function () { | ||
var file = path.join(__dirname, 'fixtures', 'unused.js'); | ||
var file = getFixture('unused.js'); | ||
validate(file, {}, this.callback); | ||
@@ -154,0 +215,0 @@ }, |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ /*jslint unparam:true*/ |
@@ -0,0 +0,0 @@ 'use strict'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
260272
40
5390
1
5
5
+ Addedjslint@~0.2
+ Addedabbrev@1.1.1(transitive)
+ Addedjslint@0.2.11(transitive)
+ Addednopt@1.0.10(transitive)