Skip to content

Commit 2011158

Browse files
committedAug 30, 2016
tools: update ESLint to 3.4.0
PR-URL: #8296 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Roman Reiss <[email protected]>
1 parent 932c824 commit 2011158

File tree

303 files changed

+2227
-2058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+2227
-2058
lines changed
 

‎tools/eslint/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,14 @@ ESLint follows [semantic versioning](http://semver.org). However, due to the nat
155155
* Minor release (might break your lint build)
156156
* A bug fix in a rule that results in ESLint reporting more errors.
157157
* A new rule is created.
158-
* A new option to an existing rule is created.
158+
* A new option to an existing rule that does not result in ESLint reporting more errors by default.
159159
* An existing rule is deprecated.
160160
* A new CLI capability is created.
161161
* New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.).
162162
* A new formatter is created.
163163
* Major release (likely to break your lint build)
164164
* `eslint:recommended` is updated.
165+
* A new option to an existing rule that results in ESLint reporting more errors by default.
165166
* An existing rule is removed.
166167
* An existing formatter is removed.
167168
* Part of the public API is removed or changed in an incompatible way.

‎tools/eslint/bin/eslint.js

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* @fileoverview Main CLI that is run via the eslint command.
5+
* @author Nicholas C. Zakas
6+
*/
7+
8+
"use strict";
9+
10+
//------------------------------------------------------------------------------
11+
// Helpers
12+
//------------------------------------------------------------------------------
13+
14+
var useStdIn = (process.argv.indexOf("--stdin") > -1),
15+
init = (process.argv.indexOf("--init") > -1),
16+
debug = (process.argv.indexOf("--debug") > -1);
17+
18+
// must do this initialization *before* other requires in order to work
19+
if (debug) {
20+
require("debug").enable("eslint:*,-eslint:code-path");
21+
}
22+
23+
//------------------------------------------------------------------------------
24+
// Requirements
25+
//------------------------------------------------------------------------------
26+
27+
// now we can safely include the other modules that use debug
28+
var concat = require("concat-stream"),
29+
cli = require("../lib/cli"),
30+
path = require("path"),
31+
fs = require("fs");
32+
33+
//------------------------------------------------------------------------------
34+
// Execution
35+
//------------------------------------------------------------------------------
36+
37+
process.on("uncaughtException", function(err){
38+
// lazy load
39+
var lodash = require("lodash");
40+
41+
if (typeof err.messageTemplate === "string" && err.messageTemplate.length > 0) {
42+
var template = lodash.template(fs.readFileSync(path.resolve(__dirname, "../messages/" + err.messageTemplate + ".txt"), "utf-8"));
43+
44+
console.log("\nOops! Something went wrong! :(");
45+
console.log("\n" + template(err.messageData || {}));
46+
} else {
47+
console.log(err.message);
48+
console.log(err.stack);
49+
}
50+
51+
process.exit(1);
52+
});
53+
54+
if (useStdIn) {
55+
process.stdin.pipe(concat({ encoding: "string" }, function(text) {
56+
try {
57+
process.exitCode = cli.execute(process.argv, text);
58+
} catch (ex) {
59+
console.error(ex.message);
60+
console.error(ex.stack);
61+
process.exitCode = 1;
62+
}
63+
}));
64+
} else if (init) {
65+
var configInit = require("../lib/config/config-initializer");
66+
configInit.initializeConfig(function(err) {
67+
if (err) {
68+
process.exitCode = 1;
69+
console.error(err.message);
70+
console.error(err.stack);
71+
} else {
72+
process.exitCode = 0;
73+
}
74+
});
75+
} else {
76+
process.exitCode = cli.execute(process.argv);
77+
}

0 commit comments

Comments
 (0)
Please sign in to comment.