Skip to content

Commit 183f96f

Browse files
author
Brian Vaughn
committed
Prettier
1 parent edc46d7 commit 183f96f

File tree

173 files changed

+3253
-3133
lines changed

Some content is hidden

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

173 files changed

+3253
-3133
lines changed

fixtures/devtools/regression/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const http = require('http');
55
const serveStatic = require('serve-static');
66

77
// Serve fixtures folder
8-
const serve = serveStatic(__dirname, { index: 'index.html' });
8+
const serve = serveStatic(__dirname, {index: 'index.html'});
99

1010
// Create server
1111
const server = http.createServer(function onRequest(req, res) {

fixtures/devtools/regression/shared.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const minor =
1010
pieces[0] === '0' ? parseInt(pieces[2], 10) : parseInt(pieces[1], 10);
1111

1212
// Convenience wrapper to organize API features in DevTools.
13-
function Feature({ children, label, version }) {
13+
function Feature({children, label, version}) {
1414
return (
1515
<div className="Feature">
1616
<div className="FeatureHeader">
@@ -60,10 +60,10 @@ switch (major) {
6060
}
6161
case 6:
6262
// memo
63-
function LabelComponent({ label }) {
63+
function LabelComponent({label}) {
6464
return <label>{label}</label>;
6565
}
66-
const AnonymousMemoized = React.memo(({ label }) => (
66+
const AnonymousMemoized = React.memo(({label}) => (
6767
<label>{label}</label>
6868
));
6969
const Memoized = React.memo(LabelComponent);
@@ -91,8 +91,8 @@ switch (major) {
9191
getResourceKey
9292
);
9393
class Suspending extends React.Component {
94-
state = { useSuspense: false };
95-
useSuspense = () => this.setState({ useSuspense: true });
94+
state = {useSuspense: false};
95+
useSuspense = () => this.setState({useSuspense: true});
9696
render() {
9797
if (this.state.useSuspense) {
9898
const text = Resource.read(['loaded', 2000]);
@@ -141,9 +141,9 @@ switch (major) {
141141
case 4:
142142
// unstable_Profiler
143143
class ProfilerChild extends React.Component {
144-
state = { count: 0 };
144+
state = {count: 0};
145145
incrementCount = () =>
146-
this.setState(prevState => ({ count: prevState.count + 1 }));
146+
this.setState(prevState => ({count: prevState.count + 1}));
147147
render() {
148148
return (
149149
<div>
@@ -159,8 +159,7 @@ switch (major) {
159159
<Feature
160160
key="unstable_Profiler"
161161
label="unstable_Profiler"
162-
version="16.4+"
163-
>
162+
version="16.4+">
164163
<Profiler id="count" onRender={onRender}>
165164
<div>
166165
<ProfilerChild />
@@ -230,8 +229,7 @@ switch (major) {
230229
<Feature
231230
key="AsyncMode/ConcurrentMode"
232231
label="AsyncMode/ConcurrentMode"
233-
version="16.3+"
234-
>
232+
version="16.3+">
235233
<ConcurrentMode>
236234
<div>
237235
unstable_AsyncMode was added in 16.3, renamed to
@@ -271,13 +269,13 @@ function Even() {
271269

272270
// Simple stateful app shared by all React versions
273271
class SimpleApp extends React.Component {
274-
state = { count: 0 };
272+
state = {count: 0};
275273
incrementCount = () => {
276-
const updaterFn = prevState => ({ count: prevState.count + 1 });
274+
const updaterFn = prevState => ({count: prevState.count + 1});
277275
trace('Updating count', performance.now(), () => this.setState(updaterFn));
278276
};
279277
render() {
280-
const { count } = this.state;
278+
const {count} = this.state;
281279
return (
282280
<div>
283281
{count % 2 === 0 ? (
@@ -299,7 +297,7 @@ apps.push(
299297
);
300298

301299
// This component, with the version prop, helps organize DevTools at a glance.
302-
function TopLevelWrapperForDevTools({ version }) {
300+
function TopLevelWrapperForDevTools({version}) {
303301
let header = <h1>React {version}</h1>;
304302
if (version.includes('canary')) {
305303
const commitSha = version.match(/.+canary-(.+)/)[1];

fixtures/devtools/shell/app/DeeplyNestedComponents/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22

3-
import React, { Fragment } from 'react';
3+
import React, {Fragment} from 'react';
44

55
function wrapWithHoc(Component, index) {
66
function HOC() {

fixtures/devtools/shell/app/EditableProps/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ import React, {
1313
useState,
1414
} from 'react';
1515

16-
const initialData = { foo: 'FOO', bar: 'BAR' };
16+
const initialData = {foo: 'FOO', bar: 'BAR'};
1717

1818
function reducer(state, action) {
1919
switch (action.type) {
2020
case 'swap':
21-
return { foo: state.bar, bar: state.foo };
21+
return {foo: state.bar, bar: state.foo};
2222
default:
2323
throw new Error();
2424
}
2525
}
2626

27-
type StatefulFunctionProps = {| name: string |};
27+
type StatefulFunctionProps = {|name: string|};
2828

29-
function StatefulFunction({ name }: StatefulFunctionProps) {
29+
function StatefulFunction({name}: StatefulFunctionProps) {
3030
const [count, updateCount] = useState(0);
3131
const debouncedCount = useDebounce(count, 1000);
3232
const handleUpdateCountClick = useCallback(() => updateCount(count + 1), [
@@ -35,7 +35,7 @@ function StatefulFunction({ name }: StatefulFunctionProps) {
3535

3636
const [data, dispatch] = useReducer(reducer, initialData);
3737
const handleUpdateReducerClick = useCallback(
38-
() => dispatch({ type: 'swap' }),
38+
() => dispatch({type: 'swap'}),
3939
[]
4040
);
4141

@@ -60,8 +60,8 @@ function StatefulFunction({ name }: StatefulFunctionProps) {
6060
const BoolContext = createContext(true);
6161
BoolContext.displayName = 'BoolContext';
6262

63-
type Props = {| name: string, toggle: boolean |};
64-
type State = {| cities: Array<string>, state: string |};
63+
type Props = {|name: string, toggle: boolean|};
64+
type State = {|cities: Array<string>, state: string|};
6565

6666
class StatefulClass extends Component<Props, State> {
6767
static contextType = BoolContext;
@@ -71,7 +71,7 @@ class StatefulClass extends Component<Props, State> {
7171
state: 'California',
7272
};
7373

74-
handleChange = ({ target }) =>
74+
handleChange = ({target}) =>
7575
this.setState({
7676
state: target.value,
7777
});
@@ -94,8 +94,8 @@ class StatefulClass extends Component<Props, State> {
9494
const MemoizedStatefulClass = memo(StatefulClass);
9595
const MemoizedStatefulFunction = memo(StatefulFunction);
9696

97-
const ForwardRef = forwardRef<{| name: string |}, HTMLUListElement>(
98-
({ name }, ref) => {
97+
const ForwardRef = forwardRef<{|name: string|}, HTMLUListElement>(
98+
({name}, ref) => {
9999
const [count, updateCount] = useState(0);
100100
const debouncedCount = useDebounce(count, 1000);
101101
const handleUpdateCountClick = useCallback(() => updateCount(count + 1), [

fixtures/devtools/shell/app/Hydration/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22

3-
import React, { Fragment, useDebugValue, useState } from 'react';
3+
import React, {Fragment, useDebugValue, useState} from 'react';
44

55
const div = document.createElement('div');
66
const exmapleFunction = () => {};
@@ -110,7 +110,7 @@ export default function Hydration() {
110110
);
111111
}
112112

113-
function DehydratableProps({ array, object }: any) {
113+
function DehydratableProps({array, object}: any) {
114114
return (
115115
<ul>
116116
<li>array: {JSON.stringify(array, null, 2)}</li>

fixtures/devtools/shell/app/Iframe/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @flow */
22

3-
import React, { Fragment } from 'react';
3+
import React, {Fragment} from 'react';
44
import ReactDOM from 'react-dom';
55

66
export default function Iframe() {
@@ -16,7 +16,7 @@ export default function Iframe() {
1616
);
1717
}
1818

19-
const iframeStyle = { border: '2px solid #eee', height: 80 };
19+
const iframeStyle = {border: '2px solid #eee', height: 80};
2020

2121
function Frame(props) {
2222
const [element, setElement] = React.useState(null);

fixtures/devtools/shell/app/InspectableElements/Contexts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22

3-
import React, { createContext, Component, Fragment, useContext } from 'react';
3+
import React, {createContext, Component, Fragment, useContext} from 'react';
44
import PropTypes from 'prop-types';
55

66
function someNamedFunction() {}
@@ -10,7 +10,7 @@ const contextData = {
1010
bool: true,
1111
func: someNamedFunction,
1212
number: 123,
13-
object: { outer: { inner: {} } },
13+
object: {outer: {inner: {}}},
1414
string: 'abc',
1515
symbol: Symbol.for('symbol'),
1616
null: null,

fixtures/devtools/shell/app/InspectableElements/CustomHooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const object = {
1717
null: null,
1818
undefined: undefined,
1919
array: ['a', 'b', 'c'],
20-
object: { foo: 1, bar: 2, baz: 3 },
20+
object: {foo: 1, bar: 2, baz: 3},
2121
};
2222

2323
function useNestedInnerHook() {

fixtures/devtools/shell/app/InspectableElements/InspectableElements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22

3-
import React, { Fragment } from 'react';
3+
import React, {Fragment} from 'react';
44
import Contexts from './Contexts';
55
import CustomHooks from './CustomHooks';
66
import CustomObject from './CustomObject';

fixtures/devtools/shell/app/InspectableElements/NestedProps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function ObjectProps() {
2222
}}
2323
array={['first', 'second', 'third']}
2424
objectInArray={[object]}
25-
arrayInObject={{ array: ['first', 'second', 'third'] }}
25+
arrayInObject={{array: ['first', 'second', 'third']}}
2626
deepObject={{
2727
// Known limitation: we won't go deeper than several levels.
2828
// In the future, we might offer a way to request deeper access on demand.

fixtures/devtools/shell/app/InteractionTracing/index.js

Lines changed: 53 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @flow
22

3-
import React, { Fragment, useCallback, useEffect, useState } from 'react';
4-
import { unstable_batchedUpdates as batchedUpdates } from 'react-dom';
3+
import React, {Fragment, useCallback, useEffect, useState} from 'react';
4+
import {unstable_batchedUpdates as batchedUpdates} from 'react-dom';
55
import {
66
unstable_trace as trace,
77
unstable_wrap as wrap,
@@ -11,54 +11,66 @@ export default function InteractionTracing() {
1111
const [count, setCount] = useState(0);
1212
const [shouldCascade, setShouldCascade] = useState(false);
1313

14-
const handleUpdate = useCallback(() => {
15-
trace('count', performance.now(), () => {
16-
setTimeout(
17-
wrap(() => {
18-
setCount(count + 1);
19-
}),
20-
count * 100
21-
);
22-
});
23-
}, [count]);
24-
25-
const handleCascadingUpdate = useCallback(() => {
26-
trace('cascade', performance.now(), () => {
27-
setTimeout(
28-
wrap(() => {
29-
batchedUpdates(() => {
14+
const handleUpdate = useCallback(
15+
() => {
16+
trace('count', performance.now(), () => {
17+
setTimeout(
18+
wrap(() => {
3019
setCount(count + 1);
31-
setShouldCascade(true);
32-
});
33-
}),
34-
count * 100
35-
);
36-
});
37-
}, [count]);
20+
}),
21+
count * 100
22+
);
23+
});
24+
},
25+
[count]
26+
);
3827

39-
const handleMultiple = useCallback(() => {
40-
trace('first', performance.now(), () => {
41-
trace('second', performance.now(), () => {
28+
const handleCascadingUpdate = useCallback(
29+
() => {
30+
trace('cascade', performance.now(), () => {
4231
setTimeout(
4332
wrap(() => {
44-
setCount(count + 1);
33+
batchedUpdates(() => {
34+
setCount(count + 1);
35+
setShouldCascade(true);
36+
});
4537
}),
4638
count * 100
4739
);
4840
});
49-
});
50-
}, [count]);
41+
},
42+
[count]
43+
);
5144

52-
useEffect(() => {
53-
if (shouldCascade) {
54-
setTimeout(
55-
wrap(() => {
56-
setShouldCascade(false);
57-
}),
58-
count * 100
59-
);
60-
}
61-
}, [count, shouldCascade]);
45+
const handleMultiple = useCallback(
46+
() => {
47+
trace('first', performance.now(), () => {
48+
trace('second', performance.now(), () => {
49+
setTimeout(
50+
wrap(() => {
51+
setCount(count + 1);
52+
}),
53+
count * 100
54+
);
55+
});
56+
});
57+
},
58+
[count]
59+
);
60+
61+
useEffect(
62+
() => {
63+
if (shouldCascade) {
64+
setTimeout(
65+
wrap(() => {
66+
setShouldCascade(false);
67+
}),
68+
count * 100
69+
);
70+
}
71+
},
72+
[count, shouldCascade]
73+
);
6274

6375
return (
6476
<Fragment>

fixtures/devtools/shell/app/PriorityLevels/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22

3-
import React, { Fragment, useCallback, useState } from 'react';
3+
import React, {Fragment, useCallback, useState} from 'react';
44
import {
55
unstable_IdlePriority as IdlePriority,
66
unstable_LowPriority as LowPriority,

fixtures/devtools/shell/app/ReactNativeWeb/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @flow
22

3-
import React, { Fragment, useState } from 'react';
4-
import { Button, Text, View } from 'react-native-web';
3+
import React, {Fragment, useState} from 'react';
4+
import {Button, Text, View} from 'react-native-web';
55

66
export default function ReactNativeWeb() {
77
const [backgroundColor, setBackgroundColor] = useState('blue');
@@ -17,13 +17,13 @@ export default function ReactNativeWeb() {
1717
'\u0623\u062D\u0628 \u0627\u0644\u0644\u063A\u0629 \u0627\u0644\u0639\u0631\u0628\u064A\u0629 auto (default) - arabic RTL'
1818
}
1919
</Text>
20-
<Text style={{ textAlign: 'left' }}>
20+
<Text style={{textAlign: 'left'}}>
2121
left left left left left left left left left left left left left left
2222
left
2323
</Text>
2424
<Button
2525
onPress={toggleColor}
26-
style={{ backgroundColor }}
26+
style={{backgroundColor}}
2727
title={`Switch background color to "${
2828
backgroundColor === 'purple' ? 'green' : 'purple'
2929
}"`}

0 commit comments

Comments
 (0)