grunt-jslint
Advanced tools
Comparing version 1.1.12 to 1.1.13
@@ -1,9 +0,1 @@ | ||
1.1.12 / 2014-05-19 | ||
=================== | ||
* package.json: require newer jslint module (>0.5.0) | ||
* lib/jslint.js: delegate jslint file loading to jslint | ||
* test/editions.js: use loadJSLint instead of ..fromPath | ||
* test/jslin.js: use loadJSLint instead of ..fromPath | ||
1.1.11 / 2014-05-08 | ||
@@ -10,0 +2,0 @@ =================== |
@@ -49,2 +49,25 @@ | ||
/** | ||
* Load JSLINT from the given `path`, optionally | ||
* invoking `cb(err, jslint)`. | ||
* | ||
* @api public | ||
* @param {String} path | ||
* @param {Function} [cb] | ||
*/ | ||
function loadJSLintFromPath(path, cb) { | ||
var ctx = vm.createContext(); | ||
var code = fs.readFileSync(resolve(process.cwd(), path)); | ||
vm.runInContext(code, ctx); | ||
JSLINT = jslint.JSLINT = ctx.JSLINT; | ||
jslint.edition = JSLINT.edition; | ||
if (cb) { | ||
cb(null, jslint.edition); | ||
} | ||
} | ||
/** | ||
* Expose `loadJSLint`. | ||
@@ -55,2 +78,8 @@ */ | ||
/** | ||
* Expose `loadJSLintFromPath`. | ||
*/ | ||
jslint.loadJSLintFromPath = loadJSLintFromPath; | ||
// default - can be overridden by setting 'edition' in grunt options | ||
@@ -80,3 +109,7 @@ loadJSLint('latest'); | ||
if (opts.edition) { | ||
loadJSLint(opts.edition); | ||
if (opts.edition.indexOf(".js") === opts.edition.length - 3) { | ||
loadJSLintFromPath(opts.edition); | ||
} else { | ||
loadJSLint(opts.edition); | ||
} | ||
} | ||
@@ -83,0 +116,0 @@ |
{ | ||
"name": "grunt-jslint", | ||
"description": "Validates JavaScript files with JSLint", | ||
"version": "1.1.12", | ||
"version": "1.1.13", | ||
"homepage": "https://github.com/stephenmathieson/grunt-jslint", | ||
@@ -37,13 +37,13 @@ "author": { | ||
"dependencies": { | ||
"jslint": ">=0.5.0" | ||
"jslint": "~0.8.1" | ||
}, | ||
"devDependencies": { | ||
"better-assert": "~1.0.0", | ||
"grunt": "~0.4.1", | ||
"vows": "~0.7.0", | ||
"xml2js": "~0.2.8", | ||
"better-assert": "~1.0.0", | ||
"jscoverage": "~0.3.8", | ||
"grunt-cli": "~0.1.13", | ||
"jscoverage": "~0.5.9", | ||
"vows": "~0.8.1", | ||
"which": "~1.0.5", | ||
"win-spawn": "~2.0.0", | ||
"which": "~1.0.5" | ||
"xml2js": "~0.4.6" | ||
}, | ||
@@ -50,0 +50,0 @@ "keywords": [ |
@@ -58,3 +58,5 @@ /*! | ||
excludedFiles = grunt.file.expand(excludedFiles); | ||
excludedFiles = excludedFiles.map(function (p) { | ||
return grunt.file.expand(p); | ||
}).reduce(function (a, b) { return a.concat(b); }, []); | ||
@@ -61,0 +63,0 @@ var exclude = {}; |
@@ -118,3 +118,3 @@ 'use strict'; | ||
jslint.loadJSLint('node_modules/jslint/lib/jslint-2013-08-26.js', function () { | ||
jslint.loadJSLintFromPath('node_modules/jslint/lib/jslint-2013-08-26.js', function () { | ||
validate(file, opts, this.callback); | ||
@@ -121,0 +121,0 @@ }.bind(this)); |
@@ -108,2 +108,40 @@ 'use strict'; | ||
'exclude works with globs and subdirs (4)': { | ||
topic: function () { | ||
var files = ['js/**/*.js'], | ||
excludedFiles = [ | ||
'js/jsDocs/**/*.js', | ||
'js/lib/**/*.js', | ||
'js/scripts.min.js' | ||
], | ||
mockGrunt = makeMockGrunt(); | ||
mockGrunt.overrides = { | ||
'js/**/*.js': [ | ||
'js/0.js', | ||
'js/1/2.js', | ||
'js/jsDocs/3.js', | ||
'js/jsDocs/4/5.js', | ||
'js/lib/6.js', | ||
'js/lib/7/8.js' | ||
], | ||
'js/jsDocs/**/*.js': [ | ||
'js/jsDocs/3.js', | ||
'js/jsDocs/4/5.js' | ||
], | ||
'js/lib/**/*.js': [ | ||
'js/lib/6.js', | ||
'js/lib/7/8.js' | ||
] | ||
}; | ||
files = jslint.expandAndExclude(mockGrunt, files, excludedFiles); | ||
this.callback(null, files) | ||
}, | ||
'should exclude files after expansion': function (err, files) { | ||
assert.deepEqual(files, ['js/0.js', 'js/1/2.js']); | ||
} | ||
}, | ||
'exclude is not dog slow': { | ||
@@ -136,3 +174,3 @@ topic: function () { | ||
'should excluded files without taking forever': function (err, files, includedFiles) { | ||
'should exclude files without taking forever': function (err, files, includedFiles) { | ||
assert.deepEqual(includedFiles, files); | ||
@@ -142,3 +180,3 @@ }, | ||
var microseconds = 1.0e6 * t[0] + t[1] / 1000; | ||
assert.ok(microseconds < 2000); | ||
assert.ok(microseconds < 20000); | ||
} | ||
@@ -145,0 +183,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; |
@@ -105,3 +105,3 @@ 'use strict'; | ||
topic: function () { | ||
jslint.loadJSLint('./node_modules/jslint/lib/jslint-latest.js', this.callback); | ||
jslint.loadJSLintFromPath('./node_modules/jslint/lib/jslint-latest.js', this.callback); | ||
}, | ||
@@ -108,0 +108,0 @@ 'should not error': function (err, report) { |
@@ -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 not supported yet
1522
54227
40
+ Addedglob@4.5.3(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedjslint@0.8.1(transitive)
+ Addedminimatch@2.0.10(transitive)
+ Addednopt@3.0.6(transitive)
+ Addedreadable-stream@1.0.34(transitive)
- Removedbuffer-shims@1.0.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.1.7(transitive)
- Removedisarray@1.0.0(transitive)
- Removedjslint@0.12.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removednopt@4.0.3(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedosenv@0.1.5(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprocess-nextick-args@1.0.7(transitive)
- Removedreadable-stream@2.1.5(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updatedjslint@~0.8.1