Skip to content

Commit 29fb2a8

Browse files
Peter van der Zeefacebook-github-bot
Peter van der Zee
authored andcommittedJun 6, 2018
Bump Prettier to 1.13.4 on xplat
Summary: Bump Prettier to use version 1.13.4 All code changes are caused by running Prettier and should only affect files that have an `format` header. All other changes caused by yarn. Reviewed By: ryanmce Differential Revision: D8251255 fbshipit-source-id: 0b4445c35f1269d72730f2000002a27c1bc35914
1 parent 3a1d949 commit 29fb2a8

37 files changed

+88
-55
lines changed
 

‎Libraries/ART/ReactNativeART.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ function insertOffsetsIntoArray(stops, targetArray, atIndex, multi, reverse) {
297297
let i = 0;
298298
if ('length' in stops) {
299299
while (i < stops.length) {
300-
offsetNumber = i / (stops.length - 1) * multi;
300+
offsetNumber = (i / (stops.length - 1)) * multi;
301301
targetArray[atIndex + i] = reverse ? 1 - offsetNumber : offsetNumber;
302302
i++;
303303
}
@@ -530,7 +530,7 @@ function LinearGradient(stops, x1, y1, x2, y2) {
530530
const type = LINEAR_GRADIENT;
531531

532532
if (arguments.length < 5) {
533-
const angle = (x1 == null ? 270 : x1) * Math.PI / 180;
533+
const angle = ((x1 == null ? 270 : x1) * Math.PI) / 180;
534534

535535
let x = Math.cos(angle);
536536
let y = -Math.sin(angle);

‎Libraries/Animated/src/Easing.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class Easing {
131131
* http://easings.net/#easeInSine
132132
*/
133133
static sin(t: number) {
134-
return 1 - Math.cos(t * Math.PI / 2);
134+
return 1 - Math.cos((t * Math.PI) / 2);
135135
}
136136

137137
/**
@@ -164,7 +164,7 @@ class Easing {
164164
*/
165165
static elastic(bounciness: number = 1): (t: number) => number {
166166
const p = bounciness * Math.PI;
167-
return t => 1 - Math.pow(Math.cos(t * Math.PI / 2), 3) * Math.cos(t * p);
167+
return t => 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p);
168168
}
169169

170170
/**

‎Libraries/Animated/src/__tests__/Easing-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('Easing', () => {
8181

8282
function sampleEasingFunction(easing) {
8383
const DURATION = 300;
84-
const tickCount = Math.round(DURATION * 60 / 1000);
84+
const tickCount = Math.round((DURATION * 60) / 1000);
8585
const samples = [];
8686
for (let i = 0; i <= tickCount; i++) {
8787
samples.push(easing(i / tickCount));

‎Libraries/Animated/src/animations/DecayAnimation.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ class DecayAnimation extends Animation {
8181

8282
const value =
8383
this._fromValue +
84-
this._velocity /
85-
(1 - this._deceleration) *
84+
(this._velocity / (1 - this._deceleration)) *
8685
(1 - Math.exp(-(1 - this._deceleration) * (now - this._startTime)));
8786

8887
this._onUpdate(value);

‎Libraries/Animated/src/animations/SpringAnimation.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ class SpringAnimation extends Animation {
266266
position =
267267
this._toValue -
268268
envelope *
269-
((v0 + zeta * omega0 * x0) / omega1 * Math.sin(omega1 * t) +
269+
(((v0 + zeta * omega0 * x0) / omega1) * Math.sin(omega1 * t) +
270270
x0 * Math.cos(omega1 * t));
271271
// This looks crazy -- it's actually just the derivative of the
272272
// oscillation function
273273
velocity =
274274
zeta *
275275
omega0 *
276276
envelope *
277-
(Math.sin(omega1 * t) * (v0 + zeta * omega0 * x0) / omega1 +
277+
((Math.sin(omega1 * t) * (v0 + zeta * omega0 * x0)) / omega1 +
278278
x0 * Math.cos(omega1 * t)) -
279279
envelope *
280280
(Math.cos(omega1 * t) * (v0 + zeta * omega0 * x0) -

‎Libraries/Animated/src/nodes/AnimatedInterpolation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ class AnimatedInterpolation extends AnimatedWithChildren {
358358
}
359359
if (/deg$/.test(value)) {
360360
const degrees = parseFloat(value) || 0;
361-
const radians = degrees * Math.PI / 180.0;
361+
const radians = (degrees * Math.PI) / 180.0;
362362
return radians;
363363
} else {
364364
// Assume radians

‎Libraries/Animated/src/nodes/AnimatedModulo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class AnimatedModulo extends AnimatedWithChildren {
3232

3333
__getValue(): number {
3434
return (
35-
(this._a.__getValue() % this._modulus + this._modulus) % this._modulus
35+
((this._a.__getValue() % this._modulus) + this._modulus) % this._modulus
3636
);
3737
}
3838

‎Libraries/Color/normalizeColor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function parse255(str: string): number {
188188

189189
function parse360(str: string): number {
190190
const int = parseFloat(str);
191-
return ((int % 360 + 360) % 360) / 360;
191+
return (((int % 360) + 360) % 360) / 360;
192192
}
193193

194194
function parse1(str: string): number {

‎Libraries/Components/Keyboard/KeyboardAvoidingView.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,10 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
171171
return (
172172
<View
173173
ref={viewRef}
174-
style={StyleSheet.compose(style, heightStyle)}
174+
style={StyleSheet.compose(
175+
style,
176+
heightStyle,
177+
)}
175178
onLayout={this._onLayout}
176179
{...props}>
177180
{children}
@@ -186,9 +189,12 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
186189
onLayout={this._onLayout}
187190
{...props}>
188191
<View
189-
style={StyleSheet.compose(contentContainerStyle, {
190-
bottom: bottomHeight,
191-
})}>
192+
style={StyleSheet.compose(
193+
contentContainerStyle,
194+
{
195+
bottom: bottomHeight,
196+
},
197+
)}>
192198
{children}
193199
</View>
194200
</View>
@@ -198,7 +204,10 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
198204
return (
199205
<View
200206
ref={viewRef}
201-
style={StyleSheet.compose(style, {paddingBottom: bottomHeight})}
207+
style={StyleSheet.compose(
208+
style,
209+
{paddingBottom: bottomHeight},
210+
)}
202211
onLayout={this._onLayout}
203212
{...props}>
204213
{children}

‎Libraries/Components/Slider/Slider.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,10 @@ const Slider = (
199199
forwardedRef?: ?React.Ref<'RCTActivityIndicatorView'>,
200200
|}>,
201201
) => {
202-
const style = StyleSheet.compose(styles.slider, props.style);
202+
const style = StyleSheet.compose(
203+
styles.slider,
204+
props.style,
205+
);
203206

204207
const onValueChange =
205208
props.onValueChange &&

‎Libraries/Components/Switch/Switch.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ class Switch extends React.Component<Props> {
134134
: this.props.tintColor,
135135
}
136136
: {
137-
style: StyleSheet.compose(styles.rctSwitchIOS, this.props.style),
137+
style: StyleSheet.compose(
138+
styles.rctSwitchIOS,
139+
this.props.style,
140+
),
138141
};
139142

140143
return (

‎Libraries/Lists/FlatList.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,11 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
614614
'Expected array of items with numColumns > 1',
615615
);
616616
return (
617-
<View style={StyleSheet.compose(styles.row, columnWrapperStyle)}>
617+
<View
618+
style={StyleSheet.compose(
619+
styles.row,
620+
columnWrapperStyle,
621+
)}>
618622
{item.map((it, kk) => {
619623
const element = renderItem({
620624
item: it,

‎Libraries/Lists/VirtualizedList.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
13691369
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
13701370
* error found when Flow v0.63 was deployed. To see the error delete
13711371
* this comment and run Flow. */
1372-
this.props.onEndReachedThreshold * visibleLength / 2;
1372+
(this.props.onEndReachedThreshold * visibleLength) / 2;
13731373
// Mark as high priority if we're close to the start of the first item
13741374
// But only if there are items before the first rendered item
13751375
if (first > 0) {

‎Libraries/Lists/VirtualizedSectionList.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ class ItemWithSeparator extends React.Component<
457457
static getDerivedStateFromProps(
458458
props: ItemWithSeparatorProps,
459459
prevState: ItemWithSeparatorState,
460-
): ?ItemWithSeparatorState {
460+
): ?ItemWithSeparatorState {
461461
return {
462462
separatorProps: {
463463
...prevState.separatorProps,

‎Libraries/ReactNative/YellowBox.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -424,13 +424,14 @@ class YellowBox extends React.Component<
424424
];
425425
return (
426426
<View style={inspector ? styles.fullScreen : listStyle}>
427-
{!inspector && rows.length > 0 && (
428-
<TouchableHighlight
429-
style={styles.dismissAllContainer}
430-
onPress={() => this.dismissWarning(null)}>
431-
<Text style={styles.dismissAll}>Dismiss All</Text>
432-
</TouchableHighlight>
433-
)}
427+
{!inspector &&
428+
rows.length > 0 && (
429+
<TouchableHighlight
430+
style={styles.dismissAllContainer}
431+
onPress={() => this.dismissWarning(null)}>
432+
<Text style={styles.dismissAll}>Dismiss All</Text>
433+
</TouchableHighlight>
434+
)}
434435
<ScrollView style={listStyle} scrollsToTop={false}>
435436
{rows}
436437
</ScrollView>

‎Libraries/StyleSheet/processTransform.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function _multiplyTransform(
133133
*/
134134
function _convertToRadians(value: string): number {
135135
const floatValue = parseFloat(value);
136-
return value.indexOf('rad') > -1 ? floatValue : floatValue * Math.PI / 180;
136+
return value.indexOf('rad') > -1 ? floatValue : (floatValue * Math.PI) / 180;
137137
}
138138

139139
function _validateTransforms(transform: Array<Object>): void {

‎Libraries/Utilities/MatrixMath.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ const MatrixMath = {
719719
0,
720720
0,
721721
MatrixMath.roundTo3Places(
722-
Math.atan2(row[0][1], row[0][0]) * 180 / Math.PI,
722+
(Math.atan2(row[0][1], row[0][0]) * 180) / Math.PI,
723723
),
724724
];
725725
} else {

‎Libraries/Utilities/__tests__/MatrixMath-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
const MatrixMath = require('MatrixMath');
1414

1515
function degreesToRadians(degrees) {
16-
return degrees * Math.PI / 180;
16+
return (degrees * Math.PI) / 180;
1717
}
1818

1919
function convertZeroes(degrees) {

‎Libraries/WebSocket/WebSocket.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,12 @@ class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) {
145145
this._eventEmitter = new NativeEventEmitter(WebSocketModule);
146146
this._socketId = nextWebSocketId++;
147147
this._registerEvents();
148-
WebSocketModule.connect(url, protocols, {headers}, this._socketId);
148+
WebSocketModule.connect(
149+
url,
150+
protocols,
151+
{headers},
152+
this._socketId,
153+
);
149154
}
150155

151156
get binaryType(): ?BinaryType {

‎RNTester/js/AlertExample.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ class SimpleAlertExampleBlock extends React.Component {
121121
class AlertExample extends React.Component {
122122
static title = 'Alert';
123123

124-
static description = 'Alerts display a concise and informative message ' +
125-
'and prompt the user to make a decision.';
124+
static description =
125+
'Alerts display a concise and informative message ' +
126+
'and prompt the user to make a decision.';
126127

127128
render() {
128129
return (

‎RNTester/js/AnimatedGratuitousApp/AnExApp.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,9 @@ class Circle extends React.Component<any, any> {
193193

194194
class AnExApp extends React.Component<any, any> {
195195
static title = 'Animated - Gratuitous App';
196-
static description = 'Bunch of Animations - tap a circle to ' +
197-
'open a view with more animations, or longPress and drag to reorder circles.';
196+
static description =
197+
'Bunch of Animations - tap a circle to ' +
198+
'open a view with more animations, or longPress and drag to reorder circles.';
198199

199200
_onMove: (position: Point) => void;
200201
constructor(props: any): void {

‎RNTester/js/DatePickerIOSExample.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DatePickerExample extends React.Component<
2020
> {
2121
static defaultProps = {
2222
date: new Date(),
23-
timeZoneOffsetInHours: -1 * new Date().getTimezoneOffset() / 60,
23+
timeZoneOffsetInHours: (-1 * new Date().getTimezoneOffset()) / 60,
2424
};
2525

2626
state = {

‎RNTester/js/ImageExample.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ var NetworkImageExample = createReactClass({
158158
onProgress={e =>
159159
this.setState({
160160
progress: Math.round(
161-
100 * e.nativeEvent.loaded / e.nativeEvent.total,
161+
(100 * e.nativeEvent.loaded) / e.nativeEvent.total,
162162
),
163163
})
164164
}

‎RNTester/js/InputAccessoryViewExample.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ class TextInputBar extends React.PureComponent<*, *> {
6060

6161
class InputAccessoryViewExample extends React.Component<*> {
6262
static title = '<InputAccessoryView>';
63-
static description = 'Example showing how to use an InputAccessoryView to build an iMessage-like sticky text input';
63+
static description =
64+
'Example showing how to use an InputAccessoryView to build an iMessage-like sticky text input';
6465

6566
render() {
6667
return (

‎RNTester/js/KeyboardAvoidingViewExample.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const RNTesterPage = require('./RNTesterPage');
2727

2828
class KeyboardAvoidingViewExample extends React.Component {
2929
static title = '<KeyboardAvoidingView>';
30-
static description = 'Base component for views that automatically adjust their height or position to move out of the way of the keyboard.';
30+
static description =
31+
'Base component for views that automatically adjust their height or position to move out of the way of the keyboard.';
3132

3233
state = {
3334
behavior: 'padding',

‎RNTester/js/ListExampleShared.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function genItemData(count: number, start: number = 0): Array<Item> {
3838
const itemHash = Math.abs(hashCode('Item ' + ii));
3939
dataBlob.push({
4040
title: 'Item ' + ii,
41-
text: LOREM_IPSUM.substr(0, itemHash % 301 + 20),
41+
text: LOREM_IPSUM.substr(0, (itemHash % 301) + 20),
4242
key: String(ii),
4343
pressed: false,
4444
});

‎RNTester/js/ListViewExample.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ var ListViewSimpleExample = createReactClass({
7070
<View style={styles.row}>
7171
<Image style={styles.thumb} source={imgSource} />
7272
<Text style={styles.text}>
73-
{rowData + ' - ' + LOREM_IPSUM.substr(0, rowHash % 301 + 10)}
73+
{rowData + ' - ' + LOREM_IPSUM.substr(0, (rowHash % 301) + 10)}
7474
</Text>
7575
</View>
7676
</View>

‎RNTester/js/MaskedViewExample.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ const {
2424

2525
class MaskedViewExample extends React.Component<{}, $FlowFixMeState> {
2626
static title = '<MaskedViewIOS>';
27-
static description = 'Renders the child view with a mask specified in the `renderMask` prop.';
27+
static description =
28+
'Renders the child view with a mask specified in the `renderMask` prop.';
2829

2930
state = {
3031
alternateChildren: true,

‎RNTester/js/PickerExample.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const Item = Picker.Item;
2222

2323
class PickerExample extends React.Component<{}, $FlowFixMeState> {
2424
static title = '<Picker>';
25-
static description = 'Provides multiple options to choose from, using either a dropdown menu or a dialog.';
25+
static description =
26+
'Provides multiple options to choose from, using either a dropdown menu or a dialog.';
2627

2728
state = {
2829
selected1: 'key1',

‎RNTester/js/RTLExample.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ const BorderExample = withRTLState(({isRTL, setRTL}) => {
373373

374374
class RTLExample extends React.Component<any, State> {
375375
static title = 'RTLExample';
376-
static description = 'Examples to show how to apply components to RTL layout.';
376+
static description =
377+
'Examples to show how to apply components to RTL layout.';
377378

378379
_panResponder: Object;
379380

‎RNTester/js/ScrollViewSimpleExample.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ var NUM_ITEMS = 20;
1818

1919
class ScrollViewSimpleExample extends React.Component<{}> {
2020
static title = '<ScrollView>';
21-
static description = 'Component that enables scrolling through child components.';
21+
static description =
22+
'Component that enables scrolling through child components.';
2223

2324
makeItems = (nItems: number, styles): Array<any> => {
2425
var items = [];

‎RNTester/js/SwipeableListViewExample.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var SwipeableListViewSimpleExample = createReactClass({
9494
<View style={styles.row}>
9595
<Image style={styles.thumb} source={imgSource} />
9696
<Text style={styles.text}>
97-
{rowData.id + ' - ' + LOREM_IPSUM.substr(0, rowHash % 301 + 10)}
97+
{rowData.id + ' - ' + LOREM_IPSUM.substr(0, (rowHash % 301) + 10)}
9898
</Text>
9999
</View>
100100
</View>

‎RNTester/js/ToastAndroidExample.android.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ var RNTesterPage = require('RNTesterPage');
1919

2020
class ToastExample extends React.Component<{}, $FlowFixMeState> {
2121
static title = 'Toast Example';
22-
static description = 'Example that demonstrates the use of an Android Toast to provide feedback.';
22+
static description =
23+
'Example that demonstrates the use of an Android Toast to provide feedback.';
2324
state = {};
2425

2526
render() {

‎RNTester/js/ViewPagerAndroidExample.android.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class ProgressBar extends React.Component {
8181
render() {
8282
var fractionalPosition =
8383
this.props.progress.position + this.props.progress.offset;
84-
var progressBarSize = fractionalPosition / (PAGES - 1) * this.props.size;
84+
var progressBarSize = (fractionalPosition / (PAGES - 1)) * this.props.size;
8585
return (
8686
<View style={[styles.progressBarContainer, {width: this.props.size}]}>
8787
<View style={[styles.progressBar, {width: progressBarSize}]} />
@@ -92,7 +92,8 @@ class ProgressBar extends React.Component {
9292

9393
class ViewPagerAndroidExample extends React.Component {
9494
static title = '<ViewPagerAndroid>';
95-
static description = 'Container that allows to flip left and right between child views.';
95+
static description =
96+
'Container that allows to flip left and right between child views.';
9697

9798
state = {
9899
page: 0,

‎local-cli/bundle/saveAssets.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ function copy(src, dest, callback) {
7575
if (err) {
7676
return callback(err);
7777
}
78-
fs
79-
.createReadStream(src)
78+
fs.createReadStream(src)
8079
.pipe(fs.createWriteStream(dest))
8180
.on('finish', callback);
8281
});

‎local-cli/link/android/patches/makeBuildPatch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ module.exports = function makeBuildPatch(name) {
1818
return {
1919
installPattern,
2020
pattern: /[^ \t]dependencies {(\r\n|\n)/,
21-
patch: ` compile project(':${normalizedProjectName}')\n`
21+
patch: ` compile project(':${normalizedProjectName}')\n`,
2222
};
2323
};

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
"flow-bin": "^0.73.0",
216216
"jest": "23.1.0",
217217
"jest-junit": "4.0.0",
218-
"prettier": "1.12.1",
218+
"prettier": "1.13.4",
219219
"react": "16.3.2",
220220
"react-test-renderer": "16.3.2",
221221
"shelljs": "^0.7.8",

0 commit comments

Comments
 (0)
Please sign in to comment.