Skip to content

Commit 6a1c904

Browse files
ignacioolafacebook-github-bot
authored andcommitted
Fix rn-cli linting issues (facebook#22099)
Summary: Fixes ESLint warnings in `react-native-cli`. I isolated this PR from other lint fixes because of the top `DO NOT MODIFY THIS FILE` message. Either way I think this issues should be fixed :) Pull Request resolved: facebook#22099 Differential Revision: D12920673 Pulled By: TheSavior fbshipit-source-id: ed1308fe7ef4633b793d85fe8c6ce5d068651e12
1 parent 1202ff7 commit 6a1c904

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

react-native-cli/index.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
var fs = require('fs');
4242
var path = require('path');
43-
var exec = require('child_process').exec;
4443
var execSync = require('child_process').execSync;
4544
var chalk = require('chalk');
4645
var prompt = require('prompt');
@@ -59,7 +58,7 @@ var semver = require('semver');
5958
* - "/Users/home/react-native/react-native-0.22.0.tgz" - for package prepared with `npm pack`, useful for e2e tests
6059
*/
6160

62-
var options = require('minimist')(process.argv.slice(2));
61+
var args = require('minimist')(process.argv.slice(2));
6362

6463
var CLI_MODULE_PATH = function() {
6564
return path.resolve(process.cwd(), 'node_modules', 'react-native', 'cli.js');
@@ -74,7 +73,7 @@ var REACT_NATIVE_PACKAGE_JSON_PATH = function() {
7473
);
7574
};
7675

77-
if (options._.length === 0 && (options.v || options.version)) {
76+
if (args._.length === 0 && (args.v || args.version)) {
7877
printVersionsAndExit(REACT_NATIVE_PACKAGE_JSON_PATH());
7978
}
8079

@@ -113,20 +112,20 @@ if (fs.existsSync(cliPath)) {
113112
cli = require(cliPath);
114113
}
115114

116-
var commands = options._;
115+
var commands = args._;
117116
if (cli) {
118117
cli.run();
119118
} else {
120-
if (options._.length === 0 && (options.h || options.help)) {
119+
if (args._.length === 0 && (args.h || args.help)) {
121120
console.log(
122121
[
123122
'',
124-
' Usage: react-native [command] [options]',
123+
' Usage: react-native [command] [args]',
125124
'',
126125
'',
127126
' Commands:',
128127
'',
129-
' init <ProjectName> [options] generates a new project and installs its dependencies',
128+
' init <ProjectName> [args] generates a new project and installs its dependencies',
130129
'',
131130
' Options:',
132131
'',
@@ -152,7 +151,7 @@ if (cli) {
152151
console.error('Usage: react-native init <ProjectName> [--verbose]');
153152
process.exit(1);
154153
} else {
155-
init(commands[1], options);
154+
init(commands[1], args);
156155
}
157156
break;
158157
default:
@@ -215,6 +214,11 @@ function createAfterConfirmation(name, options) {
215214
};
216215

217216
prompt.get(property, function(err, result) {
217+
if (err) {
218+
console.log('Error initializing project');
219+
process.exit(1);
220+
}
221+
218222
if (result.yesno[0] === 'y') {
219223
createProject(name, options);
220224
} else {

0 commit comments

Comments
 (0)