Fix rn-cli linting issues (#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: https://github.com/facebook/react-native/pull/22099

Differential Revision: D12920673

Pulled By: TheSavior

fbshipit-source-id: ed1308fe7ef4633b793d85fe8c6ce5d068651e12
This commit is contained in:
Ignacio Olaciregui
2018-11-04 21:09:51 -08:00
committed by Facebook Github Bot
parent ce18036c35
commit 7b10a028ca

View File

@@ -40,7 +40,6 @@
var fs = require('fs');
var path = require('path');
var exec = require('child_process').exec;
var execSync = require('child_process').execSync;
var chalk = require('chalk');
var prompt = require('prompt');
@@ -59,7 +58,7 @@ var semver = require('semver');
* - "/Users/home/react-native/react-native-0.22.0.tgz" - for package prepared with `npm pack`, useful for e2e tests
*/
var options = require('minimist')(process.argv.slice(2));
var args = require('minimist')(process.argv.slice(2));
var CLI_MODULE_PATH = function() {
return path.resolve(process.cwd(), 'node_modules', 'react-native', 'cli.js');
@@ -74,7 +73,7 @@ var REACT_NATIVE_PACKAGE_JSON_PATH = function() {
);
};
if (options._.length === 0 && (options.v || options.version)) {
if (args._.length === 0 && (args.v || args.version)) {
printVersionsAndExit(REACT_NATIVE_PACKAGE_JSON_PATH());
}
@@ -113,20 +112,20 @@ if (fs.existsSync(cliPath)) {
cli = require(cliPath);
}
var commands = options._;
var commands = args._;
if (cli) {
cli.run();
} else {
if (options._.length === 0 && (options.h || options.help)) {
if (args._.length === 0 && (args.h || args.help)) {
console.log(
[
'',
' Usage: react-native [command] [options]',
' Usage: react-native [command] [args]',
'',
'',
' Commands:',
'',
' init <ProjectName> [options] generates a new project and installs its dependencies',
' init <ProjectName> [args] generates a new project and installs its dependencies',
'',
' Options:',
'',
@@ -152,7 +151,7 @@ if (cli) {
console.error('Usage: react-native init <ProjectName> [--verbose]');
process.exit(1);
} else {
init(commands[1], options);
init(commands[1], args);
}
break;
default:
@@ -215,6 +214,11 @@ function createAfterConfirmation(name, options) {
};
prompt.get(property, function(err, result) {
if (err) {
console.log('Error initializing project');
process.exit(1);
}
if (result.yesno[0] === 'y') {
createProject(name, options);
} else {