Remove unused variables (#22097)

Summary:
Fix unused variable ESLint warnings.
Pull Request resolved: https://github.com/facebook/react-native/pull/22097

Differential Revision: D12919249

Pulled By: TheSavior

fbshipit-source-id: f680fa7277c58cf685e70dfb911753a30fe01c1d
This commit is contained in:
Ignacio Olaciregui
2018-11-04 10:39:44 -08:00
committed by Facebook Github Bot
parent 01b7c48852
commit 6ebee18d13
9 changed files with 11 additions and 94 deletions

View File

@@ -12,7 +12,7 @@
const React = require('react');
const ReactNative = require('react-native');
const {Image, View} = ReactNative;
const {Image} = ReactNative;
const {TestModule} = ReactNative.NativeModules;
class ImageSnapshotTest extends React.Component<{}> {

View File

@@ -18,12 +18,6 @@ const {TestModule} = ReactNative.NativeModules;
const DEFAULT_WS_URL = 'ws://localhost:5555/';
const WS_EVENTS = ['close', 'error', 'message', 'open'];
const WS_STATES = [
/* 0 */ 'CONNECTING',
/* 1 */ 'OPEN',
/* 2 */ 'CLOSING',
/* 3 */ 'CLOSED',
];
type State = {
url: string,
@@ -50,7 +44,6 @@ class WebSocketTest extends React.Component<{}, State> {
_waitFor = (condition: any, timeout: any, callback: any) => {
let remaining = timeout;
let t;
const timeoutFunction = function() {
if (condition()) {
callback(true);
@@ -60,10 +53,10 @@ class WebSocketTest extends React.Component<{}, State> {
if (remaining === 0) {
callback(false);
} else {
t = setTimeout(timeoutFunction, 1000);
setTimeout(timeoutFunction, 1000);
}
};
t = setTimeout(timeoutFunction, 1000);
setTimeout(timeoutFunction, 1000);
};
_connect = () => {
@@ -121,39 +114,30 @@ class WebSocketTest extends React.Component<{}, State> {
}
testConnect = () => {
const component = this;
component._connect();
component._waitFor(component._socketIsConnected, 5, function(
connectSucceeded,
) {
this._connect();
this._waitFor(this._socketIsConnected, 5, connectSucceeded => {
if (!connectSucceeded) {
TestModule.markTestPassed(false);
return;
}
component.testSendAndReceive();
this.testSendAndReceive();
});
};
testSendAndReceive = () => {
const component = this;
component._sendTestMessage();
component._waitFor(component._receivedTestExpectedResponse, 5, function(
messageReceived,
) {
this._sendTestMessage();
this._waitFor(this._receivedTestExpectedResponse, 5, messageReceived => {
if (!messageReceived) {
TestModule.markTestPassed(false);
return;
}
component.testDisconnect();
this.testDisconnect();
});
};
testDisconnect = () => {
const component = this;
component._disconnect();
component._waitFor(component._socketIsDisconnected, 5, function(
disconnectSucceeded,
) {
this._disconnect();
this._waitFor(this._socketIsDisconnected, 5, disconnectSucceeded => {
TestModule.markTestPassed(disconnectSucceeded);
});
};

View File

@@ -26,7 +26,6 @@ const flattenStyle = require('flattenStyle');
const invariant = require('fbjs/lib/invariant');
const processDecelerationRate = require('processDecelerationRate');
const requireNativeComponent = require('requireNativeComponent');
const warning = require('fbjs/lib/warning');
const resolveAssetSource = require('resolveAssetSource');
import type {PressEvent} from 'CoreEventTypes';

View File

@@ -10,16 +10,6 @@
'use strict';
type DevToolsPluginConnection = {
isAppActive: () => boolean,
host: string,
port: number,
};
type DevToolsPlugin = {
connectToDevTools: (connection: DevToolsPluginConnection) => void,
};
let register = function() {
// noop
};

View File

@@ -92,7 +92,6 @@ export type Props = {
name: string,
children: React.Node,
};
type State = {
doIncrementalRender: boolean,
};

View File

@@ -1,31 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @emails oncall+javascript_foundation
*/
'use strict';
const xcode = require('xcode');
const getProducts = require('../../ios/getProducts');
const path = require('path');
const project = xcode.project(
path.join(__dirname, '../../__fixtures__/project.pbxproj'),
);
describe('ios::getProducts', () => {
beforeEach(() => {
project.parseSync();
});
it('should return an array of static libraries project exports', () => {
const products = getProducts(project);
expect(products.length).toBe(1);
expect(products).toContain('libRCTActionSheet.a');
});
});

View File

@@ -1,20 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
/**
* Given xcodeproj it returns list of products ending with
* .a extension, so that we know what elements add to target
* project static library
*/
module.exports = function getProducts(project) {
return project
.pbxGroupByName('Products')
.children.map(c => c.comment)
.filter(c => c.indexOf('.a') > -1);
};

View File

@@ -10,19 +10,16 @@
const xcode = require('xcode');
const fs = require('fs');
const path = require('path');
const log = require('npmlog');
const addToHeaderSearchPaths = require('./addToHeaderSearchPaths');
const getHeadersInFolder = require('./getHeadersInFolder');
const getHeaderSearchPath = require('./getHeaderSearchPath');
const getProducts = require('./getProducts');
const getTargets = require('./getTargets');
const createGroupWithMessage = require('./createGroupWithMessage');
const addFileToProject = require('./addFileToProject');
const addProjectToLibraries = require('./addProjectToLibraries');
const addSharedLibraries = require('./addSharedLibraries');
const isEmpty = require('lodash').isEmpty;
const getGroup = require('./getGroup');
/**
* Register native module IOS adds given dependency to project by adding

View File

@@ -147,7 +147,6 @@ describe('Android Test App', function() {
});
it('should have Debug In Chrome working', function() {
const androidAppCode = fs.readFileSync('index.js', 'utf-8');
// http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_MENU
return driver
.waitForElementByXPath(