Skip to content

Commit

Permalink
Fix linting issues (#22062)
Browse files Browse the repository at this point in the history
Summary:
Fixes lots of ESLint warnings. Many of them where in PR #20877 by janicduplessis which requested to split the linting fixes from configuration and package changes.

I solved only the issues that I was most certain about but I would love to get hands on all of them with a little bit of input.
Pull Request resolved: facebook/react-native#22062

Differential Revision: D12889447

Pulled By: TheSavior

fbshipit-source-id: 35f7a08104a5b859c860afdde4af2b32c0685c50
  • Loading branch information
ignacioola authored and facebook-github-bot committed Nov 1, 2018
1 parent a7ee8f2 commit a6c7a76
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 20 deletions.
22 changes: 8 additions & 14 deletions generator/promptSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ function create() {
return prompt;

function prompt(ask, value, opts) {
var insert = 0,
savedinsert = 0,
res,
i,
savedstr;
var insert = 0;
opts = opts || {};

if (Object(ask) === ask) {
Expand Down Expand Up @@ -52,15 +48,10 @@ function create() {
character,
read;

savedstr = '';

if (ask) {
process.stdout.write(ask);
}

var cycle = 0;
var prevComplete;

while (true) {
read = fs.readSync(fd, buf, 0, 3);
if (read > 1) {
Expand All @@ -80,7 +71,7 @@ function create() {
character = buf[read - 1];

// catch a ^C and return null
if (character == 3) {
if (character === 3) {
process.stdout.write('^C\n');
fs.closeSync(fd);
process.exit(130);
Expand All @@ -89,12 +80,15 @@ function create() {
}

// catch the terminating character
if (character == term) {
if (character === term) {
fs.closeSync(fd);
break;
}

if (character == 127 || (process.platform == 'win32' && character == 8)) {
if (
character === 127 ||
(process.platform === 'win32' && character === 8)
) {
//backspace
if (!insert) {
continue;
Expand All @@ -119,7 +113,7 @@ function create() {
);
} else {
process.stdout.write('\u001b[s');
if (insert == str.length) {
if (insert === str.length) {
process.stdout.write('\u001b[2K\u001b[0G' + ask + str);
} else {
if (ask) {
Expand Down
2 changes: 1 addition & 1 deletion link/__tests__/ios/writePlist.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('ios::writePlist', () => {

it('should write a `.plist` file', () => {
plistPath = '/Basic/Info.plist';
const result = writePlist(project, '/', plist);
writePlist(project, '/', plist);
const infoPlist = readFileSync(infoPlistPath).toString();
expect(fs.writeFileSync).toHaveBeenCalledWith(plistPath, infoPlist);
});
Expand Down
1 change: 0 additions & 1 deletion link/ios/copyAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
const fs = require('fs-extra');
const path = require('path');
const xcode = require('xcode');
const log = require('npmlog');
const groupFilesByType = require('../groupFilesByType');
const createGroupWithMessage = require('./createGroupWithMessage');
const getPlist = require('./getPlist');
Expand Down
1 change: 0 additions & 1 deletion link/ios/unregisterNativeModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const difference = require('lodash').difference;
const isEmpty = require('lodash').isEmpty;

const getGroup = require('./getGroup');
const getProducts = require('./getProducts');
const getTargets = require('./getTargets');
const getHeadersInFolder = require('./getHeadersInFolder');
const getHeaderSearchPath = require('./getHeaderSearchPath');
Expand Down
2 changes: 1 addition & 1 deletion templates/HelloWorld/__tests__/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import App from '../App';
import renderer from 'react-test-renderer';

it('renders correctly', () => {
const tree = renderer.create(<App />);
renderer.create(<App />);
});
2 changes: 0 additions & 2 deletions upgrade/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const chalk = require('chalk');
const copyProjectTemplateAndReplace = require('../generator/copyProjectTemplateAndReplace');
const fs = require('fs');
const path = require('path');
const printRunInstructions = require('../generator/printRunInstructions');
const semver = require('semver');
const yarn = require('../util/yarn');

/**
* Migrate application to a new version of React Native.
Expand Down

0 comments on commit a6c7a76

Please sign in to comment.