grunt-jslint
Advanced tools
Comparing version 1.1.11 to 1.1.12
@@ -0,1 +1,9 @@ | ||
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 | ||
@@ -2,0 +10,0 @@ =================== |
@@ -7,3 +7,5 @@ | ||
var path = require('path'); | ||
var resolve = path.resolve; | ||
var nodelint = require('jslint/lib/nodelint'); | ||
var jslint = module.exports; | ||
@@ -47,16 +49,2 @@ | ||
function loadJSLintFromPath(file, cb) { | ||
var ctx = vm.createContext(); | ||
var f = fs.readFileSync(path.resolve(process.cwd(), file)); | ||
vm.runInContext(f, ctx); | ||
JSLINT = jslint.JSLINT = ctx.JSLINT; | ||
jslint.edition = JSLINT.edition; | ||
if (cb) { | ||
cb(null, jslint.edition); | ||
} | ||
} | ||
/** | ||
@@ -67,3 +55,2 @@ * Expose `loadJSLint`. | ||
jslint.loadJSLint = loadJSLint; | ||
jslint.loadJSLintFromPath = loadJSLintFromPath; | ||
@@ -94,7 +81,3 @@ // default - can be overridden by setting 'edition' in grunt options | ||
if (opts.edition) { | ||
if (opts.edition.indexOf(".js") === opts.edition.length - 3) { | ||
loadJSLintFromPath(opts.edition); | ||
} else { | ||
loadJSLint(opts.edition); | ||
} | ||
loadJSLint(opts.edition); | ||
} | ||
@@ -101,0 +84,0 @@ |
{ | ||
"name": "grunt-jslint", | ||
"description": "Validates JavaScript files with JSLint", | ||
"version": "1.1.11", | ||
"version": "1.1.12", | ||
"homepage": "https://github.com/stephenmathieson/grunt-jslint", | ||
@@ -37,3 +37,3 @@ "author": { | ||
"dependencies": { | ||
"jslint": ">=0.3.4" | ||
"jslint": ">=0.5.0" | ||
}, | ||
@@ -46,3 +46,5 @@ "devDependencies": { | ||
"jscoverage": "~0.3.8", | ||
"grunt-cli": "~0.1.13" | ||
"grunt-cli": "~0.1.13", | ||
"win-spawn": "~2.0.0", | ||
"which": "~1.0.5" | ||
}, | ||
@@ -49,0 +51,0 @@ "keywords": [ |
'use strict'; | ||
var spawn = require('child_process').spawn, | ||
path = require('path'), | ||
assert = require('better-assert'); | ||
var opts = { | ||
cwd: path.join(__dirname, '..', '..', 'examples', 'all') | ||
}; | ||
var out = ''; | ||
spawn('grunt', [ 'jslint' ], opts) | ||
.on('close', function (code) { | ||
// no errors | ||
assert(code === 0); | ||
// contains | ||
assert(out.indexOf('Done, without errors.') !== -1); | ||
}) | ||
.stdout.on('data', function (data) { | ||
data = data.toString(); | ||
out += data; | ||
if (process.argv.indexOf('--verbose') !== -1) { | ||
process.stdout.write(data); | ||
} | ||
}); | ||
require('./runner')({ | ||
example: 'all', | ||
errors: 0 | ||
}); |
'use strict'; | ||
require('./runner')({ | ||
example: 'client-server', | ||
task: 'jslint:client', | ||
errors: 1 | ||
}); | ||
var spawn = require('child_process').spawn, | ||
path = require('path'), | ||
assert = require('better-assert'); | ||
var opts = { | ||
cwd: path.join(__dirname, '..', '..', 'examples', 'client-server') | ||
}; | ||
function log(data) { | ||
if (process.argv.indexOf('--verbose') !== -1) { | ||
process.stdout.write(data); | ||
} | ||
} | ||
var out = ''; | ||
// run client | ||
spawn('grunt', [ 'jslint:client' ], opts) | ||
.on('close', function (code) { | ||
// has errors | ||
// grunt seems to fail with random and | ||
// arbitrary exit codes. `$ grunt jslint:client` | ||
// fails with 3, but i have no idea why. | ||
assert(code !== 0); | ||
assert(out.indexOf('Missing \'use strict\' statement.') !== -1); | ||
// contains | ||
assert(out.indexOf('# JSLint failed, 1 violations in 1. 1 files scanned.') !== -1); | ||
// run server | ||
out = ''; | ||
spawn('grunt', [ 'jslint:server' ], opts) | ||
.on('close', function (code) { | ||
// has errors | ||
// grunt seems to fail with random and | ||
// arbitrary exit codes. `$ grunt jslint:client` | ||
// fails with 3, but i have no idea why. | ||
assert(code !== 0); | ||
assert(out.indexOf('Unexpected sync method: \'readFileSync\'.') !== -1); | ||
assert(out.indexOf('Unexpected dangling \'_\' in \'__dirname\'.') !== -1); | ||
assert(out.indexOf('Missing \'use strict\' statement.') !== -1); | ||
assert(out.indexOf('Unused \'req\'.') !== -1); | ||
// contains | ||
assert(out.indexOf('# JSLint failed, 4 violations in 1. 1 files scanned.') !== -1); | ||
}) | ||
.stdout.on('data', function (data) { | ||
data = data.toString(); | ||
out += data; | ||
log(data); | ||
}); | ||
}) | ||
.stdout.on('data', function (data) { | ||
data = data.toString(); | ||
out += data; | ||
log(data); | ||
}); | ||
require('./runner')({ | ||
example: 'client-server', | ||
task: 'jslint:server', | ||
errors: 4 | ||
}); |
'use strict'; | ||
var spawn = require('child_process').spawn, | ||
path = require('path'), | ||
assert = require('better-assert'); | ||
var opts = { | ||
cwd: path.join(__dirname, '..', '..', 'examples', 'deprecation') | ||
}; | ||
var out = ''; | ||
spawn('grunt', [ 'jslint' ], opts) | ||
.on('close', function (code) { | ||
// no errors | ||
assert(code !== 0); | ||
// contains | ||
assert(out.indexOf('grunt-jslint\'s interface has changed since 0.2.x') !== -1); | ||
}) | ||
.stdout.on('data', function (data) { | ||
data = data.toString(); | ||
out += data; | ||
if (process.argv.indexOf('--verbose') !== -1) { | ||
process.stdout.write(data); | ||
} | ||
}); | ||
require('./runner')({ | ||
example: 'deprecation', | ||
errors: true, | ||
message: 'grunt-jslint\'s interface has changed since 0.2.x' | ||
}); |
'use strict'; | ||
var spawn = require('child_process').spawn; | ||
var path = require('path'); | ||
var assert = require('better-assert'); | ||
var out = ''; | ||
var opts = { | ||
cwd: path.join(__dirname, '..', '..', 'examples', 'exclude') | ||
}; | ||
spawn('grunt', [ 'jslint' ], opts) | ||
.on('close', function (code) { | ||
// no errors | ||
assert(code === 0); | ||
// contains | ||
assert(out.indexOf('Done, without errors.') !== -1); | ||
}) | ||
.stdout.on('data', function (data) { | ||
data = data.toString(); | ||
out += data; | ||
if (process.argv.indexOf('--verbose') !== -1) { | ||
process.stdout.write(data); | ||
} | ||
}); | ||
require('./runner')({ | ||
example: 'exclude', | ||
errors: 0 | ||
}); |
'use strict'; | ||
var spawn = require('child_process').spawn, | ||
path = require('path'), | ||
assert = require('better-assert'); | ||
var opts = { | ||
cwd: path.join(__dirname, '..', '..') | ||
}; | ||
var out = ''; | ||
spawn('grunt', [ 'jslint' ], opts) | ||
.on('close', function (code) { | ||
// no errors | ||
assert(code === 0); | ||
// contains | ||
assert(out.indexOf('Done, without errors.') !== -1); | ||
}) | ||
.stdout.on('data', function (data) { | ||
data = data.toString(); | ||
out += data; | ||
if (process.argv.indexOf('--verbose') !== -1) { | ||
process.stdout.write(data); | ||
} | ||
}); | ||
require('./runner')({ | ||
example: '..', | ||
errors: 0 | ||
}); |
@@ -118,3 +118,3 @@ 'use strict'; | ||
jslint.loadJSLintFromPath('node_modules/jslint/lib/jslint-2013-08-26.js', function () { | ||
jslint.loadJSLint('node_modules/jslint/lib/jslint-2013-08-26.js', function () { | ||
validate(file, opts, this.callback); | ||
@@ -121,0 +121,0 @@ }.bind(this)); |
@@ -105,3 +105,3 @@ 'use strict'; | ||
topic: function () { | ||
jslint.loadJSLintFromPath('./node_modules/jslint/lib/jslint-latest.js', this.callback); | ||
jslint.loadJSLint('./node_modules/jslint/lib/jslint-latest.js', this.callback); | ||
}, | ||
@@ -108,0 +108,0 @@ 'should not error': function (err, report) { |
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
44
0
55059
8
1460
Updatedjslint@>=0.5.0