grunt-jslint
Advanced tools
Comparing version 1.1.6 to 1.1.7
1.1.7 / 2014-03-19 | ||
================== | ||
* Revert #39 and fix #41. | ||
* test: Add acceptance test for exclude | ||
1.1.6 / 2014-03-14 | ||
@@ -3,0 +9,0 @@ ================== |
module.exports = process.env.JSLINT_COV ? | ||
require('./lib-cov/jslint') : | ||
require('./lib/jslint'); | ||
module.exports = process.env.JSLINT_COV | ||
? require('./lib-cov/jslint') | ||
: require('./lib/jslint'); |
@@ -0,11 +1,10 @@ | ||
'use strict'; | ||
module.exports = {}; | ||
var fs = require('fs'); | ||
var vm = require('vm'); | ||
var path = require('path'); | ||
var nodelint = require('jslint/lib/nodelint'); | ||
var jslint = module.exports; | ||
var fs = require('fs'), | ||
vm = require('vm'), | ||
path = require('path'), | ||
nodelint = require('jslint/lib/nodelint'), | ||
jslint = module.exports; | ||
/** | ||
@@ -18,2 +17,3 @@ * The `JSLINT` function | ||
*/ | ||
var JSLINT; | ||
@@ -27,2 +27,3 @@ | ||
*/ | ||
jslint.edition = ''; | ||
@@ -33,16 +34,24 @@ | ||
* | ||
* @api private | ||
* @api public | ||
* @param {String} edition | ||
* @param {Function} [cb] | ||
*/ | ||
function loadJSLint(edition, callback) { | ||
function loadJSLint(edition, cb) { | ||
JSLINT = jslint.JSLINT = nodelint.load(edition); | ||
jslint.edition = JSLINT.edition; | ||
if (callback) { | ||
callback(null, jslint.edition); | ||
if (cb) { | ||
cb(null, jslint.edition); | ||
} | ||
} | ||
/** | ||
* Expose `loadJSLint`. | ||
*/ | ||
jslint.loadJSLint = loadJSLint; | ||
loadJSLint('latest'); // default - can be overridden by setting 'edition' in grunt options | ||
// default - can be overridden by setting 'edition' in grunt options | ||
loadJSLint('latest'); | ||
@@ -58,11 +67,12 @@ | ||
*/ | ||
jslint.runner = function (files, opts, cb) { | ||
var pending = files.length, | ||
report = { | ||
files: {}, | ||
failures: 0, | ||
file_count: files.length, | ||
files_in_violation: 0 | ||
}, | ||
done = false; | ||
var pending = files.length; | ||
var report = { | ||
files: {}, | ||
failures: 0, | ||
file_count: files.length, | ||
files_in_violation: 0 | ||
}; | ||
var done = false; | ||
@@ -106,2 +116,3 @@ if (opts.edition) { | ||
*/ | ||
jslint.validate = function (file, opts, cb) { | ||
@@ -131,4 +142,4 @@ var directives = opts.directives || {}; | ||
var violations = JSLINT.errors, | ||
res = []; | ||
var violations = JSLINT.errors; | ||
var res = []; | ||
@@ -154,2 +165,3 @@ violations.forEach(function (violation) { | ||
*/ | ||
jslint.reporters = require('./reporters'); |
@@ -0,1 +1,2 @@ | ||
'use strict'; | ||
@@ -2,0 +3,0 @@ |
@@ -0,1 +1,2 @@ | ||
'use strict'; | ||
@@ -2,0 +3,0 @@ |
@@ -0,1 +1,2 @@ | ||
exports.checkstyle = require('./check-style'); | ||
@@ -2,0 +3,0 @@ exports.jslint = require('./jslint'); |
@@ -0,1 +1,2 @@ | ||
'use strict'; | ||
@@ -2,0 +3,0 @@ |
@@ -0,1 +1,2 @@ | ||
'use strict'; | ||
@@ -14,6 +15,6 @@ | ||
Object.keys(report.files).forEach(function (file) { | ||
var parts = file.split(/[\\\/]/).filter(function (part) { return part; }), | ||
classname = parts.join('.').replace(/\.js$/i, '').replace(/-/g, '_'), | ||
filename = path.basename(file, '.js'), | ||
failures = report.files[file]; | ||
var parts = file.split(/[\\\/]/).filter(function (part) { return part; }); | ||
var classname = parts.join('.').replace(/\.js$/i, '').replace(/-/g, '_'); | ||
var filename = path.basename(file, '.js'); | ||
var failures = report.files[file]; | ||
@@ -20,0 +21,0 @@ if (failures.length) { |
@@ -0,1 +1,2 @@ | ||
'use strict'; | ||
@@ -2,0 +3,0 @@ |
@@ -0,1 +1,2 @@ | ||
'use strict'; | ||
@@ -10,2 +11,3 @@ | ||
*/ | ||
exports.escapeForXml = function (value) { | ||
@@ -26,2 +28,3 @@ return value | ||
*/ | ||
exports.message = function (issue) { | ||
@@ -32,3 +35,8 @@ var msg = issue.reason || 'Unused variable "' + issue.name + '"'; | ||
/** | ||
* ANSI colors. | ||
*/ | ||
exports.color = { | ||
/** | ||
@@ -41,5 +49,7 @@ * Wrap `str` in red | ||
*/ | ||
red: function (str) { | ||
return [ '\x1B[31m', str, '\x1B[39m' ].join(''); | ||
}, | ||
/** | ||
@@ -52,2 +62,3 @@ * Wrap `str` in green | ||
*/ | ||
green: function (str) { | ||
@@ -54,0 +65,0 @@ return [ '\x1B[32m', str, '\x1B[39m' ].join(''); |
{ | ||
"name": "grunt-jslint", | ||
"description": "Validates JavaScript files with JSLint", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"homepage": "https://github.com/stephenmathieson/grunt-jslint", | ||
@@ -37,5 +37,3 @@ "author": { | ||
"dependencies": { | ||
"jslint": ">=0.2.11", | ||
"shelljs": "~0.2.6", | ||
"minimatch": "~0.2.14" | ||
"jslint": ">=0.2.11" | ||
}, | ||
@@ -42,0 +40,0 @@ "devDependencies": { |
@@ -0,1 +1,2 @@ | ||
# grunt-jslint | ||
@@ -2,0 +3,0 @@ |
@@ -14,4 +14,2 @@ /*! | ||
var path = require('path'); | ||
var shjs = require('shelljs'); | ||
var minimatch = require('minimatch'); | ||
@@ -74,27 +72,10 @@ /** | ||
files = grunt.file.expand(files).filter(function (file) { | ||
/* Shamelessly cribbed from JSHint. | ||
* | ||
* https://github.com/jshint/jshint/blob/2.x/src/cli.js | ||
* l:219-234 */ | ||
function isIgnored(fp, patterns) { | ||
return patterns.some(function (ip) { | ||
var filepath = path.resolve(fp); | ||
if (minimatch(filepath, ip, {nocase: true })) { | ||
return true; | ||
} | ||
if (filepath === ip) { | ||
return true; | ||
} | ||
/*jslint regexp: true */ | ||
if (shjs.test("-d", fp) && ip.match(/^[^\/]*\/?$/) && | ||
fp.match(new RegExp("^" + ip + ".*"))) { | ||
return true; | ||
} | ||
/*jslint regexp: false */ | ||
}); | ||
} | ||
return !isIgnored(file, excludedFiles); | ||
}); | ||
excludedFiles = grunt.file.expand(excludedFiles); | ||
files = grunt.file | ||
.expand(files) | ||
.filter(function (file) { | ||
return excludedFiles.indexOf(file) === -1; | ||
}); | ||
options.directives = config.directives; | ||
@@ -101,0 +82,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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
47184
1
36
1306
112
- Removedminimatch@~0.2.14
- Removedshelljs@~0.2.6
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@0.2.14(transitive)
- Removedshelljs@0.2.6(transitive)
- Removedsigmund@1.0.1(transitive)