diff --git a/.eslintignore b/.eslintignore index 15261d31c47cee..d0528c4a5361c1 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,5 @@ -**/node_modules/**/.*js +# node_modules ignored by default + **/staticBundle.js **/main.js +Libraries/vendor/**/* diff --git a/Libraries/ART/ARTSerializablePath.js b/Libraries/ART/ARTSerializablePath.js index 2df8ff6bb83bcd..4e8b3c2271a6c7 100644 --- a/Libraries/ART/ARTSerializablePath.js +++ b/Libraries/ART/ARTSerializablePath.js @@ -8,8 +8,7 @@ * * @providesModule ARTSerializablePath */ - -"use strict"; +'use strict'; // TODO: Move this into an ART mode called "serialized" or something diff --git a/Libraries/ART/ReactNativeART.js b/Libraries/ART/ReactNativeART.js index b2533f2a861437..3b5801d00cc868 100644 --- a/Libraries/ART/ReactNativeART.js +++ b/Libraries/ART/ReactNativeART.js @@ -8,8 +8,7 @@ * * @providesModule ReactNativeART */ - -"use strict"; +'use strict'; var Color = require('art/core/color'); var Path = require('ARTSerializablePath'); diff --git a/Libraries/CustomComponents/Navigator/Navigator.js b/Libraries/CustomComponents/Navigator/Navigator.js index b8c019e32e458d..063012c14a78b7 100644 --- a/Libraries/CustomComponents/Navigator/Navigator.js +++ b/Libraries/CustomComponents/Navigator/Navigator.js @@ -24,6 +24,7 @@ * * @providesModule Navigator */ + /* eslint-disable no-extra-boolean-cast*/ 'use strict'; var AnimationsDebugModule = require('NativeModules').AnimationsDebugModule; @@ -48,8 +49,6 @@ var clamp = require('clamp'); var flattenStyle = require('flattenStyle'); var getNavigatorContext = require('getNavigatorContext'); var invariant = require('invariant'); -var keyMirror = require('keyMirror'); -var merge = require('merge'); var rebound = require('rebound'); var PropTypes = React.PropTypes; @@ -745,7 +744,6 @@ var Navigator = React.createClass({ }, _handleMoveShouldSetPanResponder: function(e, gestureState) { - var currentRoute = this.state.routeStack[this.state.presentedIndex]; var sceneConfig = this.state.sceneConfigStack[this.state.presentedIndex]; this._expectingGestureGrant = this._matchGestureAction(this._eligibleGestures, sceneConfig.gestures, gestureState); return !! this._expectingGestureGrant; diff --git a/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js b/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js index ed295346d048b5..48be13ea172c2d 100644 --- a/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js +++ b/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js @@ -213,7 +213,7 @@ var FromTheLeft = { translateX: { from: -SCREEN_WIDTH, to: 0, - min: 0, + min: 0, max: 1, type: 'linear', extrapolate: true, diff --git a/Libraries/Fetch/fetch.js b/Libraries/Fetch/fetch.js index 829f7c4256d63a..b5e8b151c8263d 100644 --- a/Libraries/Fetch/fetch.js +++ b/Libraries/Fetch/fetch.js @@ -12,6 +12,7 @@ * @providesModule fetch * @nolint */ +/* eslint-disable */ 'use strict'; var self = {}; diff --git a/Libraries/Geolocation/Geolocation.js b/Libraries/Geolocation/Geolocation.js index fae309aef5fe68..80dbfa19b7e556 100644 --- a/Libraries/Geolocation/Geolocation.js +++ b/Libraries/Geolocation/Geolocation.js @@ -120,6 +120,6 @@ var Geolocation = { subscriptions = []; } } -} +}; module.exports = Geolocation; diff --git a/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js b/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js index 79a5e818cf3647..311e573fc02eb3 100644 --- a/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js +++ b/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js @@ -18,6 +18,7 @@ * and wrapping resulting file into `wrapper` function. * */ +/*eslint-disable */ var scope = {}; wrapper.call(scope); diff --git a/Libraries/JavaScriptAppEngine/Initialization/source-map-url.js b/Libraries/JavaScriptAppEngine/Initialization/source-map-url.js index 8602288eefd0d6..98610724af2c0c 100644 --- a/Libraries/JavaScriptAppEngine/Initialization/source-map-url.js +++ b/Libraries/JavaScriptAppEngine/Initialization/source-map-url.js @@ -11,6 +11,7 @@ * * @nolint */ +/* eslint-disable */ (function() { var define = null; // Hack to make it work with our packager diff --git a/Libraries/PushNotificationIOS/PushNotificationIOS.js b/Libraries/PushNotificationIOS/PushNotificationIOS.js index 9432fbef3f65f8..4d03c6641535f7 100644 --- a/Libraries/PushNotificationIOS/PushNotificationIOS.js +++ b/Libraries/PushNotificationIOS/PushNotificationIOS.js @@ -11,7 +11,6 @@ */ 'use strict'; -var NativeModules = require('NativeModules'); var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter'); var RCTPushNotificationManager = require('NativeModules').PushNotificationManager; var invariant = require('invariant'); diff --git a/Libraries/RKBackendNode/queryLayoutByID.js b/Libraries/RKBackendNode/queryLayoutByID.js index d9b1ed8cceab96..d6492e6da48740 100644 --- a/Libraries/RKBackendNode/queryLayoutByID.js +++ b/Libraries/RKBackendNode/queryLayoutByID.js @@ -58,4 +58,3 @@ var queryLayoutByID = function( }; module.exports = queryLayoutByID; - diff --git a/Libraries/ReactIOS/IOSNativeBridgeEventPlugin.js b/Libraries/ReactIOS/IOSNativeBridgeEventPlugin.js index b585db5a76f810..55b22a959934e6 100644 --- a/Libraries/ReactIOS/IOSNativeBridgeEventPlugin.js +++ b/Libraries/ReactIOS/IOSNativeBridgeEventPlugin.js @@ -9,8 +9,7 @@ * @providesModule IOSNativeBridgeEventPlugin * @flow */ - -"use strict"; +'use strict'; var EventPropagators = require('EventPropagators'); var NativeModules = require('NativeModules'); @@ -33,7 +32,7 @@ for (var bubblingTypeName in customBubblingEventTypes) { for (var directTypeName in customDirectEventTypes) { warning( !customBubblingEventTypes[directTypeName], - "Event cannot be both direct and bubbling: %s", + 'Event cannot be both direct and bubbling: %s', directTypeName ); allTypesByEventName[directTypeName] = customDirectEventTypes[directTypeName]; @@ -76,4 +75,3 @@ var IOSNativeBridgeEventPlugin = { }; module.exports = IOSNativeBridgeEventPlugin; - diff --git a/Libraries/ReactNative/React.js b/Libraries/ReactNative/React.js index 1eeeb32c37b659..9cd4464f2860c9 100644 --- a/Libraries/ReactNative/React.js +++ b/Libraries/ReactNative/React.js @@ -9,7 +9,6 @@ * @providesModule React * @flow */ - -"use strict"; +'use strict'; module.exports = require('ReactNative'); diff --git a/Libraries/ReactNative/ReactNative.js b/Libraries/ReactNative/ReactNative.js index abe31a3613f49d..970944baa5ced3 100644 --- a/Libraries/ReactNative/ReactNative.js +++ b/Libraries/ReactNative/ReactNative.js @@ -9,7 +9,7 @@ * @providesModule ReactNative * @flow */ -"use strict"; +'use strict'; var ReactChildren = require('ReactChildren'); var ReactClass = require('ReactClass'); diff --git a/Libraries/ReactNative/ReactNativeBaseComponent.js b/Libraries/ReactNative/ReactNativeBaseComponent.js index dcc31a2b3f3fc3..95af2902353007 100644 --- a/Libraries/ReactNative/ReactNativeBaseComponent.js +++ b/Libraries/ReactNative/ReactNativeBaseComponent.js @@ -63,7 +63,8 @@ var cachedIndexArray = function(size) { for (var i = 0; i < size; i++) { arr[i] = i; } - return cachedIndexArray._cache[size] = arr; + cachedIndexArray._cache[size] = arr; + return arr; } else { return cachedResult; } @@ -228,7 +229,7 @@ ReactNativeBaseComponent.Mixin = { */ _reconcileListenersUponUpdate: function(prevProps, nextProps) { for (var key in nextProps) { - if (registrationNames[key] && (nextProps[key] != prevProps[key])) { + if (registrationNames[key] && (nextProps[key] !== prevProps[key])) { putListener(this._rootNodeID, key, nextProps[key]); } } diff --git a/Libraries/ReactNative/ReactNativeDOMIDOperations.js b/Libraries/ReactNative/ReactNativeDOMIDOperations.js index 3b47d4d8f8ca3b..af17f9e0742e4a 100644 --- a/Libraries/ReactNative/ReactNativeDOMIDOperations.js +++ b/Libraries/ReactNative/ReactNativeDOMIDOperations.js @@ -9,8 +9,7 @@ * @providesModule ReactNativeDOMIDOperations * @flow */ - -"use strict"; +'use strict'; var ReactNativeTagHandles = require('ReactNativeTagHandles'); var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes'); diff --git a/Libraries/ReactNative/ReactNativeDefaultInjection.js b/Libraries/ReactNative/ReactNativeDefaultInjection.js index 3b15a8cc9f0353..ce040c7791cec6 100644 --- a/Libraries/ReactNative/ReactNativeDefaultInjection.js +++ b/Libraries/ReactNative/ReactNativeDefaultInjection.js @@ -9,8 +9,7 @@ * @providesModule ReactNativeDefaultInjection * @flow */ - -"use strict"; +'use strict'; /** * Make sure `setTimeout`/`setInterval` are patched correctly. @@ -21,7 +20,6 @@ var EventPluginUtils = require('EventPluginUtils'); var IOSDefaultEventPluginOrder = require('IOSDefaultEventPluginOrder'); var IOSNativeBridgeEventPlugin = require('IOSNativeBridgeEventPlugin'); var NodeHandle = require('NodeHandle'); -var ReactClass = require('ReactClass'); var ReactComponentEnvironment = require('ReactComponentEnvironment'); var ReactDefaultBatchingStrategy = require('ReactDefaultBatchingStrategy'); var ReactEmptyComponent = require('ReactEmptyComponent'); diff --git a/Libraries/ReactNative/ReactNativeEventEmitter.js b/Libraries/ReactNative/ReactNativeEventEmitter.js index 9bd344e792dceb..b8f773100d3059 100644 --- a/Libraries/ReactNative/ReactNativeEventEmitter.js +++ b/Libraries/ReactNative/ReactNativeEventEmitter.js @@ -9,8 +9,7 @@ * @providesModule ReactNativeEventEmitter * @flow */ - -"use strict"; +'use strict'; var EventPluginHub = require('EventPluginHub'); var ReactEventEmitterMixin = require('ReactEventEmitterMixin'); diff --git a/Libraries/ReactNative/ReactNativeMount.js b/Libraries/ReactNative/ReactNativeMount.js index 004a3fbda227fc..82efa57a6fd560 100644 --- a/Libraries/ReactNative/ReactNativeMount.js +++ b/Libraries/ReactNative/ReactNativeMount.js @@ -21,7 +21,6 @@ var ReactUpdates = require('ReactUpdates'); var emptyObject = require('emptyObject'); var instantiateReactComponent = require('instantiateReactComponent'); -var invariant = require('invariant'); var shouldUpdateReactComponent = require('shouldUpdateReactComponent'); function instanceNumberToChildRootID(rootNodeID, instanceNumber) { diff --git a/Libraries/ReactNative/ReactNativeReconcileTransaction.js b/Libraries/ReactNative/ReactNativeReconcileTransaction.js index ac9ed657b5069f..309630e3cc3658 100644 --- a/Libraries/ReactNative/ReactNativeReconcileTransaction.js +++ b/Libraries/ReactNative/ReactNativeReconcileTransaction.js @@ -9,8 +9,7 @@ * @providesModule ReactNativeReconcileTransaction * @flow */ - -"use strict"; +'use strict'; var CallbackQueue = require('CallbackQueue'); var PooledClass = require('PooledClass'); diff --git a/Libraries/ReactNative/createReactNativeComponentClass.js b/Libraries/ReactNative/createReactNativeComponentClass.js index 3a63089b6628e5..c821cfa758ffc1 100644 --- a/Libraries/ReactNative/createReactNativeComponentClass.js +++ b/Libraries/ReactNative/createReactNativeComponentClass.js @@ -10,9 +10,8 @@ * @flow */ -"use strict"; +'use strict'; -var ReactElement = require('ReactElement'); var ReactNativeBaseComponent = require('ReactNativeBaseComponent'); // See also ReactNativeBaseComponent diff --git a/Libraries/Settings/Settings.ios.js b/Libraries/Settings/Settings.ios.js index c1099df93cbb4f..89388be57b7583 100644 --- a/Libraries/Settings/Settings.ios.js +++ b/Libraries/Settings/Settings.ios.js @@ -31,7 +31,7 @@ var Settings = { }, watchKeys(keys: string | Array, callback: Function): number { - if (typeof keys == 'string') { + if (typeof keys === 'string') { keys = [keys]; } @@ -41,7 +41,7 @@ var Settings = { ); var sid = subscriptions.length; - subscriptions.push({keys: keys, callback: callback}) + subscriptions.push({keys: keys, callback: callback}); return sid; }, @@ -52,15 +52,14 @@ var Settings = { }, _sendObservations(body: Object) { - var _this = this; Object.keys(body).forEach((key) => { var newValue = body[key]; - var didChange = _this._settings[key] !== newValue; - _this._settings[key] = newValue; + var didChange = this._settings[key] !== newValue; + this._settings[key] = newValue; if (didChange) { subscriptions.forEach((sub) => { - if (~sub.keys.indexOf(key) && sub.callback) { + if (sub.keys.indexOf(key) !== -1 && sub.callback) { sub.callback(); } }); diff --git a/Libraries/StyleSheet/EdgeInsetsPropType.js b/Libraries/StyleSheet/EdgeInsetsPropType.js index 3089fe7bd08598..1850ae6119a61a 100644 --- a/Libraries/StyleSheet/EdgeInsetsPropType.js +++ b/Libraries/StyleSheet/EdgeInsetsPropType.js @@ -9,12 +9,11 @@ * @providesModule EdgeInsetsPropType * @flow */ -'use strict' +'use strict'; var PropTypes = require('ReactPropTypes'); var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker'); -var insetsDiffer = require('insetsDiffer'); var EdgeInsetsPropType = createStrictShapeTypeChecker({ top: PropTypes.number, diff --git a/Libraries/StyleSheet/PointPropType.js b/Libraries/StyleSheet/PointPropType.js index 1e8fe95e91646a..606482dd5d7e4d 100644 --- a/Libraries/StyleSheet/PointPropType.js +++ b/Libraries/StyleSheet/PointPropType.js @@ -9,12 +9,11 @@ * @providesModule PointPropType * @flow */ -'use strict' +'use strict'; var PropTypes = require('ReactPropTypes'); var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker'); -var pointsDiffer = require('pointsDiffer'); var PointPropType = createStrictShapeTypeChecker({ x: PropTypes.number, diff --git a/Libraries/Utilities/ErrorUtils.js b/Libraries/Utilities/ErrorUtils.js index 666d536be32232..b66b085465f86a 100644 --- a/Libraries/Utilities/ErrorUtils.js +++ b/Libraries/Utilities/ErrorUtils.js @@ -8,6 +8,7 @@ * * @providesModule ErrorUtils */ +/* eslint-disable consistent-this, global-strict */ var GLOBAL = this; diff --git a/Libraries/Utilities/MatrixMath.js b/Libraries/Utilities/MatrixMath.js index a7f08260492b98..0550eb1876dd36 100755 --- a/Libraries/Utilities/MatrixMath.js +++ b/Libraries/Utilities/MatrixMath.js @@ -3,6 +3,7 @@ * * @providesModule MatrixMath */ +/* eslint-disable space-infix-ops */ 'use strict'; var invariant = require('invariant'); diff --git a/Libraries/Utilities/RCTLog.js b/Libraries/Utilities/RCTLog.js index e5a8db49c4bd5f..b76a91a58386e3 100644 --- a/Libraries/Utilities/RCTLog.js +++ b/Libraries/Utilities/RCTLog.js @@ -9,7 +9,6 @@ * @providesModule RCTLog * @flow */ - /* globals nativeLoggingHook */ 'use strict'; var invariant = require('invariant'); diff --git a/Libraries/Utilities/RCTRenderingPerf.js b/Libraries/Utilities/RCTRenderingPerf.js index c6466aa641afc3..126c8a0328528d 100644 --- a/Libraries/Utilities/RCTRenderingPerf.js +++ b/Libraries/Utilities/RCTRenderingPerf.js @@ -12,7 +12,6 @@ 'use strict'; var ReactDefaultPerf = require('ReactDefaultPerf'); -var ReactPerf = require('ReactPerf'); var invariant = require('invariant'); diff --git a/Libraries/Utilities/__mocks__/ErrorUtils.js b/Libraries/Utilities/__mocks__/ErrorUtils.js index 99db791774a441..59fbbafbc9041c 100644 --- a/Libraries/Utilities/__mocks__/ErrorUtils.js +++ b/Libraries/Utilities/__mocks__/ErrorUtils.js @@ -6,7 +6,7 @@ function execute(fun, context, args) { return fun.apply(context, args); -}; +} function reportError(error) { throw error; diff --git a/Libraries/Utilities/buildStyleInterpolator.js b/Libraries/Utilities/buildStyleInterpolator.js index 67f07cb415ad39..5e6515cc02a42f 100644 --- a/Libraries/Utilities/buildStyleInterpolator.js +++ b/Libraries/Utilities/buildStyleInterpolator.js @@ -7,6 +7,7 @@ /** * Cannot "use strict" because we must use eval in this file. */ +/* eslint-disable global-strict */ var keyOf = require('keyOf'); @@ -372,7 +373,7 @@ var MatrixOpsInitial = { var setNextValAndDetectChange = function(name, tmpVarName) { return ( ' if (!didChange) {\n' + - ' var prevVal = result.' + name +';\n' + + ' var prevVal = result.' + name + ';\n' + ' result.' + name + ' = ' + tmpVarName + ';\n' + ' didChange = didChange || (' + tmpVarName + ' !== prevVal);\n' + ' } else {\n' + diff --git a/Libraries/Utilities/truncate.js b/Libraries/Utilities/truncate.js index 1d318e8353d6b1..a15da571bfdeed 100644 --- a/Libraries/Utilities/truncate.js +++ b/Libraries/Utilities/truncate.js @@ -45,4 +45,3 @@ var truncate = function( }; module.exports = truncate; - diff --git a/package.json b/package.json index d524c1785067b2..6c4fa493dcaf39 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ ], "scripts": { "test": "jest", - "lint": "node linter.js Examples/ Libraries/Components", + "lint": "node linter.js Examples/ Libraries/", "start": "./packager/packager.sh" }, "bin": {