Skip to content

Commit cf44650

Browse files
bolinfestfacebook-github-bot
authored andcommitted
Upgrade Prettier from 1.17 to 2.0.2.
Summary: This gets us on the latest Prettier 2.x: https://prettier.io/blog/2020/03/21/2.0.0.html Notably, this adds support for TypeScript 3.8, which introduces new syntax, such as `import type`. Reviewed By: zertosh Differential Revision: D20636268 fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
1 parent 79c69be commit cf44650

File tree

383 files changed

+2051
-2072
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

383 files changed

+2051
-2072
lines changed

IntegrationTests/AccessibilityManagerTest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class AccessibilityManagerTest extends React.Component<{...}> {
3939
accessibilityExtraExtraLarge: 11.0,
4040
accessibilityExtraExtraExtraLarge: 12.0,
4141
});
42-
RCTDeviceEventEmitter.addListener('didUpdateDimensions', update => {
42+
RCTDeviceEventEmitter.addListener('didUpdateDimensions', (update) => {
4343
TestModule.markTestPassed(update.window.fontScale === 4.0);
4444
});
4545
}

IntegrationTests/AsyncStorageTest.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function expectAsyncNoError(place, err) {
6666
}
6767

6868
function testSetAndGet() {
69-
AsyncStorage.setItem(KEY_1, VAL_1, err1 => {
69+
AsyncStorage.setItem(KEY_1, VAL_1, (err1) => {
7070
expectAsyncNoError('testSetAndGet/setItem', err1);
7171
AsyncStorage.getItem(KEY_1, (err2, result) => {
7272
expectAsyncNoError('testSetAndGet/getItem', err2);
@@ -109,7 +109,7 @@ function testRemoveItem() {
109109
'Missing KEY_1 or KEY_2 in ' + '(' + result + ')',
110110
);
111111
updateMessage('testRemoveItem - add two items');
112-
AsyncStorage.removeItem(KEY_1, err2 => {
112+
AsyncStorage.removeItem(KEY_1, (err2) => {
113113
expectAsyncNoError('testRemoveItem/removeItem', err2);
114114
updateMessage('delete successful ');
115115
AsyncStorage.getItem(KEY_1, (err3, result2) => {
@@ -137,9 +137,9 @@ function testRemoveItem() {
137137
}
138138

139139
function testMerge() {
140-
AsyncStorage.setItem(KEY_MERGE, JSON.stringify(VAL_MERGE_1), err1 => {
140+
AsyncStorage.setItem(KEY_MERGE, JSON.stringify(VAL_MERGE_1), (err1) => {
141141
expectAsyncNoError('testMerge/setItem', err1);
142-
AsyncStorage.mergeItem(KEY_MERGE, JSON.stringify(VAL_MERGE_2), err2 => {
142+
AsyncStorage.mergeItem(KEY_MERGE, JSON.stringify(VAL_MERGE_2), (err2) => {
143143
expectAsyncNoError('testMerge/mergeItem', err2);
144144
AsyncStorage.getItem(KEY_MERGE, (err3, result) => {
145145
expectAsyncNoError('testMerge/setItem', err3);
@@ -152,11 +152,14 @@ function testMerge() {
152152
}
153153

154154
function testOptimizedMultiGet() {
155-
let batch = [[KEY_1, VAL_1], [KEY_2, VAL_2]];
155+
let batch = [
156+
[KEY_1, VAL_1],
157+
[KEY_2, VAL_2],
158+
];
156159
let keys = batch.map(([key, value]) => key);
157-
AsyncStorage.multiSet(batch, err1 => {
160+
AsyncStorage.multiSet(batch, (err1) => {
158161
// yes, twice on purpose
159-
[1, 2].forEach(i => {
162+
[1, 2].forEach((i) => {
160163
expectAsyncNoError(`${i} testOptimizedMultiGet/multiSet`, err1);
161164
AsyncStorage.multiGet(keys, (err2, result) => {
162165
expectAsyncNoError(`${i} testOptimizedMultiGet/multiGet`, err2);
@@ -182,7 +185,7 @@ class AsyncStorageTest extends React.Component<{...}, $FlowFixMeState> {
182185
this.setState({done: true}, () => {
183186
TestModule.markTestCompleted();
184187
});
185-
updateMessage = msg => {
188+
updateMessage = (msg) => {
186189
this.setState({messages: this.state.messages.concat('\n' + msg)});
187190
DEBUG && console.log(msg);
188191
};

IntegrationTests/ImageCachePolicyTest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ImageCachePolicyTest extends React.Component<Props, $FlowFixMeState> {
4040
state: $FlowFixMe | {...} = {};
4141

4242
shouldComponentUpdate(nextProps: Props, nextState: State): boolean {
43-
const results: Array<?boolean> = TESTS.map(x => nextState[x]);
43+
const results: Array<?boolean> = TESTS.map((x) => nextState[x]);
4444

4545
if (!results.includes(undefined)) {
4646
const result: boolean = results.reduce(

IntegrationTests/IntegrationTestsApp.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ TESTS.forEach(
4343
/* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This comment
4444
* suppresses an error found when Flow v0.54 was deployed. To see the error
4545
* delete this comment and run Flow. */
46-
test => AppRegistry.registerComponent(test.displayName, () => test),
46+
(test) => AppRegistry.registerComponent(test.displayName, () => test),
4747
);
4848

4949
// Modules required for integration tests
@@ -76,7 +76,7 @@ class IntegrationTestsApp extends React.Component<{...}, $FlowFixMeState> {
7676
</Text>
7777
<View style={styles.separator} />
7878
<ScrollView>
79-
{TESTS.map(test => [
79+
{TESTS.map((test) => [
8080
<TouchableOpacity
8181
onPress={() => this.setState({test})}
8282
/* $FlowFixMe(>=0.115.0 site=react_native_fb) This comment

IntegrationTests/LayoutEventsTest.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -141,21 +141,21 @@ class LayoutEventsTest extends React.Component<Props, State> {
141141
return (
142142
<View style={[styles.container, this.state.containerStyle]}>
143143
<View
144-
ref={ref => {
144+
ref={(ref) => {
145145
this._view = ref;
146146
}}
147147
onLayout={this.onViewLayout}
148148
style={viewStyle}>
149149
<Image
150-
ref={ref => {
150+
ref={(ref) => {
151151
this._img = ref;
152152
}}
153153
onLayout={this.onImageLayout}
154154
style={styles.image}
155155
source={{uri: 'uie_thumb_big.png'}}
156156
/>
157157
<Text
158-
ref={ref => {
158+
ref={(ref) => {
159159
this._txt = ref;
160160
}}
161161
onLayout={this.onTextLayout}

IntegrationTests/LoggingTestModule.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ const warning = require('fbjs/lib/warning');
1515
const invariant = require('invariant');
1616

1717
const LoggingTestModule = {
18-
logToConsole: function(str) {
18+
logToConsole: function (str) {
1919
console.log(str);
2020
},
21-
logToConsoleAfterWait: function(str, timeout_ms) {
22-
setTimeout(function() {
21+
logToConsoleAfterWait: function (str, timeout_ms) {
22+
setTimeout(function () {
2323
console.log(str);
2424
}, timeout_ms);
2525
},
26-
warning: function(str) {
26+
warning: function (str) {
2727
warning(false, str);
2828
},
29-
invariant: function(str) {
29+
invariant: function (str) {
3030
invariant(false, str);
3131
},
32-
logErrorToConsole: function(str) {
32+
logErrorToConsole: function (str) {
3333
console.error(str);
3434
},
35-
throwError: function(str) {
35+
throwError: function (str) {
3636
throw new Error(str);
3737
},
3838
};

IntegrationTests/RCTRootViewIntegrationTestApp.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const TESTS = [
2828
require('./SizeFlexibilityUpdateTest'),
2929
];
3030

31-
TESTS.forEach(test =>
31+
TESTS.forEach((test) =>
3232
AppRegistry.registerComponent(test.displayName, () => test),
3333
);
3434

@@ -54,7 +54,7 @@ class RCTRootViewIntegrationTestApp extends React.Component {
5454
</Text>
5555
<View style={styles.separator} />
5656
<ScrollView>
57-
{TESTS.map(test => [
57+
{TESTS.map((test) => [
5858
<TouchableOpacity
5959
onPress={() => this.setState({test})}
6060
style={styles.row}>

IntegrationTests/SyncMethodTest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SyncMethodTest extends React.Component<{...}> {
2727
throw new Error('Something wrong with methodThatReturnsNil sync method');
2828
}
2929
let response;
30-
RNTesterTestModule.methodThatCallsCallbackWithString('test', echo => {
30+
RNTesterTestModule.methodThatCallsCallbackWithString('test', (echo) => {
3131
response = echo;
3232
});
3333
requestAnimationFrame(() => {

IntegrationTests/TimersTest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class TimersTest extends React.Component<Props, State> {
153153
fails.push(this.setTimeout(() => this._fail('testClearMulti-4'), 0));
154154
fails.push(this.setTimeout(() => this._fail('testClearMulti-5'), 10));
155155

156-
fails.forEach(timeout => this.clearTimeout(timeout));
156+
fails.forEach((timeout) => this.clearTimeout(timeout));
157157
this.setTimeout(() => this.clearTimeout(delayClear), 20);
158158

159159
this.setTimeout(this.testOrdering, 50);

IntegrationTests/WebSocketTest.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class WebSocketTest extends React.Component<{...}, State> {
4545

4646
_waitFor = (condition: any, timeout: any, callback: any) => {
4747
let remaining = timeout;
48-
const timeoutFunction = function() {
48+
const timeoutFunction = function () {
4949
if (condition()) {
5050
callback(true);
5151
return;
@@ -62,7 +62,7 @@ class WebSocketTest extends React.Component<{...}, State> {
6262

6363
_connect = () => {
6464
const socket = new WebSocket(this.state.url);
65-
WS_EVENTS.forEach(ev => socket.addEventListener(ev, this._onSocketEvent));
65+
WS_EVENTS.forEach((ev) => socket.addEventListener(ev, this._onSocketEvent));
6666
this.setState({
6767
socket,
6868
socketState: socket.readyState,
@@ -116,7 +116,7 @@ class WebSocketTest extends React.Component<{...}, State> {
116116

117117
testConnect: () => void = () => {
118118
this._connect();
119-
this._waitFor(this._socketIsConnected, 5, connectSucceeded => {
119+
this._waitFor(this._socketIsConnected, 5, (connectSucceeded) => {
120120
if (!connectSucceeded) {
121121
TestModule.markTestPassed(false);
122122
return;
@@ -127,7 +127,7 @@ class WebSocketTest extends React.Component<{...}, State> {
127127

128128
testSendAndReceive: () => void = () => {
129129
this._sendTestMessage();
130-
this._waitFor(this._receivedTestExpectedResponse, 5, messageReceived => {
130+
this._waitFor(this._receivedTestExpectedResponse, 5, (messageReceived) => {
131131
if (!messageReceived) {
132132
TestModule.markTestPassed(false);
133133
return;
@@ -138,7 +138,7 @@ class WebSocketTest extends React.Component<{...}, State> {
138138

139139
testDisconnect: () => void = () => {
140140
this._disconnect();
141-
this._waitFor(this._socketIsDisconnected, 5, disconnectSucceeded => {
141+
this._waitFor(this._socketIsDisconnected, 5, (disconnectSucceeded) => {
142142
TestModule.markTestPassed(disconnectSucceeded);
143143
});
144144
};

Libraries/Alert/Alert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class Alert {
9797
options && options.onDismiss && options.onDismiss();
9898
}
9999
};
100-
const onError = errorMessage => console.warn(errorMessage);
100+
const onError = (errorMessage) => console.warn(errorMessage);
101101
NativeDialogManagerAndroid.showAlert(config, onError, onAction);
102102
}
103103
}

Libraries/Alert/RCTAlertManager.android.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import NativeDialogManagerAndroid from '../NativeModules/specs/NativeDialogManag
1414
function emptyCallback() {}
1515

1616
module.exports = {
17-
alertWithArgs: function(args, callback) {
17+
alertWithArgs: function (args, callback) {
1818
// TODO(5998984): Polyfill it correctly with DialogManagerAndroid
1919
if (!NativeDialogManagerAndroid) {
2020
return;

Libraries/Animated/release/gulpfile.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var babelOpts = {
4646
}),
4747
};
4848

49-
var buildDist = function(opts) {
49+
var buildDist = function (opts) {
5050
var webpackOpts = {
5151
debug: opts.debug,
5252
externals: {
@@ -80,7 +80,7 @@ var buildDist = function(opts) {
8080
}),
8181
);
8282
}
83-
return webpackStream(webpackOpts, null, function(err, stats) {
83+
return webpackStream(webpackOpts, null, function (err, stats) {
8484
if (err) {
8585
throw new gulpUtil.PluginError('webpack', err);
8686
}
@@ -101,19 +101,19 @@ var paths = {
101101
],
102102
};
103103

104-
gulp.task('clean', function(cb) {
104+
gulp.task('clean', function (cb) {
105105
del([paths.dist, paths.lib], cb);
106106
});
107107

108-
gulp.task('modules', function() {
108+
gulp.task('modules', function () {
109109
return gulp
110110
.src(paths.src, {cwd: '../'})
111111
.pipe(babel(babelOpts))
112112
.pipe(flatten())
113113
.pipe(gulp.dest(paths.lib));
114114
});
115115

116-
gulp.task('dist', ['modules'], function() {
116+
gulp.task('dist', ['modules'], function () {
117117
var distOpts = {
118118
debug: true,
119119
output: 'animated.js',
@@ -130,7 +130,7 @@ gulp.task('dist', ['modules'], function() {
130130
.pipe(gulp.dest(paths.dist));
131131
});
132132

133-
gulp.task('dist:min', ['modules'], function() {
133+
gulp.task('dist:min', ['modules'], function () {
134134
var distOpts = {
135135
debug: false,
136136
output: 'animated.min.js',
@@ -146,10 +146,10 @@ gulp.task('dist:min', ['modules'], function() {
146146
.pipe(gulp.dest(paths.dist));
147147
});
148148

149-
gulp.task('watch', function() {
149+
gulp.task('watch', function () {
150150
gulp.watch(paths.src, ['modules']);
151151
});
152152

153-
gulp.task('default', function(cb) {
153+
gulp.task('default', function (cb) {
154154
runSequence('clean', 'modules', ['dist', 'dist:min'], cb);
155155
});

Libraries/Animated/src/AnimatedEvent.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function attachNativeEvent(
5858

5959
const viewTag = ReactNative.findNodeHandle(viewRef);
6060
if (viewTag != null) {
61-
eventMappings.forEach(mapping => {
61+
eventMappings.forEach((mapping) => {
6262
NativeAnimatedHelper.API.addAnimatedEventToView(
6363
viewTag,
6464
eventName,
@@ -70,7 +70,7 @@ function attachNativeEvent(
7070
return {
7171
detach() {
7272
if (viewTag != null) {
73-
eventMappings.forEach(mapping => {
73+
eventMappings.forEach((mapping) => {
7474
NativeAnimatedHelper.API.removeAnimatedEventFromView(
7575
viewTag,
7676
eventName,
@@ -155,7 +155,9 @@ class AnimatedEvent {
155155
}
156156

157157
__removeListener(callback: Function): void {
158-
this._listeners = this._listeners.filter(listener => listener !== callback);
158+
this._listeners = this._listeners.filter(
159+
(listener) => listener !== callback,
160+
);
159161
}
160162

161163
__attach(viewRef: any, eventName: string) {
@@ -226,7 +228,7 @@ class AnimatedEvent {
226228
}
227229

228230
_callListeners(...args: any) {
229-
this._listeners.forEach(listener => listener(...args));
231+
this._listeners.forEach((listener) => listener(...args));
230232
}
231233
}
232234

0 commit comments

Comments
 (0)