Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/bin/eslint.js')
-rwxr-xr-xtools/eslint/bin/eslint.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/eslint/bin/eslint.js b/tools/eslint/bin/eslint.js
index 0188c2e6000..5e0cc800c8c 100755
--- a/tools/eslint/bin/eslint.js
+++ b/tools/eslint/bin/eslint.js
@@ -1,9 +1,11 @@
#!/usr/bin/env node
var concat = require("concat-stream"),
+ configInit = require("../lib/config-initializer"),
cli = require("../lib/cli");
var exitCode = 0,
- useStdIn = (process.argv.indexOf("--stdin") > -1);
+ useStdIn = (process.argv.indexOf("--stdin") > -1),
+ init = (process.argv.indexOf("--init") > -1);
if (useStdIn) {
process.stdin.pipe(concat({ encoding: "string" }, function(text) {
@@ -15,6 +17,17 @@ if (useStdIn) {
exitCode = 1;
}
}));
+} else if (init) {
+ configInit.initializeConfig(function(err) {
+ if (err) {
+ exitCode = 1;
+ console.error(err.message);
+ console.error(err.stack);
+ } else {
+ console.log("Successfully created .eslintrc file in " + process.cwd());
+ exitCode = 0;
+ }
+ });
} else {
exitCode = cli.execute(process.argv);
}