Comparing version 2.1.8 to 2.1.9
{ | ||
"name": "jshint", | ||
"version": "2.1.8", | ||
"version": "2.1.9", | ||
"homepage": "http://jshint.com/", | ||
@@ -27,5 +27,5 @@ "description": "Static analysis tool for JavaScript", | ||
"scripts": { | ||
"build": "node ./make.js build", | ||
"test": "node ./make.js test", | ||
"lint": "node ./make.js lint" | ||
"build": "node make.js build", | ||
"test": "nodeunit tests tests/stable/regression tests/stable/unit", | ||
"pretest": "jshint --config=jshint.json src" | ||
}, | ||
@@ -32,0 +32,0 @@ |
@@ -78,20 +78,16 @@ "use strict"; | ||
* | ||
* @param {sting} file path to the file to be linted | ||
* @param {string} file path to the file to be linted | ||
* @returns {string} a path to the config file | ||
*/ | ||
function findConfig(file) { | ||
var name = ".jshintrc"; | ||
var dir = path.dirname(path.resolve(file)); | ||
var proj = findFile(name, dir); | ||
var home = path.normalize(path.join(process.env.HOME || | ||
process.env.HOMEPATH || | ||
process.env.USERPROFILE, name)); | ||
var dir = path.dirname(path.resolve(file)); | ||
var envs = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE; | ||
var home = path.normalize(path.join(envs, ".jshintrc")); | ||
if (proj) { | ||
var proj = findFile(".jshintrc", dir); | ||
if (proj) | ||
return proj; | ||
} | ||
if (shjs.test("-e", home)) { | ||
if (shjs.test("-e", home)) | ||
return home; | ||
} | ||
@@ -102,2 +98,20 @@ return null; | ||
/** | ||
* Tries to find JSHint configuration within a package.json file | ||
* (if any). It search in the current directory and then goes up | ||
* all the way to the root just like findFile. | ||
* | ||
* @param {string} file path to the file to be linted | ||
* @returns {object} config object | ||
*/ | ||
function loadNpmConfig(file) { | ||
var dir = path.dirname(path.resolve(file)); | ||
var fp = findFile("package.json", dir); | ||
if (!fp) | ||
return null; | ||
return require(fp).jshintConfig || null; | ||
} | ||
/** | ||
* Tries to import a reporter file and returns its reference. | ||
@@ -379,3 +393,3 @@ * | ||
files.forEach(function (file) { | ||
var config = opts.config || exports.loadConfig(findConfig(file)); | ||
var config = opts.config || loadNpmConfig(file) || exports.loadConfig(findConfig(file)); | ||
var code; | ||
@@ -382,0 +396,0 @@ |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
213630
7330
1
5