summaryrefslogtreecommitdiff
path: root/tools/eslint/bin/eslint.js
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2016-04-09 14:11:01 +0200
committersilverwind <me@silverwind.io>2016-04-10 11:46:08 +0200
commit2f6ff1bb64ac4f3e201039c8e83f8eb95f73c769 (patch)
tree710fe0778ca523281965244fdca60c4a031980e6 /tools/eslint/bin/eslint.js
parent8f4fdc93f07a06a62d4f867c6e0fd2f6287bb8be (diff)
downloadnode-new-2f6ff1bb64ac4f3e201039c8e83f8eb95f73c769.tar.gz
tools: update ESLint to 2.7.0
PR-URL: https://github.com/nodejs/node/pull/6132 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
Diffstat (limited to 'tools/eslint/bin/eslint.js')
-rw-r--r--[-rwxr-xr-x]tools/eslint/bin/eslint.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/tools/eslint/bin/eslint.js b/tools/eslint/bin/eslint.js
index 598b568ba4..19e5720a71 100755..100644
--- a/tools/eslint/bin/eslint.js
+++ b/tools/eslint/bin/eslint.js
@@ -29,12 +29,31 @@ if (debug) {
// now we can safely include the other modules that use debug
var concat = require("concat-stream"),
- cli = require("../lib/cli");
+ cli = require("../lib/cli"),
+ path = require("path"),
+ fs = require("fs");
//------------------------------------------------------------------------------
// Execution
//------------------------------------------------------------------------------
+process.on("uncaughtException", function(err){
+ // lazy load
+ var lodash = require("lodash");
+
+ if (typeof err.messageTemplate === "string" && err.messageTemplate.length > 0) {
+ var template = lodash.template(fs.readFileSync(path.resolve(__dirname, "../messages/" + err.messageTemplate + ".txt"), "utf-8"));
+
+ console.log("\nOops! Something went wrong! :(");
+ console.log("\n" + template(err.messageData || {}));
+ } else {
+ console.log(err.message);
+ console.log(err.stack);
+ }
+
+ process.exit(1);
+});
+
if (useStdIn) {
process.stdin.pipe(concat({ encoding: "string" }, function(text) {
try {