forked from CSSLint/csslint
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.csslitnrc lookup from cwd or basefolder CSSLint#449+
cli folder reorganization to make things easier, unit tests for node, manually tested for rhino and wsh. there is no .csslintrc lookdown, ie. scoped options per one cli run
- Loading branch information
Showing
7 changed files
with
60 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*globals api, cli*/ | ||
/*exported commonApi*/ | ||
|
||
var commonApi = { | ||
lookUpFile: function (filename, base) { | ||
var lookupd = base? this.getFullPath(base): this.getWorkingDirectory(), | ||
data, | ||
self = this; | ||
|
||
function isGoodToGoUp() { | ||
var /*keep '==' because of rhino*/ | ||
isUserhome = (lookupd == self.userhome), | ||
_lookupd = self.getFullPath(lookupd + "/../"), | ||
isTop = (lookupd == _lookupd), | ||
gtg; | ||
|
||
gtg = (!data && !isUserhome && !isTop); | ||
lookupd = _lookupd; | ||
return gtg; | ||
} | ||
|
||
(function traverseUp() { | ||
var | ||
fullpath = self.getFullPath(lookupd + "/" + filename); | ||
|
||
data = self.readFile(fullpath); | ||
|
||
if ( isGoodToGoUp() ) { | ||
traverseUp(); | ||
} | ||
}()); | ||
|
||
return data; | ||
} | ||
}; | ||
|
||
/*api = */ | ||
CSSLint.Util.mix(api, commonApi); | ||
|
||
if (typeof cli === "function") { | ||
cli(api); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters