From 32c57962947e1148ca0a6a1528a3dcc196bbe04f Mon Sep 17 00:00:00 2001 From: Ignacio Olaciregui Date: Sat, 3 Nov 2018 09:36:27 -0300 Subject: [PATCH 1/2] Remove unused variables --- IntegrationTests/ImageSnapshotTest.js | 2 +- IntegrationTests/WebSocketTest.js | 36 ++++++------------- Libraries/Components/ScrollView/ScrollView.js | 1 - Libraries/Core/Devtools/setupDevtools.js | 10 ------ Libraries/Experimental/Incremental.js | 1 - local-cli/link/ios/registerNativeModule.js | 3 -- scripts/android-e2e-test.js | 1 - 7 files changed, 11 insertions(+), 43 deletions(-) diff --git a/IntegrationTests/ImageSnapshotTest.js b/IntegrationTests/ImageSnapshotTest.js index 255db4090d9f71..c4ffaae51c2ec4 100644 --- a/IntegrationTests/ImageSnapshotTest.js +++ b/IntegrationTests/ImageSnapshotTest.js @@ -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<{}> { diff --git a/IntegrationTests/WebSocketTest.js b/IntegrationTests/WebSocketTest.js index d1ccb68cc74a01..0d2cd5e0b4d9e7 100644 --- a/IntegrationTests/WebSocketTest.js +++ b/IntegrationTests/WebSocketTest.js @@ -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); }); }; diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 52863d11c6a181..fd0986f0f15347 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -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'; diff --git a/Libraries/Core/Devtools/setupDevtools.js b/Libraries/Core/Devtools/setupDevtools.js index 232301629e021b..35b2a6ba50fb25 100644 --- a/Libraries/Core/Devtools/setupDevtools.js +++ b/Libraries/Core/Devtools/setupDevtools.js @@ -10,16 +10,6 @@ 'use strict'; -type DevToolsPluginConnection = { - isAppActive: () => boolean, - host: string, - port: number, -}; - -type DevToolsPlugin = { - connectToDevTools: (connection: DevToolsPluginConnection) => void, -}; - let register = function() { // noop }; diff --git a/Libraries/Experimental/Incremental.js b/Libraries/Experimental/Incremental.js index a01bf9ae5c56f0..76d8ff902680ab 100644 --- a/Libraries/Experimental/Incremental.js +++ b/Libraries/Experimental/Incremental.js @@ -92,7 +92,6 @@ export type Props = { name: string, children: React.Node, }; - type State = { doIncrementalRender: boolean, }; diff --git a/local-cli/link/ios/registerNativeModule.js b/local-cli/link/ios/registerNativeModule.js index 18d86c56f54da6..b68230ce31ea79 100644 --- a/local-cli/link/ios/registerNativeModule.js +++ b/local-cli/link/ios/registerNativeModule.js @@ -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 diff --git a/scripts/android-e2e-test.js b/scripts/android-e2e-test.js index 0de168b63b6536..abeabb4a55e4e4 100644 --- a/scripts/android-e2e-test.js +++ b/scripts/android-e2e-test.js @@ -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( From d63b7eec2b2a5e4f2a8ae30ef52bd15d97dd11a1 Mon Sep 17 00:00:00 2001 From: Ignacio Olaciregui Date: Sun, 4 Nov 2018 07:51:54 -0300 Subject: [PATCH 2/2] Remove unused getProducts module --- .../link/__tests__/ios/getProducts.spec.js | 31 ------------------- local-cli/link/ios/getProducts.js | 20 ------------ 2 files changed, 51 deletions(-) delete mode 100644 local-cli/link/__tests__/ios/getProducts.spec.js delete mode 100644 local-cli/link/ios/getProducts.js diff --git a/local-cli/link/__tests__/ios/getProducts.spec.js b/local-cli/link/__tests__/ios/getProducts.spec.js deleted file mode 100644 index 7457a7c39cc691..00000000000000 --- a/local-cli/link/__tests__/ios/getProducts.spec.js +++ /dev/null @@ -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'); - }); -}); diff --git a/local-cli/link/ios/getProducts.js b/local-cli/link/ios/getProducts.js deleted file mode 100644 index 0144808e7466aa..00000000000000 --- a/local-cli/link/ios/getProducts.js +++ /dev/null @@ -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); -};