eslint-plugin-node
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -25,9 +25,15 @@ /** | ||
var TAIL_SLASH = /\/+$/; | ||
var PARENT_RELATIVE_PATH = /^\.\./; | ||
var NEVER_IGNORED = /^(?:readme\.[^\.]*|(?:licen[cs]e|changes|changelog|history)(?:\.[^\.]*)?)$/i; | ||
/** | ||
* @returns {boolean} `false` always. | ||
* Checks whether or not a given file name is a relative path to a ancestor | ||
* directory. | ||
* | ||
* @param {string} filePath - A file name to check. | ||
* @returns {boolean} `true` if the file name is a relative path to a ancestor | ||
* directory. | ||
*/ | ||
function alwaysFalse() { | ||
return false; | ||
function notAncestorFiles(filePath) { | ||
return PARENT_RELATIVE_PATH.test(filePath); | ||
} | ||
@@ -49,7 +55,8 @@ | ||
* @param {function} g - A function. | ||
* @returns {function} A logical-or function of `f` and `g`. | ||
* @param {function|null} h - A function. | ||
* @returns {function} A logical-or function of `f`, `g`, and `h`. | ||
*/ | ||
function or(f, g) { | ||
function or(f, g, h) { | ||
return function(filePath) { | ||
return f(filePath) || g(filePath); | ||
return f(filePath) || g(filePath) || (h && h(filePath)); | ||
}; | ||
@@ -156,3 +163,3 @@ } | ||
module.exports = function getNpmignore(startPath) { | ||
var retv = {match: alwaysFalse}; | ||
var retv = {match: notAncestorFiles}; | ||
@@ -170,9 +177,9 @@ var p = getPackageJson(startPath); | ||
if (filesIgnore && npmignoreIgnore) { | ||
retv.match = and(filterNeverIgnoredFiles(p), or(filesIgnore, npmignoreIgnore)); | ||
retv.match = and(filterNeverIgnoredFiles(p), or(notAncestorFiles, filesIgnore, npmignoreIgnore)); | ||
} | ||
else if (filesIgnore) { | ||
retv.match = and(filterNeverIgnoredFiles(p), filesIgnore); | ||
retv.match = and(filterNeverIgnoredFiles(p), or(notAncestorFiles, filesIgnore)); | ||
} | ||
else if (npmignoreIgnore) { | ||
retv.match = and(filterNeverIgnoredFiles(p), npmignoreIgnore); | ||
retv.match = and(filterNeverIgnoredFiles(p), or(notAncestorFiles, npmignoreIgnore)); | ||
} | ||
@@ -179,0 +186,0 @@ |
{ | ||
"name": "eslint-plugin-node", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Additional ESLint's rules for Node.js", | ||
@@ -5,0 +5,0 @@ "files": [ |
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
71130
2081