JS: Format with Prettier v2.4.1 [3/n]

Summary:
Changelog:
[General][Internal]

Reviewed By: zertosh

Differential Revision: D31883447

fbshipit-source-id: cbbf85e4bf935096d242336f41bf0cc5d6f92359
This commit is contained in:
Tim Yung
2021-11-02 22:10:46 -07:00
committed by Facebook GitHub Bot
parent 4e587a1b7d
commit 77ecc7ede1
260 changed files with 1751 additions and 2143 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ const {NativeModules} = require('react-native');
const {Assert} = NativeModules;
const Asserts = {
assertEquals: function(expected, actual, msg) {
assertEquals: function (expected, actual, msg) {
if (expected !== actual) {
Assert.fail(
msg ||
@@ -30,7 +30,7 @@ const Asserts = {
Assert.success();
}
},
assertTrue: function(expr, msg) {
assertTrue: function (expr, msg) {
Asserts.assertEquals(true, expr, msg);
},
};
@@ -41,7 +41,7 @@ class CatalystRootViewTestApp extends React.Component {
}
const ReactRootViewTestModule = {
setHeight: function(height) {
setHeight: function (height) {
that.setState({height: height});
},
};
@@ -71,90 +71,41 @@ function shouldNotCallThisCallback() {
const MeasureLayoutTestModule = {
MeasureLayoutTestApp: MeasureLayoutTestApp,
verifyMeasureOnViewA: function() {
UIManager.measure(A, function(a, b, width, height, x, y) {
verifyMeasureOnViewA: function () {
UIManager.measure(A, function (a, b, width, height, x, y) {
assertEquals(500, width);
assertEquals(500, height);
assertEquals(0, x);
assertEquals(0, y);
});
},
verifyMeasureOnViewC: function() {
UIManager.measure(C, function(a, b, width, height, x, y) {
verifyMeasureOnViewC: function () {
UIManager.measure(C, function (a, b, width, height, x, y) {
assertEquals(50, width);
assertEquals(150, height);
assertEquals(150, x);
assertEquals(150, y);
});
},
verifyMeasureLayoutCRelativeToA: function() {
UIManager.measureLayout(C, A, shouldNotCallThisCallback, function(
x,
y,
width,
height,
) {
assertEquals(50, width);
assertEquals(150, height);
assertEquals(150, x);
assertEquals(150, y);
});
},
verifyMeasureLayoutCRelativeToB: function() {
UIManager.measureLayout(C, B, shouldNotCallThisCallback, function(
x,
y,
width,
height,
) {
assertEquals(50, width);
assertEquals(150, height);
assertEquals(100, x);
assertEquals(70, y);
});
},
verifyMeasureLayoutCRelativeToSelf: function() {
UIManager.measureLayout(C, C, shouldNotCallThisCallback, function(
x,
y,
width,
height,
) {
assertEquals(50, width);
assertEquals(150, height);
assertEquals(0, x);
assertEquals(0, y);
});
},
verifyMeasureLayoutRelativeToParentOnViewA: function() {
UIManager.measureLayoutRelativeToParent(
verifyMeasureLayoutCRelativeToA: function () {
UIManager.measureLayout(
C,
A,
shouldNotCallThisCallback,
function(x, y, width, height) {
assertEquals(500, width);
assertEquals(500, height);
assertEquals(0, x);
assertEquals(0, y);
function (x, y, width, height) {
assertEquals(50, width);
assertEquals(150, height);
assertEquals(150, x);
assertEquals(150, y);
},
);
},
verifyMeasureLayoutRelativeToParentOnViewB: function() {
UIManager.measureLayoutRelativeToParent(
verifyMeasureLayoutCRelativeToB: function () {
UIManager.measureLayout(
C,
B,
shouldNotCallThisCallback,
function(x, y, width, height) {
assertEquals(200, width);
assertEquals(300, height);
assertEquals(50, x);
assertEquals(80, y);
},
);
},
verifyMeasureLayoutRelativeToParentOnViewC: function() {
UIManager.measureLayoutRelativeToParent(
C,
shouldNotCallThisCallback,
function(x, y, width, height) {
function (x, y, width, height) {
assertEquals(50, width);
assertEquals(150, height);
assertEquals(100, x);
@@ -162,40 +113,89 @@ const MeasureLayoutTestModule = {
},
);
},
verifyMeasureLayoutDRelativeToB: function() {
verifyMeasureLayoutCRelativeToSelf: function () {
UIManager.measureLayout(
C,
C,
shouldNotCallThisCallback,
function (x, y, width, height) {
assertEquals(50, width);
assertEquals(150, height);
assertEquals(0, x);
assertEquals(0, y);
},
);
},
verifyMeasureLayoutRelativeToParentOnViewA: function () {
UIManager.measureLayoutRelativeToParent(
A,
shouldNotCallThisCallback,
function (x, y, width, height) {
assertEquals(500, width);
assertEquals(500, height);
assertEquals(0, x);
assertEquals(0, y);
},
);
},
verifyMeasureLayoutRelativeToParentOnViewB: function () {
UIManager.measureLayoutRelativeToParent(
B,
shouldNotCallThisCallback,
function (x, y, width, height) {
assertEquals(200, width);
assertEquals(300, height);
assertEquals(50, x);
assertEquals(80, y);
},
);
},
verifyMeasureLayoutRelativeToParentOnViewC: function () {
UIManager.measureLayoutRelativeToParent(
C,
shouldNotCallThisCallback,
function (x, y, width, height) {
assertEquals(50, width);
assertEquals(150, height);
assertEquals(100, x);
assertEquals(70, y);
},
);
},
verifyMeasureLayoutDRelativeToB: function () {
UIManager.measureLayout(
D,
B,
function() {
function () {
assertEquals(true, true);
},
shouldNotCallThisCallback,
);
},
verifyMeasureLayoutNonExistentTag: function() {
verifyMeasureLayoutNonExistentTag: function () {
UIManager.measureLayout(
192,
A,
function() {
function () {
assertEquals(true, true);
},
shouldNotCallThisCallback,
);
},
verifyMeasureLayoutNonExistentAncestor: function() {
verifyMeasureLayoutNonExistentAncestor: function () {
UIManager.measureLayout(
B,
192,
function() {
function () {
assertEquals(true, true);
},
shouldNotCallThisCallback,
);
},
verifyMeasureLayoutRelativeToParentNonExistentTag: function() {
verifyMeasureLayoutRelativeToParentNonExistentTag: function () {
UIManager.measureLayoutRelativeToParent(
192,
function() {
function () {
assertEquals(true, true);
},
shouldNotCallThisCallback,
@@ -40,7 +40,7 @@ class ProgressBarSampleApp extends React.Component {
}
const ProgressBarTestModule = {
renderProgressBarApplication: function(rootTag) {
renderProgressBarApplication: function (rootTag) {
renderApplication(ProgressBarSampleApp, {}, rootTag);
},
};
@@ -51,7 +51,7 @@ class Item extends React.Component<ItemProps, ItemState> {
}
}
const getInitialState = function() {
const getInitialState = function () {
const data = [];
for (let i = 0; i < NUM_ITEMS; i++) {
data[i] = {text: 'Item ' + i + '!'};
@@ -61,28 +61,28 @@ const getInitialState = function() {
};
};
const onScroll = function(e) {
const onScroll = function (e) {
ScrollListener.onScroll(
e.nativeEvent.contentOffset.x,
e.nativeEvent.contentOffset.y,
);
};
const onScrollBeginDrag = function(e) {
const onScrollBeginDrag = function (e) {
ScrollListener.onScrollBeginDrag(
e.nativeEvent.contentOffset.x,
e.nativeEvent.contentOffset.y,
);
};
const onScrollEndDrag = function(e) {
const onScrollEndDrag = function (e) {
ScrollListener.onScrollEndDrag(
e.nativeEvent.contentOffset.x,
e.nativeEvent.contentOffset.y,
);
};
const onItemPress = function(itemNumber) {
const onItemPress = function (itemNumber) {
ScrollListener.onItemPress(itemNumber);
};
@@ -23,7 +23,7 @@ class ShareTestApp extends React.Component {
const ShareTestModule = {
ShareTestApp: ShareTestApp,
showShareDialog: function(content, options) {
showShareDialog: function (content, options) {
Share.share(content, options).then(
() => RecordingModule.recordOpened(),
({code, message}) => RecordingModule.recordError(),
@@ -342,21 +342,21 @@ class SubviewsClippingTestApp extends React.Component {
const SubviewsClippingTestModule = {
App: SubviewsClippingTestApp,
renderClippingSample1: function() {
renderClippingSample1: function () {
appInstance.setComponent(<ClippingSample1 />);
},
renderClippingSample2: function() {
renderClippingSample2: function () {
appInstance.setComponent(<ClippingSample2 />);
},
renderUpdatingSample1: function(update1, update2) {
renderUpdatingSample1: function (update1, update2) {
appInstance.setComponent(
<UpdatingSample1 update1={update1} update2={update2} />,
);
},
renderUpdatingSample2: function(update) {
renderUpdatingSample2: function (update) {
appInstance.setComponent(<UpdatingSample2 update={update} />);
},
renderScrollViewTest: function() {
renderScrollViewTest: function () {
appInstance.setComponent(<ScrollViewTest />);
},
};
@@ -77,7 +77,7 @@ class SwipeRefreshLayoutTestApp extends React.Component {
const SwipeRefreshLayoutTestModule = {
SwipeRefreshLayoutTestApp,
setRows: function(rows) {
setRows: function (rows) {
if (app != null) {
app.setState({rows});
}
@@ -15,10 +15,10 @@ const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridg
const {Recording} = NativeModules;
const TestJSLocaleModule = {
toUpper: function(s) {
toUpper: function (s) {
Recording.record(s.toUpperCase());
},
toLower: function(s) {
toLower: function (s) {
Recording.record(s.toLowerCase());
},
};
@@ -15,26 +15,26 @@ const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridg
const {Recording} = NativeModules;
const TestJSToJavaParametersModule = {
returnBasicTypes: function() {
returnBasicTypes: function () {
Recording.receiveBasicTypes('foo', 3.14, true, null);
},
returnBoxedTypes: function() {
returnBoxedTypes: function () {
Recording.receiveBoxedTypes(42, 3.14, true);
},
returnDynamicTypes: function() {
returnDynamicTypes: function () {
Recording.receiveDynamic('foo');
Recording.receiveDynamic(3.14);
},
returnArrayWithBasicTypes: function() {
returnArrayWithBasicTypes: function () {
Recording.receiveArray(['foo', 3.14, -111, true, null]);
},
returnNestedArray: function() {
returnNestedArray: function () {
Recording.receiveArray(['we', ['have', ['to', ['go', ['deeper']]]]]);
},
returnArrayWithMaps: function() {
returnArrayWithMaps: function () {
Recording.receiveArray([{m1k1: 'm1v1', m1k2: 'm1v2'}, {m2k1: 'm2v1'}]);
},
returnMapWithBasicTypes: function() {
returnMapWithBasicTypes: function () {
Recording.receiveMap({
stringKey: 'stringValue',
doubleKey: 3.14,
@@ -43,24 +43,24 @@ const TestJSToJavaParametersModule = {
nullKey: null,
});
},
returnNestedMap: function() {
returnNestedMap: function () {
Recording.receiveMap({
weHaveToGoDeeper: {
inception: true,
},
});
},
returnMapWithArrays: function() {
returnMapWithArrays: function () {
Recording.receiveMap({
empty: [],
ints: [43, 44],
mixed: [77, 'string', ['another', 'array']],
});
},
returnArrayWithStringDoubleIntMapArrayBooleanNull: function() {
returnArrayWithStringDoubleIntMapArrayBooleanNull: function () {
Recording.receiveArray(['string', 3.14, 555, {}, [], true, null]);
},
returnMapWithStringDoubleIntMapArrayBooleanNull: function() {
returnMapWithStringDoubleIntMapArrayBooleanNull: function () {
Recording.receiveMap({
string: 'string',
double: 3,
@@ -71,13 +71,13 @@ const TestJSToJavaParametersModule = {
null: null,
});
},
returnArrayWithLargeInts: function() {
returnArrayWithLargeInts: function () {
Recording.receiveArray([2147483648, -5555555555]);
},
returnMapWithLargeInts: function() {
returnMapWithLargeInts: function () {
Recording.receiveMap({first: -2147483649, second: 5551231231});
},
returnMapForMerge1: function() {
returnMapForMerge1: function () {
Recording.receiveMap({
a: 1,
b: 41,
@@ -87,7 +87,7 @@ const TestJSToJavaParametersModule = {
f: null,
});
},
returnMapForMerge2: function() {
returnMapForMerge2: function () {
Recording.receiveMap({
a: 'overwrite',
d: 77,
@@ -96,7 +96,7 @@ const TestJSToJavaParametersModule = {
newkey: 'newvalue',
});
},
returnMapWithMultibyteUTF8CharacterString: function() {
returnMapWithMultibyteUTF8CharacterString: function () {
Recording.receiveMap({
'one-byte': 'a',
'two-bytes': '\u00A2',
@@ -106,7 +106,7 @@ const TestJSToJavaParametersModule = {
'\u017C\u00F3\u0142\u0107 g\u0119\u015Bl\u0105 \u6211 \uD83D\uDE0E ja\u017A\u0107',
});
},
returnArrayWithMultibyteUTF8CharacterString: function() {
returnArrayWithMultibyteUTF8CharacterString: function () {
Recording.receiveArray([
'a',
'\u00A2',
@@ -29,20 +29,20 @@ function assertStrictStringEquals(a, b) {
}
const TestJavaToJSArgumentsModule = {
receiveBasicTypes: function(str, dbl, bool, null_arg) {
receiveBasicTypes: function (str, dbl, bool, null_arg) {
assertEquals('foo', str);
assertEquals(3.14, dbl);
assertEquals(true, bool);
assertEquals(null, null_arg);
},
receiveArrayWithBasicTypes: function(arr) {
receiveArrayWithBasicTypes: function (arr) {
assertEquals(4, arr.length);
assertEquals('red panda', arr[0]);
assertEquals(1.19, arr[1]);
assertEquals(true, arr[2]);
assertEquals(null, arr[3]);
},
receiveNestedArray: function(arr) {
receiveNestedArray: function (arr) {
assertEquals(2, arr.length);
assertEquals('level1', arr[0]);
const arr2 = arr[1];
@@ -50,7 +50,7 @@ const TestJavaToJSArgumentsModule = {
const arr3 = arr2[1];
assertEquals('level3', arr3[0]);
},
receiveArrayWithMaps: function(arr) {
receiveArrayWithMaps: function (arr) {
assertEquals(2, arr.length);
const m1 = arr[0];
const m2 = arr[1];
@@ -58,17 +58,17 @@ const TestJavaToJSArgumentsModule = {
assertEquals('m1v2', m1.m1k2);
assertEquals('m2v1', m2.m2k1);
},
receiveMapWithBasicTypes: function(map) {
receiveMapWithBasicTypes: function (map) {
assertEquals('stringValue', map.stringKey);
assertEquals(3.14, map.doubleKey);
assertEquals(true, map.booleanKey);
assertEquals(null, map.nullKey);
},
receiveNestedMap: function(map) {
receiveNestedMap: function (map) {
const nestedMap = map.nestedMap;
assertEquals('foxes', nestedMap.animals);
},
receiveMapWithArrays: function(map) {
receiveMapWithArrays: function (map) {
const a1 = map.array1;
const a2 = map.array2;
assertEquals(3, a1.length);
@@ -76,7 +76,7 @@ const TestJavaToJSArgumentsModule = {
assertEquals(3, a1[0]);
assertEquals(9, a2[1]);
},
receiveMapAndArrayWithNullValues: function(map, array) {
receiveMapAndArrayWithNullValues: function (map, array) {
assertEquals(null, map.string);
assertEquals(null, map.array);
assertEquals(null, map.map);
@@ -85,7 +85,7 @@ const TestJavaToJSArgumentsModule = {
assertEquals(null, array[1]);
assertEquals(null, array[2]);
},
receiveMapWithMultibyteUTF8CharacterString: function(map) {
receiveMapWithMultibyteUTF8CharacterString: function (map) {
assertStrictStringEquals('\u00A2', map['two-bytes']);
assertStrictStringEquals('\u20AC', map['three-bytes']);
assertStrictStringEquals('\uD83D\uDE1C', map['four-bytes']);
@@ -94,7 +94,7 @@ const TestJavaToJSArgumentsModule = {
map.mixed,
);
},
receiveArrayWithMultibyteUTF8CharacterString: function(array) {
receiveArrayWithMultibyteUTF8CharacterString: function (array) {
assertTrue(true);
assertStrictStringEquals('\u00A2', array[0]);
assertStrictStringEquals('\u20AC', array[1]);
@@ -16,13 +16,13 @@ const {assertEquals, assertTrue} = require('./Asserts');
const {TestModule} = NativeModules;
const TestJavaToJSReturnValuesModule = {
callMethod: function(methodName, expectedType, expectedJSON) {
callMethod: function (methodName, expectedType, expectedJSON) {
const result = TestModule[methodName]();
assertEquals(expectedType, typeof result);
assertEquals(expectedJSON, JSON.stringify(result));
},
triggerException: function() {
triggerException: function () {
try {
TestModule.triggerException();
} catch (ex) {
@@ -176,7 +176,7 @@ const styles = StyleSheet.create({
const TextInputTestModule = {
TextInputTestApp,
setValueRef: function(ref, value) {
setValueRef: function (ref, value) {
app.refs[ref].setNativeProps({
text: value,
});
@@ -64,19 +64,19 @@ class TransformSampleApp extends React.Component {
}
const ViewRenderingTestModule = {
renderViewApplication: function(rootTag) {
renderViewApplication: function (rootTag) {
renderApplication(ViewSampleApp, {}, rootTag);
},
renderMarginApplication: function(rootTag) {
renderMarginApplication: function (rootTag) {
renderApplication(MarginSampleApp, {}, rootTag);
},
renderBorderApplication: function(rootTag) {
renderBorderApplication: function (rootTag) {
renderApplication(BorderSampleApp, {}, rootTag);
},
renderTransformApplication: function(rootTag) {
renderTransformApplication: function (rootTag) {
renderApplication(TransformSampleApp, {}, rootTag);
},
updateMargins: function() {
updateMargins: function () {
updateMargins();
},
};