-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The "shelljs" package upon which JSHint depends includes a security vulnerability [1]. Futhermore, that package's coupling to Node.js runs contrary to JSHint's goal to support the Rhino runtime. Replace the package with a minimal implementation. This commit was forcibly pushed to the main development branch in order to correct a formatting error in the original version. [1] #3599
- Loading branch information
1 parent
b23e125
commit eb4609a
Showing
5 changed files
with
253 additions
and
204 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
"use strict"; | ||
|
||
var fs = require("fs"); | ||
|
||
/** | ||
* Determine if a file or directory is present at the given filesystem path. | ||
* | ||
* @param {string} name | ||
* | ||
* @returns {boolean} | ||
*/ | ||
exports.exists = function(name) { | ||
return fs.existsSync(name); | ||
}; | ||
|
||
/** | ||
* Determine if a directory is present at the given filesystem path. | ||
* | ||
* @param {string} name | ||
* | ||
* @returns {boolean} | ||
*/ | ||
exports.isDirectory = function(name) { | ||
var stat; | ||
try { | ||
stat = fs.statSync(name); | ||
} catch (error) { | ||
if (error.code === "ENOENT") { | ||
return false; | ||
} | ||
|
||
throw error; | ||
} | ||
|
||
return stat.isDirectory(); | ||
}; | ||
|
||
/** | ||
* Read a UTF-8-encoded file. | ||
* | ||
* @param {string} name | ||
* | ||
* @returns {string} | ||
*/ | ||
exports.readFile = function(name) { | ||
return fs.readFileSync(name, "utf8"); | ||
}; | ||
|
||
/** | ||
* Retrieve the name of the files and directories within a given directory. | ||
* | ||
* @param {string} name | ||
* | ||
* @returns {string[]} | ||
*/ | ||
exports.readDirectory = function(name) { | ||
return fs.readdirSync(name) | ||
.filter(function(name) { | ||
return name[0] !== "."; | ||
}); | ||
}; |
Oops, something went wrong.