From 23331df5a40ad8ddff58f561af24d7401b62e330 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Sun, 20 Nov 2016 17:49:21 -0800 Subject: [PATCH] RN: Cleanup OSS JS & Flow Declarations Reviewed By: vjeux Differential Revision: D4210763 fbshipit-source-id: 5abaa547100b8badd13bcf311ceffc5b4098d252 --- .../UIExplorerUnitTests/TestBundle.js | 3 +- .../Animated/src/__tests__/bezier-test.js | 10 +++ Libraries/Animated/src/bezier.js | 6 +- .../__tests__/TouchableHighlight-test.js | 1 + Libraries/Core/ErrorUtils.js | 2 + Libraries/Core/InitializeCore.js | 27 ++++--- Libraries/EventEmitter/EventEmitter.js | 2 + Libraries/EventEmitter/mixInEventEmitter.js | 1 + Libraries/Image/AssetSourceResolver.js | 1 + Libraries/Utilities/clamp.js | 29 +++---- Libraries/promiseRejectionIsError.js | 1 + .../react-native/react-native-interface.js | 1 + Libraries/vendor/core/Map.js | 35 ++++---- Libraries/vendor/core/Set.js | 32 ++++---- .../core/_shouldPolyfillES6Collection.js | 19 ++--- Libraries/vendor/core/copyProperties.js | 19 ++--- Libraries/vendor/core/getObjectValues.js | 17 ++-- Libraries/vendor/core/guid.js | 32 +++----- Libraries/vendor/core/isEmpty.js | 17 ++-- Libraries/vendor/core/toIterator.js | 21 ++--- .../selection/DocumentSelectionState.js | 19 ++--- flow/Map.js | 15 +++- flow/Position.js | 13 ++- flow/Promise.js | 7 +- flow/Set.js | 15 +++- flow/console.js | 5 +- flow/global.js | 6 +- flow/react.js | 16 +++- jest/mockComponent.js | 1 + jestSupport/env.js | 1 + .../react-packager/src/Bundler/base64-vlq.js | 11 ++- .../src/Resolver/polyfills/Array.es6.js | 10 ++- .../Resolver/polyfills/Array.prototype.es6.js | 7 +- .../src/Resolver/polyfills/Number.es6.js | 4 +- .../src/Resolver/polyfills/Object.es7.js | 20 +++-- .../polyfills/String.prototype.es6.js | 10 ++- .../polyfills/__tests__/Number.es6-test.js | 79 ------------------- .../polyfills/__tests__/Object.es7-test.js | 29 ++++--- .../src/Resolver/polyfills/babelHelpers.js | 2 + .../src/Resolver/polyfills/console.js | 7 +- .../src/Resolver/polyfills/error-guard.js | 18 +++-- .../src/Resolver/polyfills/polyfills.js | 9 +-- .../src/Resolver/polyfills/prelude.js | 14 +++- .../src/Resolver/polyfills/prelude_dev.js | 14 +++- .../src/Resolver/polyfills/require.js | 1 + .../DependencyGraph/assets/empty-module.js | 2 +- scripts/try-n-times.js | 15 +++- website/core/AlgoliaDocSearch.js | 3 + website/core/DocsSidebar.js | 3 +- website/core/Footer.js | 1 + website/core/H2.js | 3 +- website/core/Header.js | 4 +- website/core/HeaderLinks.js | 3 +- website/core/HeaderWithGithub.js | 1 + website/core/Hero.js | 1 + website/core/Marked.js | 13 ++- website/core/Prism.js | 8 +- website/core/Site.js | 75 +++++++++--------- website/core/WebPlayer.js | 7 +- website/core/center.js | 1 + website/core/slugify.js | 1 + website/core/unindent.js | 1 + website/jsdocs/jsdoc-plugin-values.js | 30 ++++--- website/jsdocs/syntax.js | 3 +- website/layout/DocsLayout.js | 5 +- website/layout/PageLayout.js | 3 +- website/layout/RedirectLayout.js | 5 +- website/src/react-native/404.js | 3 +- website/src/react-native/index.js | 5 +- website/src/react-native/js/scripts.js | 27 ++++++- website/src/react-native/showcase.js | 7 +- website/src/react-native/support.js | 3 +- website/src/react-native/versions.js | 11 ++- 73 files changed, 471 insertions(+), 382 deletions(-) delete mode 100644 packager/react-packager/src/Resolver/polyfills/__tests__/Number.es6-test.js diff --git a/Examples/UIExplorer/UIExplorerUnitTests/TestBundle.js b/Examples/UIExplorer/UIExplorerUnitTests/TestBundle.js index 6f3caed35..151499da8 100644 --- a/Examples/UIExplorer/UIExplorerUnitTests/TestBundle.js +++ b/Examples/UIExplorer/UIExplorerUnitTests/TestBundle.js @@ -6,8 +6,9 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +'use strict'; -var __fbBatchedBridge = { +const __fbBatchedBridge = { // eslint-disable-line no-unused-vars flushedQueue: function() { return null; } diff --git a/Libraries/Animated/src/__tests__/bezier-test.js b/Libraries/Animated/src/__tests__/bezier-test.js index 3d52294b0..4e3c8a9ce 100644 --- a/Libraries/Animated/src/__tests__/bezier-test.js +++ b/Libraries/Animated/src/__tests__/bezier-test.js @@ -1,5 +1,15 @@ +/** + * BezierEasing - use bezier curve for transition easing function + * https://github.com/gre/bezier-easing + * + * @copyright 2014-2015 Gaëtan Renaudeau. MIT License. + * @noflow + */ + /* eslint-disable */ +'use strict'; + jest.unmock('bezier'); var bezier = require('bezier'); diff --git a/Libraries/Animated/src/bezier.js b/Libraries/Animated/src/bezier.js index 32bb9d76c..2bd594930 100644 --- a/Libraries/Animated/src/bezier.js +++ b/Libraries/Animated/src/bezier.js @@ -1,10 +1,12 @@ /** - * https://github.com/gre/bezier-easing * BezierEasing - use bezier curve for transition easing function - * by Gaëtan Renaudeau 2014 - 2015 – MIT License + * https://github.com/gre/bezier-easing * + * @copyright 2014-2015 Gaëtan Renaudeau. MIT License. * @providesModule bezier + * @noflow */ +'use strict'; // These values are established by empiricism with tests (tradeoff: performance VS precision) var NEWTON_ITERATIONS = 4; diff --git a/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js b/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js index 4673d34b1..19869d0c4 100644 --- a/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js +++ b/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +'use strict'; jest.disableAutomock(); diff --git a/Libraries/Core/ErrorUtils.js b/Libraries/Core/ErrorUtils.js index e3b9c2b47..eed9a06d6 100644 --- a/Libraries/Core/ErrorUtils.js +++ b/Libraries/Core/ErrorUtils.js @@ -7,7 +7,9 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ErrorUtils + * @flow */ + /* eslint-disable strict */ /** diff --git a/Libraries/Core/InitializeCore.js b/Libraries/Core/InitializeCore.js index 361a2a06f..02c3d016a 100644 --- a/Libraries/Core/InitializeCore.js +++ b/Libraries/Core/InitializeCore.js @@ -6,23 +6,28 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * Sets up global variables typical in most JavaScript environments. - * - * 1. Global timers (via `setTimeout` etc). - * 2. Global console object. - * 3. Hooks for printing stack traces with source maps. - * - * Leaves enough room in the environment for implementing your own: - * 1. Require system. - * 2. Bridged modules. - * * @providesModule InitializeCore * @flow */ -/* eslint strict: 0 */ +/* eslint-disable strict */ /* globals window: true */ + +/** + * Sets up global variables typical in most JavaScript environments. + * + * 1. Global timers (via `setTimeout` etc). + * 2. Global console object. + * 3. Hooks for printing stack traces with source maps. + * + * Leaves enough room in the environment for implementing your own: + * + * 1. Require system. + * 2. Bridged modules. + * + */ + if (global.GLOBAL === undefined) { global.GLOBAL = global; } diff --git a/Libraries/EventEmitter/EventEmitter.js b/Libraries/EventEmitter/EventEmitter.js index 3260cb08a..5f981ceeb 100644 --- a/Libraries/EventEmitter/EventEmitter.js +++ b/Libraries/EventEmitter/EventEmitter.js @@ -10,9 +10,11 @@ * @noflow * @typecheck */ +'use strict'; const EmitterSubscription = require('EmitterSubscription'); const EventSubscriptionVendor = require('EventSubscriptionVendor'); + const emptyFunction = require('fbjs/lib/emptyFunction'); const invariant = require('fbjs/lib/invariant'); diff --git a/Libraries/EventEmitter/mixInEventEmitter.js b/Libraries/EventEmitter/mixInEventEmitter.js index c2f43a044..2e2f47e02 100644 --- a/Libraries/EventEmitter/mixInEventEmitter.js +++ b/Libraries/EventEmitter/mixInEventEmitter.js @@ -9,6 +9,7 @@ * @providesModule mixInEventEmitter * @flow */ +'use strict'; const EventEmitter = require('EventEmitter'); const EventEmitterWithHolding = require('EventEmitterWithHolding'); diff --git a/Libraries/Image/AssetSourceResolver.js b/Libraries/Image/AssetSourceResolver.js index e8ed94c66..96ccfe90f 100644 --- a/Libraries/Image/AssetSourceResolver.js +++ b/Libraries/Image/AssetSourceResolver.js @@ -9,6 +9,7 @@ * @providesModule AssetSourceResolver * @flow */ +'use strict'; export type ResolvedAssetSource = { __packager_asset: boolean, diff --git a/Libraries/Utilities/clamp.js b/Libraries/Utilities/clamp.js index cb7578cee..64418ff3f 100644 --- a/Libraries/Utilities/clamp.js +++ b/Libraries/Utilities/clamp.js @@ -1,27 +1,22 @@ /** - * @generated SignedSource<> + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule clamp * @typechecks */ +'use strict'; - /** - * @param {number} value - * @param {number} min - * @param {number} max - * @return {number} - */ +/** + * @param {number} value + * @param {number} min + * @param {number} max + * @return {number} + */ function clamp(min, value, max) { if (value < min) { return min; diff --git a/Libraries/promiseRejectionIsError.js b/Libraries/promiseRejectionIsError.js index 7e6bca86f..a2ab6bb38 100644 --- a/Libraries/promiseRejectionIsError.js +++ b/Libraries/promiseRejectionIsError.js @@ -9,6 +9,7 @@ * @providesModule promiseRejectionIsError * @flow */ +'use strict'; require('Promise'); // make sure the default rejection handler is installed const rejectionTracking = require('promise/setimmediate/rejection-tracking'); diff --git a/Libraries/react-native/react-native-interface.js b/Libraries/react-native/react-native-interface.js index 623ffd98c..63e77de82 100644 --- a/Libraries/react-native/react-native-interface.js +++ b/Libraries/react-native/react-native-interface.js @@ -8,6 +8,7 @@ * * @flow */ +'use strict'; // see also react-native.js diff --git a/Libraries/vendor/core/Map.js b/Libraries/vendor/core/Map.js index b3153b39d..33f206fcc 100644 --- a/Libraries/vendor/core/Map.js +++ b/Libraries/vendor/core/Map.js @@ -1,27 +1,24 @@ /** - * @generated SignedSource<<375749f44ce7c0f681fc1297943eaf74>> + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * Copyright 2013-2014 Facebook, Inc. * @providesModule Map * @preventMunge * @typechecks */ +/* eslint-disable no-extend-native, no-shadow-restricted-names */ + +'use strict'; + +var _shouldPolyfillES6Collection = require('_shouldPolyfillES6Collection'); var guid = require('guid'); var isNode = require('fbjs/lib/isNode'); var toIterator = require('toIterator'); -var _shouldPolyfillES6Collection = require('_shouldPolyfillES6Collection'); module.exports = (function(global, undefined) { // Since our implementation is spec-compliant for the most part we can safely @@ -298,7 +295,7 @@ module.exports = (function(global, undefined) { * @param {string} kind */ constructor(map, kind) { - if (!(isObject(map) && map['_mapData'])) { + if (!(isObject(map) && map._mapData)) { throw new TypeError('Object is not a map.'); } @@ -330,7 +327,7 @@ module.exports = (function(global, undefined) { return createIterResultObject(undefined, true); } - var entries = map['_mapData']; + var entries = map._mapData; while (index < entries.length) { var record = entries[index]; @@ -360,7 +357,7 @@ module.exports = (function(global, undefined) { // 23.1.5.2.2 MapIterator.prototype[toIterator.ITERATOR_SYMBOL] = function() { return this; - } + }; /** * Helper Functions. @@ -515,7 +512,7 @@ module.exports = (function(global, undefined) { try { Object.defineProperty({}, 'x', {}); return true; - } catch(e) { + } catch (e) { return false; } })(); @@ -573,7 +570,7 @@ module.exports = (function(global, undefined) { * @param {object|array|function|regexp} o * @return {number} */ - return function getHash(o) { + return function getHash(o) { // eslint-disable-line no-shadow if (o[hashProperty]) { return o[hashProperty]; } else if (!isES5 && @@ -623,4 +620,4 @@ module.exports = (function(global, undefined) { })(); return Map; -})(/* jslint evil: true */ Function('return this')()); +})(Function('return this')()); // eslint-disable-line no-new-func diff --git a/Libraries/vendor/core/Set.js b/Libraries/vendor/core/Set.js index 3bd019aea..658722b6c 100644 --- a/Libraries/vendor/core/Set.js +++ b/Libraries/vendor/core/Set.js @@ -1,28 +1,26 @@ /** - * @generated SignedSource<<1fe20877e83ba5d4d0ea68ab240df21c>> + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * Copyright 2013-2014 Facebook, Inc. * @providesModule Set * @preventMunge * @typechecks */ -var Map = require('Map'); -var toIterator = require('toIterator'); -var _shouldPolyfillES6Collection = require('_shouldPolyfillES6Collection'); +/* eslint-disable no-extend-native */ -module.exports = (function(global, undefined) { +'use strict'; + +var Map = require('Map'); + +var _shouldPolyfillES6Collection = require('_shouldPolyfillES6Collection'); +var toIterator = require('toIterator'); + +module.exports = (function(global) { // Since our implementation is spec-compliant for the most part we can safely // delegate to a built-in version if exists and is implemented correctly. // Firefox had gotten a few implementation details wrong across different @@ -198,4 +196,4 @@ module.exports = (function(global, undefined) { } return Set; -})(/* jslint evil: true */ Function('return this')()); +})(Function('return this')()); // eslint-disable-line no-new-func diff --git a/Libraries/vendor/core/_shouldPolyfillES6Collection.js b/Libraries/vendor/core/_shouldPolyfillES6Collection.js index 4a9aecd80..0f51b4b2f 100644 --- a/Libraries/vendor/core/_shouldPolyfillES6Collection.js +++ b/Libraries/vendor/core/_shouldPolyfillES6Collection.js @@ -1,23 +1,16 @@ /** - * @generated SignedSource<> + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * - * Copyright 2004-present Facebook. All Rights Reserved. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule _shouldPolyfillES6Collection * @preventMunge * @flow */ +'use strict'; /** * Checks whether a collection name (e.g. "Map" or "Set") has a native polyfill diff --git a/Libraries/vendor/core/copyProperties.js b/Libraries/vendor/core/copyProperties.js index e5a2638d9..d98ed9055 100644 --- a/Libraries/vendor/core/copyProperties.js +++ b/Libraries/vendor/core/copyProperties.js @@ -1,19 +1,14 @@ /** - * @generated SignedSource<> + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule copyProperties */ +'use strict'; /** * Copy properties from one or more objects (up to 5) into the first object. @@ -42,7 +37,7 @@ function copyProperties(obj, a, b, c, d, e, f) { // IE ignores toString in object iteration.. See: // webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html if (v.hasOwnProperty && v.hasOwnProperty('toString') && - (typeof v.toString != 'undefined') && (obj.toString !== v.toString)) { + (typeof v.toString !== 'undefined') && (obj.toString !== v.toString)) { obj.toString = v.toString; } } diff --git a/Libraries/vendor/core/getObjectValues.js b/Libraries/vendor/core/getObjectValues.js index a7c9448bd..732313dc1 100644 --- a/Libraries/vendor/core/getObjectValues.js +++ b/Libraries/vendor/core/getObjectValues.js @@ -1,20 +1,15 @@ /** - * @generated SignedSource<> + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getObjectValues * @typechecks */ +'use strict'; /** * Retrieve an object's values as an array. diff --git a/Libraries/vendor/core/guid.js b/Libraries/vendor/core/guid.js index 7f66e64da..cf6e4d584 100644 --- a/Libraries/vendor/core/guid.js +++ b/Libraries/vendor/core/guid.js @@ -1,29 +1,23 @@ /** - * @generated SignedSource<<4425c6f5a34b56ee4707e090f43fd075>> + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * - * Copyright 2004-present Facebook. All Rights Reserved. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * + * @providesModule guid + */ + +/* eslint-disable no-bitwise */ + +'use strict'; + +/** * Module that provides a function for creating a unique identifier. * The returned value does not conform to the GUID standard, but should * be globally unique in the context of the browser. - * - * @providesModule guid - * */ - -/*jshint bitwise: false*/ - function guid() { return 'f' + (Math.random() * (1 << 30)).toString(16).replace('.', ''); } diff --git a/Libraries/vendor/core/isEmpty.js b/Libraries/vendor/core/isEmpty.js index 27f4c0069..301efef72 100644 --- a/Libraries/vendor/core/isEmpty.js +++ b/Libraries/vendor/core/isEmpty.js @@ -1,19 +1,14 @@ /** - * @generated SignedSource<<97ffcebc9ae390e734026a4f3964bff6>> + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isEmpty */ +'use strict'; /** * Mimics empty from PHP. diff --git a/Libraries/vendor/core/toIterator.js b/Libraries/vendor/core/toIterator.js index 937695419..ce28f94a3 100644 --- a/Libraries/vendor/core/toIterator.js +++ b/Libraries/vendor/core/toIterator.js @@ -1,23 +1,14 @@ /** - * @generated SignedSource<<32241616e13b8a54d1a7baadce8eae5d>> + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * - * Copyright 2004-present Facebook. All Rights Reserved. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule toIterator - * */ - +'use strict'; /** * Given an object `toIterator` will return the itrator for that object. If the diff --git a/Libraries/vendor/document/selection/DocumentSelectionState.js b/Libraries/vendor/document/selection/DocumentSelectionState.js index ab900ab78..87ce63bce 100644 --- a/Libraries/vendor/document/selection/DocumentSelectionState.js +++ b/Libraries/vendor/document/selection/DocumentSelectionState.js @@ -1,21 +1,17 @@ /** - * @generated SignedSource<<1f058815818e10d01d2ee1f2f70d0fb1>> + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DocumentSelectionState * @typechecks */ +'use strict'; + var mixInEventEmitter = require('mixInEventEmitter'); /** @@ -153,4 +149,3 @@ mixInEventEmitter(DocumentSelectionState, { }); module.exports = DocumentSelectionState; - diff --git a/flow/Map.js b/flow/Map.js index 73c4e12ca..99d0a0ab6 100644 --- a/flow/Map.js +++ b/flow/Map.js @@ -1,5 +1,16 @@ -// Copyright 2004-present Facebook. All Rights Reserved. -// @nolint +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @nolint + */ + +/* eslint-disable */ // These annotations are copy/pasted from the built-in Flow definitions for // Native Map. diff --git a/flow/Position.js b/flow/Position.js index 3ec6e087e..afe4a0227 100644 --- a/flow/Position.js +++ b/flow/Position.js @@ -1,14 +1,19 @@ /** - * Copyright (c) 2013-present, Facebook, Inc. + * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @nolint */ +/* eslint-disable */ + declare class Position { - coords: Coordinates, - timestamp: number, - mocked: boolean, + coords: Coordinates, + timestamp: number, + mocked: boolean, } diff --git a/flow/Promise.js b/flow/Promise.js index 2e6b16072..e59802e1b 100644 --- a/flow/Promise.js +++ b/flow/Promise.js @@ -1,12 +1,17 @@ /** - * Copyright (c) 2013-present, Facebook, Inc. + * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @nolint */ +/* eslint-disable */ + // These annotations are copy/pasted from the built-in Flow definitions for // Native Promises with some non-standard APIs added in declare class Promise<+R> { diff --git a/flow/Set.js b/flow/Set.js index 7ca7dcd2d..97557b499 100644 --- a/flow/Set.js +++ b/flow/Set.js @@ -1,5 +1,16 @@ -// Copyright 2004-present Facebook. All Rights Reserved. -// @nolint +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @nolint + */ + +/* eslint-disable */ // These annotations are copy/pasted from the built-in Flow definitions for // Native Set. diff --git a/flow/console.js b/flow/console.js index 06edf81e8..793bb6cdc 100644 --- a/flow/console.js +++ b/flow/console.js @@ -1,5 +1,5 @@ /** - * Copyright (c) 2013-present, Facebook, Inc. + * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the @@ -7,8 +7,11 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @flow + * @nolint */ +/* eslint-disable */ + declare module 'console' { declare function assert(value: any, ...message: any): void; declare function dir( diff --git a/flow/global.js b/flow/global.js index 775492726..7e13ef048 100644 --- a/flow/global.js +++ b/flow/global.js @@ -1,11 +1,15 @@ /** - * Copyright (c) 2013-present, Facebook, Inc. + * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @nolint */ + /* eslint-disable */ // Add missing flow definitions, can be removed when included in flow. diff --git a/flow/react.js b/flow/react.js index f54cd4250..c771d4e54 100644 --- a/flow/react.js +++ b/flow/react.js @@ -1,3 +1,17 @@ -// temporary patches for React.Component and React.Element +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @nolint + */ + +/* eslint-disable */ + +// Temporary patches for React.Component and React.Element. declare var ReactComponent: typeof React$Component; declare var ReactElement: typeof React$Element; diff --git a/jest/mockComponent.js b/jest/mockComponent.js index 20e832a4a..bb63a3e3e 100644 --- a/jest/mockComponent.js +++ b/jest/mockComponent.js @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +'use strict'; module.exports = moduleName => { const RealComponent = require.requireActual(moduleName); diff --git a/jestSupport/env.js b/jestSupport/env.js index ba63dfcb2..b5151ad6c 100644 --- a/jestSupport/env.js +++ b/jestSupport/env.js @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +'use strict'; throw new Error( 'React-Native and Jest should be tested together with the jest-react-native preset:' + diff --git a/packager/react-packager/src/Bundler/base64-vlq.js b/packager/react-packager/src/Bundler/base64-vlq.js index 4483a507a..fabbd804c 100644 --- a/packager/react-packager/src/Bundler/base64-vlq.js +++ b/packager/react-packager/src/Bundler/base64-vlq.js @@ -1,5 +1,4 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* +/** * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -33,9 +32,15 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @copyright + * @noflow */ -/*eslint no-bitwise:0,quotes:0,global-strict:0*/ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* eslint-disable no-bitwise, quotes, global-strict */ + +'use strict'; var charToIntMap = {}; var intToCharMap = {}; diff --git a/packager/react-packager/src/Resolver/polyfills/Array.es6.js b/packager/react-packager/src/Resolver/polyfills/Array.es6.js index ae3ac25ec..8f9088fab 100644 --- a/packager/react-packager/src/Resolver/polyfills/Array.es6.js +++ b/packager/react-packager/src/Resolver/polyfills/Array.es6.js @@ -1,10 +1,16 @@ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * * @provides Array.es6 * @polyfill */ -/*eslint-disable */ +/* eslint-disable */ /** * Creates an array from array like objects. diff --git a/packager/react-packager/src/Resolver/polyfills/Array.prototype.es6.js b/packager/react-packager/src/Resolver/polyfills/Array.prototype.es6.js index 7e2078f8e..767eec74e 100644 --- a/packager/react-packager/src/Resolver/polyfills/Array.prototype.es6.js +++ b/packager/react-packager/src/Resolver/polyfills/Array.prototype.es6.js @@ -1,5 +1,10 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @provides Array.prototype.es6 * @polyfill diff --git a/packager/react-packager/src/Resolver/polyfills/Number.es6.js b/packager/react-packager/src/Resolver/polyfills/Number.es6.js index abd59bbaa..6f077316d 100644 --- a/packager/react-packager/src/Resolver/polyfills/Number.es6.js +++ b/packager/react-packager/src/Resolver/polyfills/Number.es6.js @@ -1,5 +1,5 @@ /** - * Copyright (c) 2013-present, Facebook, Inc. + * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the @@ -10,6 +10,8 @@ * @polyfill */ +/* eslint-disable strict */ + if (Number.EPSILON === undefined) { Object.defineProperty(Number, 'EPSILON', { value: Math.pow(2, -52), diff --git a/packager/react-packager/src/Resolver/polyfills/Object.es7.js b/packager/react-packager/src/Resolver/polyfills/Object.es7.js index 597c49e7f..1516fc205 100644 --- a/packager/react-packager/src/Resolver/polyfills/Object.es7.js +++ b/packager/react-packager/src/Resolver/polyfills/Object.es7.js @@ -1,18 +1,23 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @provides Object.es7 * @polyfill */ (function() { + 'use strict'; const hasOwnProperty = Object.prototype.hasOwnProperty; /** * Returns an array of the given object's own enumerable entries. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries - * */ if (typeof Object.entries !== 'function') { Object.entries = function(object) { @@ -21,8 +26,8 @@ throw new TypeError('Object.entries called on non-object'); } - let entries = []; - for (let key in object) { + const entries = []; + for (const key in object) { if (hasOwnProperty.call(object, key)) { entries.push([key, object[key]]); } @@ -34,7 +39,6 @@ /** * Returns an array of the given object's own enumerable entries. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values - * */ if (typeof Object.values !== 'function') { Object.values = function(object) { @@ -43,8 +47,8 @@ throw new TypeError('Object.values called on non-object'); } - let values = []; - for (let key in object) { + const values = []; + for (const key in object) { if (hasOwnProperty.call(object, key)) { values.push(object[key]); } @@ -53,4 +57,4 @@ }; } -})(); \ No newline at end of file +})(); diff --git a/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js b/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js index 52bbc3147..6bfc421f4 100644 --- a/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js +++ b/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js @@ -1,10 +1,16 @@ /** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * * @provides String.prototype.es6 * @polyfill */ -/*eslint global-strict:0, no-extend-native:0, no-bitwise:0 */ -/*jshint bitwise:false*/ +/* eslint-disable strict, no-extend-native, no-bitwise */ /* * NOTE: We use (Number(x) || 0) to replace NaN values with zero. diff --git a/packager/react-packager/src/Resolver/polyfills/__tests__/Number.es6-test.js b/packager/react-packager/src/Resolver/polyfills/__tests__/Number.es6-test.js deleted file mode 100644 index c15d38b04..000000000 --- a/packager/react-packager/src/Resolver/polyfills/__tests__/Number.es6-test.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @emails oncall+jsinfra - */ - -jest.disableAutomock(); - -describe('Number (ES6)', () => { - describe('EPSILON', () => { - beforeEach(() => { - delete Number.EPSILON; - jest.resetModuleRegistry(); - require('../Number.es6'); - }); - it('is 2^(-52)', () => { - expect(Number.EPSILON).toBe(Math.pow(2, -52)); - }); - it('can be used to test equality', () => { - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON#Testing_equality - expect(Number.EPSILON).toBeGreaterThan(Math.abs(0.2 - 0.3 + 0.1)); - }); - }); - describe('MAX_SAFE_INTEGER', () => { - beforeEach(() => { - delete Number.MAX_SAFE_INTEGER; - jest.resetModuleRegistry(); - require('../Number.es6'); - }); - it('is 2^53 - 1', () => { - expect(Number.MAX_SAFE_INTEGER).toBe(Math.pow(2, 53) - 1); - }); - }); - describe('MIN_SAFE_INTEGER', () => { - beforeEach(() => { - delete Number.MIN_SAFE_INTEGER; - jest.resetModuleRegistry(); - require('../Number.es6'); - }); - it('is -(2^53 - 1)', () => { - expect(Number.MIN_SAFE_INTEGER).toBe(-(Math.pow(2, 53) - 1)); - }); - }); - describe('isNaN()', () => { - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN#Examples - beforeEach(() => { - delete Number.isNaN; - jest.resetModuleRegistry(); - require('../Number.es6'); - }); - it('returns true when fed something that is not-a-number', () => { - [ - NaN, - Number.NaN, - 0 / 0, - ].forEach(value => expect(Number.isNaN(value)).toBe(true)); - }); - it('returns false when fed something other than not-a-number', () => { - [ - 'NaN', - undefined, - {}, - 'blabla', - true, - null, - 37, - '37', - '37.37', - '', - ' ', - ].forEach(value => expect(Number.isNaN(value)).toBe(false)); - }); - }); -}); diff --git a/packager/react-packager/src/Resolver/polyfills/__tests__/Object.es7-test.js b/packager/react-packager/src/Resolver/polyfills/__tests__/Object.es7-test.js index 8d34e2bf2..016ab9e47 100644 --- a/packager/react-packager/src/Resolver/polyfills/__tests__/Object.es7-test.js +++ b/packager/react-packager/src/Resolver/polyfills/__tests__/Object.es7-test.js @@ -1,10 +1,17 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @emails oncall+jsinfra */ - /* eslint-disable fb-www/object-create-only-one-param */ +/* eslint-disable fb-www/object-create-only-one-param */ + +'use strict'; jest.disableAutomock(); @@ -35,19 +42,19 @@ describe('Object (ES7)', () => { }); it('should return enumerable entries', () => { - let foo = Object.defineProperties({}, { + const foo = Object.defineProperties({}, { x: {value: 10, enumerable: true}, y: {value: 20}, }); expect(Object.entries(foo)).toEqual([['x', 10]]); - let bar = {x: 10, y: 20}; + const bar = {x: 10, y: 20}; expect(Object.entries(bar)).toEqual([['x', 10], ['y', 20]]); }); it('should work with proto-less objects', () => { - let foo = Object.create(null, { + const foo = Object.create(null, { x: {value: 10, enumerable: true}, y: {value: 20}, }); @@ -56,7 +63,7 @@ describe('Object (ES7)', () => { }); it('should return only own entries', () => { - let foo = Object.create({z: 30}, { + const foo = Object.create({z: 30}, { x: {value: 10, enumerable: true}, y: {value: 20}, }); @@ -84,19 +91,19 @@ describe('Object (ES7)', () => { }); it('should return enumerable values', () => { - let foo = Object.defineProperties({}, { + const foo = Object.defineProperties({}, { x: {value: 10, enumerable: true}, y: {value: 20}, }); expect(Object.values(foo)).toEqual([10]); - let bar = {x: 10, y: 20}; + const bar = {x: 10, y: 20}; expect(Object.values(bar)).toEqual([10, 20]); }); it('should work with proto-less objects', () => { - let foo = Object.create(null, { + const foo = Object.create(null, { x: {value: 10, enumerable: true}, y: {value: 20}, }); @@ -105,7 +112,7 @@ describe('Object (ES7)', () => { }); it('should return only own values', () => { - let foo = Object.create({z: 30}, { + const foo = Object.create({z: 30}, { x: {value: 10, enumerable: true}, y: {value: 20}, }); @@ -117,4 +124,4 @@ describe('Object (ES7)', () => { expect(Object.values('ab')).toEqual(['a', 'b']); }); }); -}); \ No newline at end of file +}); diff --git a/packager/react-packager/src/Resolver/polyfills/babelHelpers.js b/packager/react-packager/src/Resolver/polyfills/babelHelpers.js index ff4422574..95b4ba8ad 100644 --- a/packager/react-packager/src/Resolver/polyfills/babelHelpers.js +++ b/packager/react-packager/src/Resolver/polyfills/babelHelpers.js @@ -5,6 +5,8 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. + * + * @polyfill */ /* eslint-disable */ diff --git a/packager/react-packager/src/Resolver/polyfills/console.js b/packager/react-packager/src/Resolver/polyfills/console.js index e8d82e3fb..9e5b7ebb9 100644 --- a/packager/react-packager/src/Resolver/polyfills/console.js +++ b/packager/react-packager/src/Resolver/polyfills/console.js @@ -6,9 +6,6 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * This pipes all of our console logging functions to native logging so that - * JavaScript errors in required modules show up in Xcode via NSLog. - * * @provides console * @polyfill * @nolint @@ -16,6 +13,10 @@ /* eslint-disable */ +/** + * This pipes all of our console logging functions to native logging so that + * JavaScript errors in required modules show up in Xcode via NSLog. + */ const inspect = (function() { // Copyright Joyent, Inc. and other Node contributors. // diff --git a/packager/react-packager/src/Resolver/polyfills/error-guard.js b/packager/react-packager/src/Resolver/polyfills/error-guard.js index cf3dc9560..feb3e7610 100644 --- a/packager/react-packager/src/Resolver/polyfills/error-guard.js +++ b/packager/react-packager/src/Resolver/polyfills/error-guard.js @@ -6,15 +6,11 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * The particular require runtime that we are using looks for a global - * `ErrorUtils` object and if it exists, then it requires modules with the - * error handler specified via ErrorUtils.setGlobalHandler by calling the - * require function with applyWithGuard. Since the require module is loaded - * before any of the modules, this ErrorUtils must be defined (and the handler - * set) globally before requiring anything. + * @polyfill */ -/* eslint strict:0 */ +/* eslint-disable strict */ + let _inGuard = 0; /** @@ -26,6 +22,14 @@ let _globalHandler = function onError(e) { throw e; }; +/** + * The particular require runtime that we are using looks for a global + * `ErrorUtils` object and if it exists, then it requires modules with the + * error handler specified via ErrorUtils.setGlobalHandler by calling the + * require function with applyWithGuard. Since the require module is loaded + * before any of the modules, this ErrorUtils must be defined (and the handler + * set) globally before requiring anything. + */ const ErrorUtils = { setGlobalHandler: function(fun) { _globalHandler = fun; diff --git a/packager/react-packager/src/Resolver/polyfills/polyfills.js b/packager/react-packager/src/Resolver/polyfills/polyfills.js index c625f9ef6..db6567140 100644 --- a/packager/react-packager/src/Resolver/polyfills/polyfills.js +++ b/packager/react-packager/src/Resolver/polyfills/polyfills.js @@ -6,17 +6,16 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * This pipes all of our console logging functions to native logging so that - * JavaScript errors in required modules show up in Xcode via NSLog. - * * @provides Object.es6 * @polyfill */ +/* eslint-disable strict */ + // WARNING: This is an optimized version that fails on hasOwnProperty checks // and non objects. It's not spec-compliant. It's a perf optimization. -// This is only needed for iOS 8 and current Android JSC. -/* eslint strict:0 */ +// This is only needed for iOS 8 and current Android JSC. + Object.assign = function(target, sources) { if (__DEV__) { if (target == null) { diff --git a/packager/react-packager/src/Resolver/polyfills/prelude.js b/packager/react-packager/src/Resolver/polyfills/prelude.js index 02386ae10..0451a75be 100644 --- a/packager/react-packager/src/Resolver/polyfills/prelude.js +++ b/packager/react-packager/src/Resolver/polyfills/prelude.js @@ -1,4 +1,16 @@ -/* eslint strict:0 */ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @polyfill + */ + +/* eslint-disable strict */ + global.__DEV__ = false; global.__BUNDLE_START_TIME__ = Date.now(); diff --git a/packager/react-packager/src/Resolver/polyfills/prelude_dev.js b/packager/react-packager/src/Resolver/polyfills/prelude_dev.js index 99b9de2c1..0f086fb9b 100644 --- a/packager/react-packager/src/Resolver/polyfills/prelude_dev.js +++ b/packager/react-packager/src/Resolver/polyfills/prelude_dev.js @@ -1,4 +1,16 @@ -/* eslint strict:0 */ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @polyfill + */ + +/* eslint-disable strict */ + global.__DEV__ = true; global.__BUNDLE_START_TIME__ = Date.now(); diff --git a/packager/react-packager/src/Resolver/polyfills/require.js b/packager/react-packager/src/Resolver/polyfills/require.js index fb2fe0e71..27f81a923 100644 --- a/packager/react-packager/src/Resolver/polyfills/require.js +++ b/packager/react-packager/src/Resolver/polyfills/require.js @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * + * @polyfill * @flow */ diff --git a/packager/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js b/packager/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js index e5ed0eb04..1c98b3370 100644 --- a/packager/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js +++ b/packager/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js @@ -1,4 +1,4 @@ - /** +/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * diff --git a/scripts/try-n-times.js b/scripts/try-n-times.js index 1310a6d36..66cfb71a1 100644 --- a/scripts/try-n-times.js +++ b/scripts/try-n-times.js @@ -1,10 +1,23 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +/* globals echo:false */ + +'use strict'; + /** * Try executing a function n times recursively. * Return 0 the first time it succeeds * Return code of the last failed commands if not more retries left * @funcToRetry - function that gets retried * @retriesLeft - number of retries to execute funcToRetry - * @onEveryError - func to execute if funcToRetry returns non 0 + * @onEveryError - func to execute if funcToRetry returns non 0 */ function tryExecNTimes(funcToRetry, retriesLeft, onEveryError) { const exitCode = funcToRetry(); diff --git a/website/core/AlgoliaDocSearch.js b/website/core/AlgoliaDocSearch.js index 69766e5aa..49cf90025 100644 --- a/website/core/AlgoliaDocSearch.js +++ b/website/core/AlgoliaDocSearch.js @@ -8,6 +8,9 @@ * * @providesModule AlgoliaDocSearch */ +'use strict'; + +var React = require('React'); var AlgoliaDocSearch = React.createClass({ render: function() { diff --git a/website/core/DocsSidebar.js b/website/core/DocsSidebar.js index 7b643aba9..1212af7ab 100644 --- a/website/core/DocsSidebar.js +++ b/website/core/DocsSidebar.js @@ -8,9 +8,10 @@ * * @providesModule DocsSidebar */ +'use strict'; -var React = require('React'); var Metadata = require('Metadata'); +var React = require('React'); var DocsSidebar = React.createClass({ getCategories: function() { diff --git a/website/core/Footer.js b/website/core/Footer.js index 516b178d6..7220e7ea3 100644 --- a/website/core/Footer.js +++ b/website/core/Footer.js @@ -8,6 +8,7 @@ * * @providesModule Footer */ +'use strict'; var React = require('React'); diff --git a/website/core/H2.js b/website/core/H2.js index 7bf4e9278..893a5508b 100644 --- a/website/core/H2.js +++ b/website/core/H2.js @@ -8,9 +8,10 @@ * * @providesModule H2 */ +'use strict'; -var React = require('React'); var Header = require('Header'); +var React = require('React'); var H2 = React.createClass({ render: function() { diff --git a/website/core/Header.js b/website/core/Header.js index c83d7334b..082deeac9 100644 --- a/website/core/Header.js +++ b/website/core/Header.js @@ -8,8 +8,10 @@ * * @providesModule Header */ +'use strict'; var React = require('React'); + var slugify = require('slugify'); var Header = React.createClass({ @@ -23,7 +25,7 @@ var Header = React.createClass({ var base = this.context.permalink || ''; return ( - + {this.props.children} {' '}# diff --git a/website/core/HeaderLinks.js b/website/core/HeaderLinks.js index 2826d1d3b..27ab854e1 100644 --- a/website/core/HeaderLinks.js +++ b/website/core/HeaderLinks.js @@ -8,9 +8,10 @@ * * @providesModule HeaderLinks */ +'use strict'; -var React = require('React'); var AlgoliaDocSearch = require('AlgoliaDocSearch'); +var React = require('React'); var HeaderLinks = React.createClass({ linksInternal: [ diff --git a/website/core/HeaderWithGithub.js b/website/core/HeaderWithGithub.js index c8e87770c..af488f6d4 100644 --- a/website/core/HeaderWithGithub.js +++ b/website/core/HeaderWithGithub.js @@ -8,6 +8,7 @@ * * @providesModule HeaderWithGithub */ +'use strict'; var H = require('Header'); var React = require('React'); diff --git a/website/core/Hero.js b/website/core/Hero.js index 69677f68f..ba2b1ba32 100644 --- a/website/core/Hero.js +++ b/website/core/Hero.js @@ -8,6 +8,7 @@ * * @providesModule Hero */ +'use strict'; var React = require('React'); diff --git a/website/core/Marked.js b/website/core/Marked.js index d123b874b..f727315cc 100644 --- a/website/core/Marked.js +++ b/website/core/Marked.js @@ -1,15 +1,20 @@ /** * marked - a markdown parser - * Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed) * https://github.com/chjj/marked * + * @copyright 2011-2013 Christopher Jeffrey. MIT License. * @providesModule Marked + * @noflow */ -var React = require('React'); -var Prism = require('Prism'); -var WebPlayer = require('WebPlayer'); +/* eslint-disable */ + +'use strict'; + var Header = require('Header'); +var Prism = require('Prism'); +var React = require('React'); +var WebPlayer = require('WebPlayer'); /** * Block-Level Grammar diff --git a/website/core/Prism.js b/website/core/Prism.js index 50b0b3c41..88cf6f1a9 100644 --- a/website/core/Prism.js +++ b/website/core/Prism.js @@ -1,11 +1,15 @@ /** * Prism: Lightweight, robust, elegant syntax highlighting - * MIT license http://www.opensource.org/licenses/mit-license.php/ - * @author Lea Verou http://lea.verou.me * + * @copyright Lea Verou . MIT License. * @providesModule Prism + * @noflow */ +/* eslint-disable */ + +'use strict'; + var React = require('React'); var _ = { diff --git a/website/core/Site.js b/website/core/Site.js index 4186bc114..93670b3f7 100644 --- a/website/core/Site.js +++ b/website/core/Site.js @@ -8,10 +8,11 @@ * * @providesModule Site */ +'use strict'; -var React = require('React'); var HeaderLinks = require('HeaderLinks'); var Metadata = require('Metadata'); +var React = require('React'); var Site = React.createClass({ render: function() { @@ -24,60 +25,60 @@ var Site = React.createClass({ var title = this.props.title ? this.props.title : 'React Native | A framework for building native apps using React'; var metaTags = [ - { charSet: "utf-8" }, + { charSet: 'utf-8' }, { - httpEquiv: "X-UA-Compatible", - content: "IE=edge,chrome=1", + httpEquiv: 'X-UA-Compatible', + content: 'IE=edge,chrome=1', }, { - name: "viewport", - content: "width=device-width", + name: 'viewport', + content: 'width=device-width', }, // Facebook - { property: "fb:app_id", content: "1677033832619985", }, - { property: "fb:admins", content: "121800083", }, + { property: 'fb:app_id', content: '1677033832619985', }, + { property: 'fb:admins', content: '121800083', }, // Open Graph { - property: "og:site_name", - content: "React Native", + property: 'og:site_name', + content: 'React Native', }, { - property: "og:title", + property: 'og:title', content: title, }, { - property: "og:url", - content: "https://facebook.github.io/react-native/" + (this.props.path ? this.props.path : "index.html"), + property: 'og:url', + content: 'https://facebook.github.io/react-native/' + (this.props.path ? this.props.path : 'index.html'), }, { - property: "og:image", - content: this.props.image ? this.props.image : "https://facebook.github.io/react-native/img/opengraph.png", + property: 'og:image', + content: this.props.image ? this.props.image : 'https://facebook.github.io/react-native/img/opengraph.png', }, { - property: "og:description", - content: this.props.description ? this.props.description : "A framework for building native apps using React", + property: 'og:description', + content: this.props.description ? this.props.description : 'A framework for building native apps using React', }, // Twitter Cards { - name: "twitter:site", - content: "@reactnative", + name: 'twitter:site', + content: '@reactnative', }, { - name: "twitter:card", - content: "summary_large_image", + name: 'twitter:card', + content: 'summary_large_image', }, ]; var typeTags = [{ - property: "og:type", - content: "website", + property: 'og:type', + content: 'website', }]; if (this.props.author) { typeTags = [{ - property: "og:type", - content: "article", + property: 'og:type', + content: 'article', }, { - property: "article:author", + property: 'article:author', content: this.props.author, }]; } @@ -85,8 +86,8 @@ var Site = React.createClass({ if (this.props.authorTwitter) { metaTags.push({ - name: "twitter:creator", - content: "@" + this.props.authorTwitter, + name: 'twitter:creator', + content: '@' + this.props.authorTwitter, }); } @@ -109,12 +110,12 @@ var Site = React.createClass({ - + - + -