Skip to content

Commit

Permalink
Fix rn-cli linting issues (facebook#22099)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ignacioola authored and facebook-github-bot committed Nov 5, 2018
1 parent 1202ff7 commit 6a1c904
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions react-native-cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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());
}

Expand Down Expand Up @@ -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:',
'',
Expand All @@ -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:
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6a1c904

Please sign in to comment.