Skip to content

Commit c848c38

Browse files
vjeuxfacebook-github-bot
authored andcommitted
Codemod prettier to 1.5.2
Differential Revision: D5339725 fbshipit-source-id: 631338436a7d69b0ab0721507bdab4ae4e207065
1 parent 2f193b9 commit c848c38

File tree

15 files changed

+105
-77
lines changed

15 files changed

+105
-77
lines changed

Libraries/Core/Timers/JSTimers.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,7 @@ const JSTimers = {
456456
*/
457457
callImmediates() {
458458
errors = null;
459-
while (JSTimers.callImmediatesPass()) {
460-
}
459+
while (JSTimers.callImmediatesPass()) {}
461460
if (errors) {
462461
errors.forEach(error =>
463462
JSTimers.setTimeout(() => {

Libraries/Lists/FillRateHelper.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ class FillRateHelper {
115115
const derived = {
116116
avg_blankness: this._info.pixels_blank / this._info.pixels_sampled,
117117
avg_speed: this._info.pixels_scrolled / (total_time_spent / 1000),
118-
avg_speed_when_any_blank: this._info.any_blank_speed_sum /
119-
this._info.any_blank_count,
120-
any_blank_per_min: this._info.any_blank_count /
121-
(total_time_spent / 1000 / 60),
118+
avg_speed_when_any_blank:
119+
this._info.any_blank_speed_sum / this._info.any_blank_count,
120+
any_blank_per_min:
121+
this._info.any_blank_count / (total_time_spent / 1000 / 60),
122122
any_blank_time_frac: this._info.any_blank_ms / total_time_spent,
123-
mostly_blank_per_min: this._info.mostly_blank_count /
124-
(total_time_spent / 1000 / 60),
123+
mostly_blank_per_min:
124+
this._info.mostly_blank_count / (total_time_spent / 1000 / 60),
125125
mostly_blank_time_frac: this._info.mostly_blank_ms / total_time_spent,
126126
};
127127
for (const key in derived) {

Libraries/Lists/FlatList.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,11 @@ type DefaultProps = typeof defaultProps;
304304
* Alternatively, you can provide a custom `keyExtractor` prop.
305305
*
306306
*/
307-
class FlatList<ItemT>
308-
extends React.PureComponent<DefaultProps, Props<ItemT>, void> {
307+
class FlatList<ItemT> extends React.PureComponent<
308+
DefaultProps,
309+
Props<ItemT>,
310+
void,
311+
> {
309312
static defaultProps: DefaultProps = defaultProps;
310313
props: Props<ItemT>;
311314
/**

Libraries/Lists/ListView/ListView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,8 @@ var ListView = React.createClass({
524524
ref: this._setScrollComponentRef,
525525
onContentSizeChange: this._onContentSizeChange,
526526
onLayout: this._onLayout,
527-
DEPRECATED_sendUpdatedChildFrames: typeof props.onChangeVisibleRows !==
528-
undefined,
527+
DEPRECATED_sendUpdatedChildFrames:
528+
typeof props.onChangeVisibleRows !== undefined,
529529
},
530530
header,
531531
bodyComponents,

Libraries/Lists/MetroListView.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,8 @@ class MetroListView extends React.Component {
183183
);
184184
return renderSectionHeader({section});
185185
};
186-
_renderSeparator = (sID, rID) => (
187-
<this.props.SeparatorComponent key={sID + rID} />
188-
);
186+
_renderSeparator = (sID, rID) =>
187+
<this.props.SeparatorComponent key={sID + rID} />;
189188
}
190189

191190
module.exports = MetroListView;

Libraries/Lists/SectionList.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ const React = require('React');
1818
const VirtualizedSectionList = require('VirtualizedSectionList');
1919

2020
import type {ViewToken} from 'ViewabilityHelper';
21-
import type {
22-
Props as VirtualizedSectionListProps,
23-
} from 'VirtualizedSectionList';
21+
import type {Props as VirtualizedSectionListProps} from 'VirtualizedSectionList';
2422

2523
type Item = any;
2624

@@ -253,8 +251,11 @@ type DefaultProps = typeof defaultProps;
253251
* Alternatively, you can provide a custom `keyExtractor` prop.
254252
*
255253
*/
256-
class SectionList<SectionT: SectionBase<any>>
257-
extends React.PureComponent<DefaultProps, Props<SectionT>, void> {
254+
class SectionList<SectionT: SectionBase<any>> extends React.PureComponent<
255+
DefaultProps,
256+
Props<SectionT>,
257+
void,
258+
> {
258259
props: Props<SectionT>;
259260
static defaultProps: DefaultProps = defaultProps;
260261

Libraries/Lists/VirtualizeUtils.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ function computeWindowedRenderLimits(
105105
// Considering velocity seems to introduce more churn than it's worth.
106106
const leadFactor = 0.5; // Math.max(0, Math.min(1, velocity / 25 + 0.5));
107107

108-
const fillPreference = velocity > 1
109-
? 'after'
110-
: velocity < -1 ? 'before' : 'none';
108+
const fillPreference =
109+
velocity > 1 ? 'after' : velocity < -1 ? 'before' : 'none';
111110

112111
const overscanBegin = Math.max(
113112
0,
@@ -124,9 +123,10 @@ function computeWindowedRenderLimits(
124123
overscanFirst = overscanFirst == null ? 0 : overscanFirst;
125124
first = first == null ? Math.max(0, overscanFirst) : first;
126125
overscanLast = overscanLast == null ? itemCount - 1 : overscanLast;
127-
last = last == null
128-
? Math.min(overscanLast, first + maxToRenderPerBatch - 1)
129-
: last;
126+
last =
127+
last == null
128+
? Math.min(overscanLast, first + maxToRenderPerBatch - 1)
129+
: last;
130130
const visible = {first, last};
131131

132132
// We want to limit the number of new cells we're rendering per batch so that we can fill the
@@ -174,13 +174,15 @@ function computeWindowedRenderLimits(
174174
}
175175
}
176176
if (
177-
!(last >= first &&
177+
!(
178+
last >= first &&
178179
first >= 0 &&
179180
last < itemCount &&
180181
first >= overscanFirst &&
181182
last <= overscanLast &&
182183
first <= visible.first &&
183-
last >= visible.last)
184+
last >= visible.last
185+
)
184186
) {
185187
throw new Error(
186188
'Bad window calculation ' +

Libraries/Lists/VirtualizedList.js

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,11 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
385385
);
386386
this.state = {
387387
first: this.props.initialScrollIndex || 0,
388-
last: Math.min(
389-
this.props.getItemCount(this.props.data),
390-
(this.props.initialScrollIndex || 0) + this.props.initialNumToRender,
391-
) - 1,
388+
last:
389+
Math.min(
390+
this.props.getItemCount(this.props.data),
391+
(this.props.initialScrollIndex || 0) + this.props.initialNumToRender,
392+
) - 1,
392393
};
393394
}
394395

@@ -496,8 +497,9 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
496497

497498
_isNestedWithSameOrientation(): boolean {
498499
const nestedContext = this.context.virtualizedList;
499-
return !!(nestedContext &&
500-
!!nestedContext.horizontal === !!this.props.horizontal);
500+
return !!(
501+
nestedContext && !!nestedContext.horizontal === !!this.props.horizontal
502+
);
501503
}
502504

503505
render() {
@@ -519,8 +521,8 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
519521
const isVirtualizationDisabled = this._isVirtualizationDisabled();
520522
const inversionStyle = this.props.inverted
521523
? this.props.horizontal
522-
? styles.horizontallyInverted
523-
: styles.verticallyInverted
524+
? styles.horizontallyInverted
525+
: styles.verticallyInverted
524526
: null;
525527
const cells = [];
526528
const stickyIndicesFromProps = new Set(this.props.stickyHeaderIndices);
@@ -680,7 +682,12 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
680682
cells,
681683
);
682684
if (this.props.debug) {
683-
return <View style={{flex: 1}}>{ret}{this._renderDebugOverlay()}</View>;
685+
return (
686+
<View style={{flex: 1}}>
687+
{ret}
688+
{this._renderDebugOverlay()}
689+
</View>
690+
);
684691
} else {
685692
return ret;
686693
}
@@ -840,7 +847,7 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
840847
borderColor: 'blue',
841848
borderWidth: 1,
842849
}}>
843-
{framesInLayout.map((f, ii) => (
850+
{framesInLayout.map((f, ii) =>
844851
<View
845852
key={'f' + ii}
846853
style={{
@@ -850,8 +857,8 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
850857
height: f.length * normalize,
851858
backgroundColor: 'orange',
852859
}}
853-
/>
854-
))}
860+
/>,
861+
)}
855862
<View
856863
style={{
857864
...baseStyle,
@@ -1047,10 +1054,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
10471054
} else {
10481055
const {contentLength, offset, visibleLength} = this._scrollMetrics;
10491056
const distanceFromEnd = contentLength - visibleLength - offset;
1050-
const renderAhead = distanceFromEnd <
1051-
onEndReachedThreshold * visibleLength
1052-
? this.props.maxToRenderPerBatch
1053-
: 0;
1057+
const renderAhead =
1058+
distanceFromEnd < onEndReachedThreshold * visibleLength
1059+
? this.props.maxToRenderPerBatch
1060+
: 0;
10541061
newState = {
10551062
first: 0,
10561063
last: Math.min(state.last + renderAhead, getItemCount(data) - 1),
@@ -1121,7 +1128,7 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
11211128
{frame: frameType},
11221129
{frame},
11231130
'frame',
1124-
'VirtualizedList.getItemLayout'
1131+
'VirtualizedList.getItemLayout',
11251132
);
11261133
}
11271134
}
@@ -1221,11 +1228,10 @@ class CellRenderer extends React.Component {
12211228
index,
12221229
separators: this._separators,
12231230
});
1224-
const onLayout = getItemLayout &&
1225-
!parentProps.debug &&
1226-
!fillRateHelper.enabled()
1227-
? undefined
1228-
: this.props.onLayout;
1231+
const onLayout =
1232+
getItemLayout && !parentProps.debug && !fillRateHelper.enabled()
1233+
? undefined
1234+
: this.props.onLayout;
12291235
// NOTE: that when this is a sticky header, `onLayout` will get automatically extracted and
12301236
// called explicitly by `ScrollViewStickyHeader`.
12311237
return (

Libraries/Lists/VirtualizedSectionList.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,11 @@ type State = {childProps: VirtualizedListProps};
133133
* hood. The only operation that might not scale well is concatting the data arrays of all the
134134
* sections when new props are received, which should be plenty fast for up to ~10,000 items.
135135
*/
136-
class VirtualizedSectionList<SectionT: SectionBase>
137-
extends React.PureComponent<DefaultProps, Props<SectionT>, State> {
136+
class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
137+
DefaultProps,
138+
Props<SectionT>,
139+
State,
140+
> {
138141
props: Props<SectionT>;
139142

140143
state: State;
@@ -459,7 +462,11 @@ class ItemWithSeparator extends React.Component {
459462
SeparatorComponent &&
460463
<SeparatorComponent {...this.state.separatorProps} />;
461464
return leadingSeparator || separator
462-
? <View>{leadingSeparator}{element}{separator}</View>
465+
? <View>
466+
{leadingSeparator}
467+
{element}
468+
{separator}
469+
</View>
463470
: element;
464471
}
465472
}

Libraries/Lists/__flowtests__/SectionList-flowtest.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ function renderMyListItem(info: {item: {title: string}, index: number}) {
1919
return <span />;
2020
}
2121

22-
const renderMyHeader = ({section}: {section: {fooNumber: number} & Object}) => (
23-
<span />
24-
);
22+
const renderMyHeader = ({section}: {section: {fooNumber: number} & Object}) =>
23+
<span />;
2524

2625
module.exports = {
2726
testGoodDataWithGoodItem() {

0 commit comments

Comments
 (0)