mocha-jshint
Advanced tools
Comparing version 2.2.2 to 2.2.3
35
git.js
@@ -6,2 +6,4 @@ var exec = require('child_process').exec; | ||
var fs = require('fs'); | ||
var shjs = require("shelljs"); | ||
var minimatch = require("minimatch"); | ||
@@ -59,2 +61,17 @@ module.exports = function (options, cb) { | ||
} | ||
var jsHintIgnores = []; | ||
try { | ||
jsHintIgnores = fs.readFileSync(path.resolve('.jshintignore'), 'utf-8') | ||
.split('\n') | ||
.filter(function (line) { | ||
return !!line.trim(); | ||
}) | ||
.map(function (line) { | ||
if (line[0] === "!") { | ||
return "!" + path.resolve(line.substr(1).trim()); | ||
} | ||
return path.resolve(line.trim()); | ||
}); | ||
} catch (ex) { | ||
} | ||
var files = uniq(stdout.split('\n')) | ||
@@ -65,6 +82,24 @@ .filter(function (filename) { | ||
.filter(function (filename) { | ||
return !isIgnored(filename, jsHintIgnores); | ||
}) | ||
.filter(function (filename) { | ||
return fs.existsSync(path.resolve(filename)); | ||
}); | ||
return cb(null, files); | ||
function isIgnored(fp, patterns) { | ||
return patterns.some(function (ip) { | ||
if (minimatch(path.resolve(fp), ip, {nocase: true})) { | ||
return true; | ||
} | ||
if (path.resolve(fp) === ip) { | ||
return true; | ||
} | ||
if (shjs.test("-d", fp) && ip.match(/^[^\/]*\/?$/) && | ||
fp.match(new RegExp("^" + ip + ".*"))) { | ||
return true; | ||
} | ||
}); | ||
} | ||
} | ||
}; |
{ | ||
"name": "mocha-jshint", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "run JSHint as mocha tests", | ||
@@ -19,3 +19,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"jshint": "^2.7", | ||
"jshint": "~2.7.0", | ||
"minimatch": "^2.0.7", | ||
"shelljs": "^0.4.0", | ||
"uniq": "^1.0.1" | ||
@@ -22,0 +24,0 @@ }, |
@@ -59,3 +59,3 @@ mocha-jshint [![npm version](https://badge.fury.io/js/mocha-jshint.svg)](http://badge.fury.io/js/mocha-jshint) [![Build Status](https://travis-ci.org/ebdrup/mocha-jshint.svg?branch=master)](https://travis-ci.org/ebdrup/mocha-jshint) [![Dependency Status](https://david-dm.org/ebdrup/mocha-jshint.svg)](https://david-dm.org/ebdrup/mocha-jshint) [![devDependency Status](https://david-dm.org/ebdrup/mocha-jshint/dev-status.svg)](https://david-dm.org/ebdrup/mocha-jshint#info=devDependencies) | ||
---------------- | ||
Normally I would recommend configuring what to lint with `.jshintingore` described in | ||
Normally I would recommend configuring what to lint with `.jshintignore` described in | ||
[configuring jshint](https://github.com/ebdrup/mocha-jshint#configuring-jshint). | ||
@@ -62,0 +62,0 @@ And just lint the working directory. |
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
9167
159
4
+ Addedminimatch@^2.0.7
+ Addedshelljs@^0.4.0
+ Addedcli@0.6.6(transitive)
+ Addedglob@3.2.11(transitive)
+ Addedjshint@2.7.0(transitive)
+ Addedlodash@3.6.0(transitive)
+ Addedlru-cache@2.7.3(transitive)
+ Addedminimatch@0.3.02.0.10(transitive)
+ Addedshelljs@0.3.00.4.0(transitive)
+ Addedsigmund@1.0.1(transitive)
- Removedcli@1.0.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedjshint@2.13.6(transitive)
- Removedlodash@4.17.21(transitive)
- Removedminimatch@3.0.83.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedjshint@~2.7.0