Skip to content

Commit

Permalink
Bump Prettier to 1.13.4 on xplat
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Peter van der Zee authored and facebook-github-bot committed Jun 6, 2018
1 parent 3a1d949 commit 29fb2a8
Show file tree
Hide file tree
Showing 37 changed files with 88 additions and 55 deletions.
4 changes: 2 additions & 2 deletions Libraries/ART/ReactNativeART.js
Expand Up @@ -297,7 +297,7 @@ function insertOffsetsIntoArray(stops, targetArray, atIndex, multi, reverse) {
let i = 0;
if ('length' in stops) {
while (i < stops.length) {
offsetNumber = i / (stops.length - 1) * multi;
offsetNumber = (i / (stops.length - 1)) * multi;
targetArray[atIndex + i] = reverse ? 1 - offsetNumber : offsetNumber;
i++;
}
Expand Down Expand Up @@ -530,7 +530,7 @@ function LinearGradient(stops, x1, y1, x2, y2) {
const type = LINEAR_GRADIENT;

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

let x = Math.cos(angle);
let y = -Math.sin(angle);
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Animated/src/Easing.js
Expand Up @@ -131,7 +131,7 @@ class Easing {
* http://easings.net/#easeInSine
*/
static sin(t: number) {
return 1 - Math.cos(t * Math.PI / 2);
return 1 - Math.cos((t * Math.PI) / 2);
}

/**
Expand Down Expand Up @@ -164,7 +164,7 @@ class Easing {
*/
static elastic(bounciness: number = 1): (t: number) => number {
const p = bounciness * Math.PI;
return t => 1 - Math.pow(Math.cos(t * Math.PI / 2), 3) * Math.cos(t * p);
return t => 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/src/__tests__/Easing-test.js
Expand Up @@ -81,7 +81,7 @@ describe('Easing', () => {

function sampleEasingFunction(easing) {
const DURATION = 300;
const tickCount = Math.round(DURATION * 60 / 1000);
const tickCount = Math.round((DURATION * 60) / 1000);
const samples = [];
for (let i = 0; i <= tickCount; i++) {
samples.push(easing(i / tickCount));
Expand Down
3 changes: 1 addition & 2 deletions Libraries/Animated/src/animations/DecayAnimation.js
Expand Up @@ -81,8 +81,7 @@ class DecayAnimation extends Animation {

const value =
this._fromValue +
this._velocity /
(1 - this._deceleration) *
(this._velocity / (1 - this._deceleration)) *
(1 - Math.exp(-(1 - this._deceleration) * (now - this._startTime)));

this._onUpdate(value);
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Animated/src/animations/SpringAnimation.js
Expand Up @@ -266,15 +266,15 @@ class SpringAnimation extends Animation {
position =
this._toValue -
envelope *
((v0 + zeta * omega0 * x0) / omega1 * Math.sin(omega1 * t) +
(((v0 + zeta * omega0 * x0) / omega1) * Math.sin(omega1 * t) +
x0 * Math.cos(omega1 * t));
// This looks crazy -- it's actually just the derivative of the
// oscillation function
velocity =
zeta *
omega0 *
envelope *
(Math.sin(omega1 * t) * (v0 + zeta * omega0 * x0) / omega1 +
((Math.sin(omega1 * t) * (v0 + zeta * omega0 * x0)) / omega1 +
x0 * Math.cos(omega1 * t)) -
envelope *
(Math.cos(omega1 * t) * (v0 + zeta * omega0 * x0) -
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/src/nodes/AnimatedInterpolation.js
Expand Up @@ -358,7 +358,7 @@ class AnimatedInterpolation extends AnimatedWithChildren {
}
if (/deg$/.test(value)) {
const degrees = parseFloat(value) || 0;
const radians = degrees * Math.PI / 180.0;
const radians = (degrees * Math.PI) / 180.0;
return radians;
} else {
// Assume radians
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/src/nodes/AnimatedModulo.js
Expand Up @@ -32,7 +32,7 @@ class AnimatedModulo extends AnimatedWithChildren {

__getValue(): number {
return (
(this._a.__getValue() % this._modulus + this._modulus) % this._modulus
((this._a.__getValue() % this._modulus) + this._modulus) % this._modulus
);
}

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Color/normalizeColor.js
Expand Up @@ -188,7 +188,7 @@ function parse255(str: string): number {

function parse360(str: string): number {
const int = parseFloat(str);
return ((int % 360 + 360) % 360) / 360;
return (((int % 360) + 360) % 360) / 360;
}

function parse1(str: string): number {
Expand Down
19 changes: 14 additions & 5 deletions Libraries/Components/Keyboard/KeyboardAvoidingView.js
Expand Up @@ -171,7 +171,10 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
return (
<View
ref={viewRef}
style={StyleSheet.compose(style, heightStyle)}
style={StyleSheet.compose(
style,
heightStyle,
)}
onLayout={this._onLayout}
{...props}>
{children}
Expand All @@ -186,9 +189,12 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
onLayout={this._onLayout}
{...props}>
<View
style={StyleSheet.compose(contentContainerStyle, {
bottom: bottomHeight,
})}>
style={StyleSheet.compose(
contentContainerStyle,
{
bottom: bottomHeight,
},
)}>
{children}
</View>
</View>
Expand All @@ -198,7 +204,10 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
return (
<View
ref={viewRef}
style={StyleSheet.compose(style, {paddingBottom: bottomHeight})}
style={StyleSheet.compose(
style,
{paddingBottom: bottomHeight},
)}
onLayout={this._onLayout}
{...props}>
{children}
Expand Down
5 changes: 4 additions & 1 deletion Libraries/Components/Slider/Slider.js
Expand Up @@ -199,7 +199,10 @@ const Slider = (
forwardedRef?: ?React.Ref<'RCTActivityIndicatorView'>,
|}>,
) => {
const style = StyleSheet.compose(styles.slider, props.style);
const style = StyleSheet.compose(
styles.slider,
props.style,
);

const onValueChange =
props.onValueChange &&
Expand Down
5 changes: 4 additions & 1 deletion Libraries/Components/Switch/Switch.js
Expand Up @@ -134,7 +134,10 @@ class Switch extends React.Component<Props> {
: this.props.tintColor,
}
: {
style: StyleSheet.compose(styles.rctSwitchIOS, this.props.style),
style: StyleSheet.compose(
styles.rctSwitchIOS,
this.props.style,
),
};

return (
Expand Down
6 changes: 5 additions & 1 deletion Libraries/Lists/FlatList.js
Expand Up @@ -614,7 +614,11 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
'Expected array of items with numColumns > 1',
);
return (
<View style={StyleSheet.compose(styles.row, columnWrapperStyle)}>
<View
style={StyleSheet.compose(
styles.row,
columnWrapperStyle,
)}>
{item.map((it, kk) => {
const element = renderItem({
item: it,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Lists/VirtualizedList.js
Expand Up @@ -1369,7 +1369,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.63 was deployed. To see the error delete
* this comment and run Flow. */
this.props.onEndReachedThreshold * visibleLength / 2;
(this.props.onEndReachedThreshold * visibleLength) / 2;
// Mark as high priority if we're close to the start of the first item
// But only if there are items before the first rendered item
if (first > 0) {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Lists/VirtualizedSectionList.js
Expand Up @@ -457,7 +457,7 @@ class ItemWithSeparator extends React.Component<
static getDerivedStateFromProps(
props: ItemWithSeparatorProps,
prevState: ItemWithSeparatorState,
): ?ItemWithSeparatorState {
): ?ItemWithSeparatorState {
return {
separatorProps: {
...prevState.separatorProps,
Expand Down
15 changes: 8 additions & 7 deletions Libraries/ReactNative/YellowBox.js
Expand Up @@ -424,13 +424,14 @@ class YellowBox extends React.Component<
];
return (
<View style={inspector ? styles.fullScreen : listStyle}>
{!inspector && rows.length > 0 && (
<TouchableHighlight
style={styles.dismissAllContainer}
onPress={() => this.dismissWarning(null)}>
<Text style={styles.dismissAll}>Dismiss All</Text>
</TouchableHighlight>
)}
{!inspector &&
rows.length > 0 && (
<TouchableHighlight
style={styles.dismissAllContainer}
onPress={() => this.dismissWarning(null)}>
<Text style={styles.dismissAll}>Dismiss All</Text>
</TouchableHighlight>
)}
<ScrollView style={listStyle} scrollsToTop={false}>
{rows}
</ScrollView>
Expand Down
2 changes: 1 addition & 1 deletion Libraries/StyleSheet/processTransform.js
Expand Up @@ -133,7 +133,7 @@ function _multiplyTransform(
*/
function _convertToRadians(value: string): number {
const floatValue = parseFloat(value);
return value.indexOf('rad') > -1 ? floatValue : floatValue * Math.PI / 180;
return value.indexOf('rad') > -1 ? floatValue : (floatValue * Math.PI) / 180;
}

function _validateTransforms(transform: Array<Object>): void {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Utilities/MatrixMath.js
Expand Up @@ -719,7 +719,7 @@ const MatrixMath = {
0,
0,
MatrixMath.roundTo3Places(
Math.atan2(row[0][1], row[0][0]) * 180 / Math.PI,
(Math.atan2(row[0][1], row[0][0]) * 180) / Math.PI,
),
];
} else {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Utilities/__tests__/MatrixMath-test.js
Expand Up @@ -13,7 +13,7 @@
const MatrixMath = require('MatrixMath');

function degreesToRadians(degrees) {
return degrees * Math.PI / 180;
return (degrees * Math.PI) / 180;
}

function convertZeroes(degrees) {
Expand Down
7 changes: 6 additions & 1 deletion Libraries/WebSocket/WebSocket.js
Expand Up @@ -145,7 +145,12 @@ class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) {
this._eventEmitter = new NativeEventEmitter(WebSocketModule);
this._socketId = nextWebSocketId++;
this._registerEvents();
WebSocketModule.connect(url, protocols, {headers}, this._socketId);
WebSocketModule.connect(
url,
protocols,
{headers},
this._socketId,
);
}

get binaryType(): ?BinaryType {
Expand Down
5 changes: 3 additions & 2 deletions RNTester/js/AlertExample.js
Expand Up @@ -121,8 +121,9 @@ class SimpleAlertExampleBlock extends React.Component {
class AlertExample extends React.Component {
static title = 'Alert';

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

render() {
return (
Expand Down
5 changes: 3 additions & 2 deletions RNTester/js/AnimatedGratuitousApp/AnExApp.js
Expand Up @@ -193,8 +193,9 @@ class Circle extends React.Component<any, any> {

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

_onMove: (position: Point) => void;
constructor(props: any): void {
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/DatePickerIOSExample.js
Expand Up @@ -20,7 +20,7 @@ class DatePickerExample extends React.Component<
> {
static defaultProps = {
date: new Date(),
timeZoneOffsetInHours: -1 * new Date().getTimezoneOffset() / 60,
timeZoneOffsetInHours: (-1 * new Date().getTimezoneOffset()) / 60,
};

state = {
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/ImageExample.js
Expand Up @@ -158,7 +158,7 @@ var NetworkImageExample = createReactClass({
onProgress={e =>
this.setState({
progress: Math.round(
100 * e.nativeEvent.loaded / e.nativeEvent.total,
(100 * e.nativeEvent.loaded) / e.nativeEvent.total,
),
})
}
Expand Down
3 changes: 2 additions & 1 deletion RNTester/js/InputAccessoryViewExample.js
Expand Up @@ -60,7 +60,8 @@ class TextInputBar extends React.PureComponent<*, *> {

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

render() {
return (
Expand Down
3 changes: 2 additions & 1 deletion RNTester/js/KeyboardAvoidingViewExample.js
Expand Up @@ -27,7 +27,8 @@ const RNTesterPage = require('./RNTesterPage');

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

state = {
behavior: 'padding',
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/ListExampleShared.js
Expand Up @@ -38,7 +38,7 @@ function genItemData(count: number, start: number = 0): Array<Item> {
const itemHash = Math.abs(hashCode('Item ' + ii));
dataBlob.push({
title: 'Item ' + ii,
text: LOREM_IPSUM.substr(0, itemHash % 301 + 20),
text: LOREM_IPSUM.substr(0, (itemHash % 301) + 20),
key: String(ii),
pressed: false,
});
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/ListViewExample.js
Expand Up @@ -70,7 +70,7 @@ var ListViewSimpleExample = createReactClass({
<View style={styles.row}>
<Image style={styles.thumb} source={imgSource} />
<Text style={styles.text}>
{rowData + ' - ' + LOREM_IPSUM.substr(0, rowHash % 301 + 10)}
{rowData + ' - ' + LOREM_IPSUM.substr(0, (rowHash % 301) + 10)}
</Text>
</View>
</View>
Expand Down
3 changes: 2 additions & 1 deletion RNTester/js/MaskedViewExample.js
Expand Up @@ -24,7 +24,8 @@ const {

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

state = {
alternateChildren: true,
Expand Down
3 changes: 2 additions & 1 deletion RNTester/js/PickerExample.js
Expand Up @@ -22,7 +22,8 @@ const Item = Picker.Item;

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

state = {
selected1: 'key1',
Expand Down
3 changes: 2 additions & 1 deletion RNTester/js/RTLExample.js
Expand Up @@ -373,7 +373,8 @@ const BorderExample = withRTLState(({isRTL, setRTL}) => {

class RTLExample extends React.Component<any, State> {
static title = 'RTLExample';
static description = 'Examples to show how to apply components to RTL layout.';
static description =
'Examples to show how to apply components to RTL layout.';

_panResponder: Object;

Expand Down
3 changes: 2 additions & 1 deletion RNTester/js/ScrollViewSimpleExample.js
Expand Up @@ -18,7 +18,8 @@ var NUM_ITEMS = 20;

class ScrollViewSimpleExample extends React.Component<{}> {
static title = '<ScrollView>';
static description = 'Component that enables scrolling through child components.';
static description =
'Component that enables scrolling through child components.';

makeItems = (nItems: number, styles): Array<any> => {
var items = [];
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/SwipeableListViewExample.js
Expand Up @@ -94,7 +94,7 @@ var SwipeableListViewSimpleExample = createReactClass({
<View style={styles.row}>
<Image style={styles.thumb} source={imgSource} />
<Text style={styles.text}>
{rowData.id + ' - ' + LOREM_IPSUM.substr(0, rowHash % 301 + 10)}
{rowData.id + ' - ' + LOREM_IPSUM.substr(0, (rowHash % 301) + 10)}
</Text>
</View>
</View>
Expand Down
3 changes: 2 additions & 1 deletion RNTester/js/ToastAndroidExample.android.js
Expand Up @@ -19,7 +19,8 @@ var RNTesterPage = require('RNTesterPage');

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

render() {
Expand Down

0 comments on commit 29fb2a8

Please sign in to comment.