@samitouri / QOS-React / commits / 744548ad14

Fix lint for moved ReactNative

Sebastian Markbage committed Apr 19, 2016 at 00:11 UTC 744548ad143b7350e7e1d7d39e72bf2f4108fee6
20 files changed +58 -61
src/renderers/native/ReactIOS/IOSDefaultEventPluginOrder.js
+1 -1
@@ -13,7 +13,7 @@
13
14 var IOSDefaultEventPluginOrder = [
15 'ResponderEventPlugin',
16 - 'IOSNativeBridgeEventPlugin'
16 + 'IOSNativeBridgeEventPlugin',
17 ];
18
19 module.exports = IOSDefaultEventPluginOrder;
src/renderers/native/ReactIOS/IOSNativeBridgeEventPlugin.js
+1 -1
@@ -65,7 +65,7 @@ var IOSNativeBridgeEventPlugin = {
65 return null;
66 }
67 return event;
68 - }
68 + },
69 };
70
71 module.exports = IOSNativeBridgeEventPlugin;
src/renderers/native/ReactIOS/NativeMethodsMixin.js
+4 -4
@@ -169,7 +169,7 @@ var NativeMethodsMixin = {
169 */
170 blur: function() {
171 TextInputState.blurTextInput(findNodeHandle(this));
172 - }
172 + },
173 };
174
175 function throwOnStylesProp(component, props) {
@@ -195,10 +195,10 @@ if (__DEV__) {
195 !NativeMethodsMixin_DEV.componentWillReceiveProps,
196 'Do not override existing functions.'
197 );
198 - NativeMethodsMixin_DEV.componentWillMount = function () {
198 + NativeMethodsMixin_DEV.componentWillMount = function() {
199 throwOnStylesProp(this, this.props);
200 };
201 - NativeMethodsMixin_DEV.componentWillReceiveProps = function (newProps) {
201 + NativeMethodsMixin_DEV.componentWillReceiveProps = function(newProps) {
202 throwOnStylesProp(this, newProps);
203 };
204 }
@@ -210,7 +210,7 @@ if (__DEV__) {
210 var mountSafeCallback = function(context: ReactComponent, callback: ?Function): any {
211 return function() {
212 if (!callback || (context.isMounted && !context.isMounted())) {
213 - return;
213 + return undefined;
214 }
215 return callback.apply(context, arguments);
216 };
src/renderers/native/ReactNative/ReactNative.js
-12
@@ -16,9 +16,7 @@
16 var ReactNativeComponentTree = require('ReactNativeComponentTree');
17 var ReactNativeDefaultInjection = require('ReactNativeDefaultInjection');
18
19 -var ReactCurrentOwner = require('ReactCurrentOwner');
19 var ReactElement = require('ReactElement');
21 -var ReactInstanceHandles = require('ReactInstanceHandles');
20 var ReactNativeMount = require('ReactNativeMount');
21 var ReactUpdates = require('ReactUpdates');
22
@@ -45,16 +43,6 @@ var ReactNative = {
43 /* eslint-enable camelcase */
44
45 unmountComponentAtNodeAndRemoveContainer: ReactNativeMount.unmountComponentAtNodeAndRemoveContainer,
48 -
49 - // Deprecations (remove for 0.13)
50 - renderComponent: function(
51 - element: ReactElement,
52 - mountInto: number,
53 - callback?: ?(() => void)
54 - ): ?ReactComponent {
55 - warning('Use React.render instead of React.renderComponent');
56 - return ReactNative.render(element, mountInto, callback);
57 - },
46 };
47
48 // Inject the runtime into a devtools global hook regardless of browser.
src/renderers/native/ReactNative/ReactNativeAttributePayload.js
+5 -5
@@ -408,9 +408,9 @@ function diffProperties(
408 defaultDiffer(prevProp, nextProp)
409 );
410 if (shouldUpdate) {
411 - var nextValue = typeof attributeConfig.process === 'function' ?
412 - attributeConfig.process(nextProp) :
413 - nextProp;
411 + nextValue = typeof attributeConfig.process === 'function' ?
412 + attributeConfig.process(nextProp) :
413 + nextProp;
414 (updatePayload || (updatePayload = {}))[altKey] = nextValue;
415 }
416 } else {
@@ -437,7 +437,7 @@ function diffProperties(
437 // Also iterate through all the previous props to catch any that have been
438 // removed and make sure native gets the signal so it can reset them to the
439 // default.
440 - for (var propKey in prevProps) {
440 + for (propKey in prevProps) {
441 if (nextProps[propKey] !== undefined) {
442 continue; // we've already covered this key in the previous pass
443 }
@@ -539,7 +539,7 @@ var ReactNativeAttributePayload = {
539 nextProps,
540 validAttributes
541 );
542 - }
542 + },
543
544 };
545
src/renderers/native/ReactNative/ReactNativeBaseComponent.js
+1 -3
@@ -20,8 +20,6 @@ var ReactMultiChild = require('ReactMultiChild');
20 var UIManager = require('UIManager');
21
22 var deepFreezeAndThrowOnMutationInDev = require('deepFreezeAndThrowOnMutationInDev');
23 -var invariant = require('invariant');
24 -var warning = require('warning');
23
24 var registrationNames = ReactNativeEventEmitter.registrationNames;
25 var putListener = ReactNativeEventEmitter.putListener;
@@ -215,7 +213,7 @@ ReactNativeBaseComponent.Mixin = {
213 context
214 );
215 return tag;
218 - }
216 + },
217 };
218
219 /**
src/renderers/native/ReactNative/ReactNativeContainerInfo.js
+1 -1
@@ -13,7 +13,7 @@
13
14 function ReactNativeContainerInfo(tag) {
15 var info = {
16 - _tag: tag
16 + _tag: tag,
17 };
18 return info;
19 }
src/renderers/native/ReactNative/ReactNativeDOMIDOperations.js
-1
@@ -12,7 +12,6 @@
12 'use strict';
13
14 var ReactNativeComponentTree = require('ReactNativeComponentTree');
15 -var ReactNativeTagHandles = require('ReactNativeTagHandles');
15 var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');
16 var ReactPerf = require('ReactPerf');
17 var UIManager = require('UIManager');
src/renderers/native/ReactNative/ReactNativeDefaultInjection.js
+2 -2
@@ -66,7 +66,7 @@ function inject() {
66 */
67 EventPluginHub.injection.injectEventPluginsByName({
68 'ResponderEventPlugin': ResponderEventPlugin,
69 - 'IOSNativeBridgeEventPlugin': IOSNativeBridgeEventPlugin
69 + 'IOSNativeBridgeEventPlugin': IOSNativeBridgeEventPlugin,
70 });
71
72 ReactUpdates.injection.injectReconcileTransaction(
@@ -87,7 +87,7 @@ function inject() {
87 return new ReactSimpleEmptyComponent(
88 ReactElement.createElement(View, {
89 collapsable: true,
90 - style: { position: 'absolute' }
90 + style: { position: 'absolute' },
91 }),
92 instantiate
93 );
src/renderers/native/ReactNative/ReactNativeEventEmitter.js
+1 -1
@@ -209,7 +209,7 @@ var ReactNativeEventEmitter = merge(ReactEventEmitterMixin, {
209 nativeEvent
210 );
211 }
212 - }
212 + },
213 });
214
215 module.exports = ReactNativeEventEmitter;
src/renderers/native/ReactNative/ReactNativeGlobalInteractionHandler.js
+1 -1
@@ -27,7 +27,7 @@ var ReactNativeGlobalInteractionHandler = {
27 } else if (!interactionHandle) {
28 interactionHandle = InteractionManager.createInteractionHandle();
29 }
30 - }
30 + },
31 };
32
33 module.exports = ReactNativeGlobalInteractionHandler;
src/renderers/native/ReactNative/ReactNativeGlobalResponderHandler.js
+1 -2
@@ -10,7 +10,6 @@
10 */
11 'use strict';
12
13 -var ReactNativeTagHandles = require('ReactNativeTagHandles');
13 var UIManager = require('UIManager');
14
15 var ReactNativeGlobalResponderHandler = {
@@ -23,7 +22,7 @@ var ReactNativeGlobalResponderHandler = {
22 } else {
23 UIManager.clearJSResponder();
24 }
26 - }
25 + },
26 };
27
28 module.exports = ReactNativeGlobalResponderHandler;
src/renderers/native/ReactNative/ReactNativeMount.js
+2 -2
@@ -130,7 +130,7 @@ var ReactNativeMount = {
130
131 if (!ReactNativeTagHandles.reactTagIsNativeTopRootID(containerTag)) {
132 console.error('You cannot render into anything but a top root');
133 - return;
133 + return null;
134 }
135
136 ReactNativeTagHandles.assertRootTag(containerTag);
@@ -225,7 +225,7 @@ var ReactNativeMount = {
225 // Call back into native to remove all of the subviews from this container
226 ReactReconciler.unmountComponent(instance);
227 UIManager.removeSubviewsFromContainerWithID(containerID);
228 - }
228 + },
229
230 };
231
src/renderers/native/ReactNative/ReactNativeReconcileTransaction.js
+2 -2
@@ -32,7 +32,7 @@ var ON_DOM_READY_QUEUEING = {
32 */
33 close: function() {
34 this.reactMountReady.notifyAll();
35 - }
35 + },
36 };
37
38 /**
@@ -88,7 +88,7 @@ var Mixin = {
88 destructor: function() {
89 CallbackQueue.release(this.reactMountReady);
90 this.reactMountReady = null;
91 - }
91 + },
92 };
93
94 Object.assign(
src/renderers/native/ReactNative/ReactNativeTagHandles.js
+2 -4
@@ -12,7 +12,6 @@
12 'use strict';
13
14 var invariant = require('invariant');
15 -var warning = require('warning');
15
16 /**
17 * Keeps track of allocating and associating native "tags" which are numeric,
@@ -28,7 +27,6 @@ var warning = require('warning');
27 * unmount a component with a `rootNodeID`, then mount a new one in its place,
28 */
29 var INITIAL_TAG_COUNT = 1;
31 -var NATIVE_TOP_ROOT_ID_SEPARATOR = '{TOP_LEVEL}';
30 var ReactNativeTagHandles = {
31 tagsStartAt: INITIAL_TAG_COUNT,
32 tagCount: INITIAL_TAG_COUNT,
@@ -46,14 +44,14 @@ var ReactNativeTagHandles = {
44 assertRootTag: function(tag: number): void {
45 invariant(
46 this.reactTagIsNativeTopRootID(tag),
49 - 'Expect a native root tag, instead got ', tag
47 + 'Expect a native root tag, instead got %s', tag
48 );
49 },
50
51 reactTagIsNativeTopRootID: function(reactTag: number): bool {
52 // We reserve all tags that are 1 mod 10 for native root views
53 return reactTag % 10 === 1;
56 - }
54 + },
55 };
56
57 module.exports = ReactNativeTagHandles;
src/renderers/native/ReactNative/ReactNativeTextComponent.js
+3 -3
@@ -31,8 +31,8 @@ Object.assign(ReactNativeTextComponent.prototype, {
31 // TODO: nativeParent should have this context already. Stop abusing context.
32 invariant(
33 context.isInAParentText,
34 - 'RawText "' + this._stringText + '" must be wrapped in an explicit ' +
35 - '<Text> component.'
34 + 'RawText "%s" must be wrapped in an explicit <Text> component.',
35 + this._stringText
36 );
37 this._nativeParent = nativeParent;
38 var tag = ReactNativeTagHandles.allocateTag();
@@ -74,7 +74,7 @@ Object.assign(ReactNativeTextComponent.prototype, {
74 this._currentElement = null;
75 this._stringText = null;
76 this._rootNodeID = null;
77 - }
77 + },
78
79 });
80
src/renderers/native/ReactNative/__tests__/ReactNativeAttributePayload-test.js
+21 -6
@@ -87,10 +87,10 @@ describe('ReactNativeAttributePayload', function() {
87
88 it('should do deep diffs of Objects by default', () => {
89 expect(diff(
90 - {a: [1], b: {k: [3,4]}, c: {k: [4,4]} },
91 - {a: [2], b: {k: [3,4]}, c: {k: [4,5]} },
90 + {a: [1], b: {k: [3, 4]}, c: {k: [4, 4]} },
91 + {a: [2], b: {k: [3, 4]}, c: {k: [4, 5]} },
92 {a: true, b: true, c: true}
93 - )).toEqual({a: [2], c: {k: [4,5]}});
93 + )).toEqual({a: [2], c: {k: [4, 5]}});
94 });
95
96 it('should work with undefined styles', () => {
@@ -222,10 +222,25 @@ describe('ReactNativeAttributePayload', function() {
222 // Note that if the property changes from one function to another, we don't
223 // need to send an update.
224 expect(diff(
225 - {a: function() { return 1; }, b: function() { return 2; }, c: 3},
226 - {b: function() { return 9; }, c: function() { return 3; }, },
225 + {
226 + a: function() {
227 + return 1;
228 + },
229 + b: function() {
230 + return 2;
231 + },
232 + c: 3,
233 + },
234 + {
235 + b: function() {
236 + return 9;
237 + },
238 + c: function() {
239 + return 3;
240 + },
241 + },
242 {a: true, b: true, c: true}
243 )).toEqual({a: null, c: true});
244 });
245
231 - });
246 +});
src/renderers/native/ReactNative/findNodeHandle.js
-1
@@ -14,7 +14,6 @@
14
15 var ReactCurrentOwner = require('ReactCurrentOwner');
16 var ReactInstanceMap = require('ReactInstanceMap');
17 -var ReactNativeTagHandles = require('ReactNativeTagHandles');
17
18 var invariant = require('invariant');
19 var warning = require('warning');
src/renderers/shared/event/eventPlugins/PanResponder.js
+9 -8
@@ -2,7 +2,7 @@
2 * @providesModule PanResponder
3 */
4
5 -"use strict";
5 +'use strict';
6
7 var TouchHistoryMath = require('TouchHistoryMath');
8
@@ -320,25 +320,25 @@ var PanResponder = {
320 gestureState.y0 = currentCentroidY(e.touchHistory);
321 gestureState.dx = 0;
322 gestureState.dy = 0;
323 - config.onPanResponderGrant && config.onPanResponderGrant(e, gestureState);
323 + if (config.onPanResponderGrant) config.onPanResponderGrant(e, gestureState);
324 // TODO: t7467124 investigate if this can be removed
325 return config.onShouldBlockNativeResponder === undefined ? true :
326 config.onShouldBlockNativeResponder();
327 },
328
329 onResponderReject: function(e) {
330 - config.onPanResponderReject && config.onPanResponderReject(e, gestureState);
330 + if (config.onPanResponderReject) config.onPanResponderReject(e, gestureState);
331 },
332
333 onResponderRelease: function(e) {
334 - config.onPanResponderRelease && config.onPanResponderRelease(e, gestureState);
334 + if (config.onPanResponderRelease) config.onPanResponderRelease(e, gestureState);
335 PanResponder._initializeGestureState(gestureState);
336 },
337
338 onResponderStart: function(e) {
339 var touchHistory = e.touchHistory;
340 gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
341 - config.onPanResponderStart && config.onPanResponderStart(e, gestureState);
341 + if (config.onPanResponderStart) config.onPanResponderStart(e, gestureState);
342 },
343
344 onResponderMove: function(e) {
@@ -351,18 +351,19 @@ var PanResponder = {
351 // Filter out any touch moves past the first one - we would have
352 // already processed multi-touch geometry during the first event.
353 PanResponder._updateGestureStateOnMove(gestureState, touchHistory);
354 - config.onPanResponderMove && config.onPanResponderMove(e, gestureState);
354 + if (config.onPanResponderMove) config.onPanResponderMove(e, gestureState);
355 },
356
357 onResponderEnd: function(e) {
358 var touchHistory = e.touchHistory;
359 gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
360 - config.onPanResponderEnd && config.onPanResponderEnd(e, gestureState);
360 + if (config.onPanResponderEnd) config.onPanResponderEnd(e, gestureState);
361 },
362
363 onResponderTerminate: function(e) {
364 - config.onPanResponderTerminate &&
364 + if (config.onPanResponderTerminate) {
365 config.onPanResponderTerminate(e, gestureState);
366 + }
367 PanResponder._initializeGestureState(gestureState);
368 },
369
src/renderers/shared/event/eventPlugins/TouchHistoryMath.js
+1 -1
@@ -2,7 +2,7 @@
2 * @providesModule TouchHistoryMath
3 */
4
5 -"use strict";
5 +'use strict';
6
7 var TouchHistoryMath = {
8 /**