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
This commit is contained in:
Peter van der Zee 2018-06-06 05:20:40 -07:00 committed by Facebook Github Bot
parent 3a1d949906
commit 29fb2a8e90
37 changed files with 88 additions and 55 deletions

View File

@ -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++;
}
@ -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);

View File

@ -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);
}
/**
@ -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);
}
/**

View File

@ -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));

View File

@ -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);

View File

@ -266,7 +266,7 @@ 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
@ -274,7 +274,7 @@ class SpringAnimation extends Animation {
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) -

View File

@ -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

View File

@ -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
);
}

View File

@ -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 {

View File

@ -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}
@ -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>
@ -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}

View File

@ -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 &&

View File

@ -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 (

View File

@ -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,

View File

@ -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) {

View File

@ -457,7 +457,7 @@ class ItemWithSeparator extends React.Component<
static getDerivedStateFromProps(
props: ItemWithSeparatorProps,
prevState: ItemWithSeparatorState,
): ?ItemWithSeparatorState {
): ?ItemWithSeparatorState {
return {
separatorProps: {
...prevState.separatorProps,

View File

@ -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>

View File

@ -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 {

View File

@ -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 {

View File

@ -13,7 +13,7 @@
const MatrixMath = require('MatrixMath');
function degreesToRadians(degrees) {
return degrees * Math.PI / 180;
return (degrees * Math.PI) / 180;
}
function convertZeroes(degrees) {

View File

@ -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 {

View File

@ -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 (

View File

@ -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 {

View File

@ -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 = {

View File

@ -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,
),
})
}

View File

@ -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 (

View File

@ -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',

View File

@ -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,
});

View File

@ -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>

View File

@ -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,

View File

@ -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',

View File

@ -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;

View File

@ -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 = [];

View File

@ -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>

View File

@ -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() {

View File

@ -81,7 +81,7 @@ class ProgressBar extends React.Component {
render() {
var fractionalPosition =
this.props.progress.position + this.props.progress.offset;
var progressBarSize = fractionalPosition / (PAGES - 1) * this.props.size;
var progressBarSize = (fractionalPosition / (PAGES - 1)) * this.props.size;
return (
<View style={[styles.progressBarContainer, {width: this.props.size}]}>
<View style={[styles.progressBar, {width: progressBarSize}]} />
@ -92,7 +92,8 @@ class ProgressBar extends React.Component {
class ViewPagerAndroidExample extends React.Component {
static title = '<ViewPagerAndroid>';
static description = 'Container that allows to flip left and right between child views.';
static description =
'Container that allows to flip left and right between child views.';
state = {
page: 0,

View File

@ -75,8 +75,7 @@ function copy(src, dest, callback) {
if (err) {
return callback(err);
}
fs
.createReadStream(src)
fs.createReadStream(src)
.pipe(fs.createWriteStream(dest))
.on('finish', callback);
});

View File

@ -18,6 +18,6 @@ module.exports = function makeBuildPatch(name) {
return {
installPattern,
pattern: /[^ \t]dependencies {(\r\n|\n)/,
patch: ` compile project(':${normalizedProjectName}')\n`
patch: ` compile project(':${normalizedProjectName}')\n`,
};
};

View File

@ -215,7 +215,7 @@
"flow-bin": "^0.73.0",
"jest": "23.1.0",
"jest-junit": "4.0.0",
"prettier": "1.12.1",
"prettier": "1.13.4",
"react": "16.3.2",
"react-test-renderer": "16.3.2",
"shelljs": "^0.7.8",