GeezerVison is showing github.com — Prettier · react/react@183f96f
File treeExpand file treeCollapse file tree Open diff view settings react-devtools-extensions react-devtools-shared/src
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: fixtures/devtools/regression/server.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ const http = require('http'); | 5 | 5 | const serveStatic = require('serve-static'); | 6 | 6 |
| 7 | 7 | // Serve fixtures folder | 8 | | -const serve = serveStatic(__dirname, { index: 'index.html' }); | | 8 | +const serve = serveStatic(__dirname, {index: 'index.html'}); | 9 | 9 |
| 10 | 10 | // Create server | 11 | 11 | const server = http.createServer(function onRequest(req, res) { | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/devtools/regression/shared.js +13-15Lines changed: 13 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,7 @@ const minor = | 10 | 10 | pieces[0] === '0' ? parseInt(pieces[2], 10) : parseInt(pieces[1], 10); | 11 | 11 |
| 12 | 12 | // Convenience wrapper to organize API features in DevTools. | 13 | | -function Feature({ children, label, version }) { | | 13 | +function Feature({children, label, version}) { | 14 | 14 | return ( | 15 | 15 | <div className="Feature"> | 16 | 16 | <div className="FeatureHeader"> | @@ -60,10 +60,10 @@ switch (major) { | 60 | 60 | } | 61 | 61 | case 6: | 62 | 62 | // memo | 63 | | - function LabelComponent({ label }) { | | 63 | + function LabelComponent({label}) { | 64 | 64 | return <label>{label}</label>; | 65 | 65 | } | 66 | | - const AnonymousMemoized = React.memo(({ label }) => ( | | 66 | + const AnonymousMemoized = React.memo(({label}) => ( | 67 | 67 | <label>{label}</label> | 68 | 68 | )); | 69 | 69 | const Memoized = React.memo(LabelComponent); | @@ -91,8 +91,8 @@ switch (major) { | 91 | 91 | getResourceKey | 92 | 92 | ); | 93 | 93 | 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}); | 96 | 96 | render() { | 97 | 97 | if (this.state.useSuspense) { | 98 | 98 | const text = Resource.read(['loaded', 2000]); | @@ -141,9 +141,9 @@ switch (major) { | 141 | 141 | case 4: | 142 | 142 | // unstable_Profiler | 143 | 143 | class ProfilerChild extends React.Component { | 144 | | - state = { count: 0 }; | | 144 | + state = {count: 0}; | 145 | 145 | incrementCount = () => | 146 | | - this.setState(prevState => ({ count: prevState.count + 1 })); | | 146 | + this.setState(prevState => ({count: prevState.count + 1})); | 147 | 147 | render() { | 148 | 148 | return ( | 149 | 149 | <div> | @@ -159,8 +159,7 @@ switch (major) { | 159 | 159 | <Feature | 160 | 160 | key="unstable_Profiler" | 161 | 161 | label="unstable_Profiler" | 162 | | - version="16.4+" | 163 | | - > | | 162 | + version="16.4+"> | 164 | 163 | <Profiler id="count" onRender={onRender}> | 165 | 164 | <div> | 166 | 165 | <ProfilerChild /> | @@ -230,8 +229,7 @@ switch (major) { | 230 | 229 | <Feature | 231 | 230 | key="AsyncMode/ConcurrentMode" | 232 | 231 | label="AsyncMode/ConcurrentMode" | 233 | | - version="16.3+" | 234 | | - > | | 232 | + version="16.3+"> | 235 | 233 | <ConcurrentMode> | 236 | 234 | <div> | 237 | 235 | unstable_AsyncMode was added in 16.3, renamed to | @@ -271,13 +269,13 @@ function Even() { | 271 | 269 |
| 272 | 270 | // Simple stateful app shared by all React versions | 273 | 271 | class SimpleApp extends React.Component { | 274 | | - state = { count: 0 }; | | 272 | + state = {count: 0}; | 275 | 273 | incrementCount = () => { | 276 | | - const updaterFn = prevState => ({ count: prevState.count + 1 }); | | 274 | + const updaterFn = prevState => ({count: prevState.count + 1}); | 277 | 275 | trace('Updating count', performance.now(), () => this.setState(updaterFn)); | 278 | 276 | }; | 279 | 277 | render() { | 280 | | - const { count } = this.state; | | 278 | + const {count} = this.state; | 281 | 279 | return ( | 282 | 280 | <div> | 283 | 281 | {count % 2 === 0 ? ( | @@ -299,7 +297,7 @@ apps.push( | 299 | 297 | ); | 300 | 298 |
| 301 | 299 | // This component, with the version prop, helps organize DevTools at a glance. | 302 | | -function TopLevelWrapperForDevTools({ version }) { | | 300 | +function TopLevelWrapperForDevTools({version}) { | 303 | 301 | let header = <h1>React {version}</h1>; | 304 | 302 | if (version.includes('canary')) { | 305 | 303 | const commitSha = version.match(/.+canary-(.+)/)[1]; | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/devtools/shell/app/DeeplyNestedComponents/index.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // @flow | 2 | 2 |
| 3 | | -import React, { Fragment } from 'react'; | | 3 | +import React, {Fragment} from 'react'; | 4 | 4 |
| 5 | 5 | function wrapWithHoc(Component, index) { | 6 | 6 | function HOC() { | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/devtools/shell/app/EditableProps/index.js +10-10Lines changed: 10 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,20 +13,20 @@ import React, { | 13 | 13 | useState, | 14 | 14 | } from 'react'; | 15 | 15 |
| 16 | | -const initialData = { foo: 'FOO', bar: 'BAR' }; | | 16 | +const initialData = {foo: 'FOO', bar: 'BAR'}; | 17 | 17 |
| 18 | 18 | function reducer(state, action) { | 19 | 19 | switch (action.type) { | 20 | 20 | case 'swap': | 21 | | - return { foo: state.bar, bar: state.foo }; | | 21 | + return {foo: state.bar, bar: state.foo}; | 22 | 22 | default: | 23 | 23 | throw new Error(); | 24 | 24 | } | 25 | 25 | } | 26 | 26 |
| 27 | | -type StatefulFunctionProps = {| name: string |}; | | 27 | +type StatefulFunctionProps = {|name: string|}; | 28 | 28 |
| 29 | | -function StatefulFunction({ name }: StatefulFunctionProps) { | | 29 | +function StatefulFunction({name}: StatefulFunctionProps) { | 30 | 30 | const [count, updateCount] = useState(0); | 31 | 31 | const debouncedCount = useDebounce(count, 1000); | 32 | 32 | const handleUpdateCountClick = useCallback(() => updateCount(count + 1), [ | @@ -35,7 +35,7 @@ function StatefulFunction({ name }: StatefulFunctionProps) { | 35 | 35 |
| 36 | 36 | const [data, dispatch] = useReducer(reducer, initialData); | 37 | 37 | const handleUpdateReducerClick = useCallback( | 38 | | - () => dispatch({ type: 'swap' }), | | 38 | + () => dispatch({type: 'swap'}), | 39 | 39 | [] | 40 | 40 | ); | 41 | 41 |
| @@ -60,8 +60,8 @@ function StatefulFunction({ name }: StatefulFunctionProps) { | 60 | 60 | const BoolContext = createContext(true); | 61 | 61 | BoolContext.displayName = 'BoolContext'; | 62 | 62 |
| 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|}; | 65 | 65 |
| 66 | 66 | class StatefulClass extends Component<Props, State> { | 67 | 67 | static contextType = BoolContext; | @@ -71,7 +71,7 @@ class StatefulClass extends Component<Props, State> { | 71 | 71 | state: 'California', | 72 | 72 | }; | 73 | 73 |
| 74 | | - handleChange = ({ target }) => | | 74 | + handleChange = ({target}) => | 75 | 75 | this.setState({ | 76 | 76 | state: target.value, | 77 | 77 | }); | @@ -94,8 +94,8 @@ class StatefulClass extends Component<Props, State> { | 94 | 94 | const MemoizedStatefulClass = memo(StatefulClass); | 95 | 95 | const MemoizedStatefulFunction = memo(StatefulFunction); | 96 | 96 |
| 97 | | -const ForwardRef = forwardRef<{| name: string |}, HTMLUListElement>( | 98 | | - ({ name }, ref) => { | | 97 | +const ForwardRef = forwardRef<{|name: string|}, HTMLUListElement>( | | 98 | + ({name}, ref) => { | 99 | 99 | const [count, updateCount] = useState(0); | 100 | 100 | const debouncedCount = useDebounce(count, 1000); | 101 | 101 | const handleUpdateCountClick = useCallback(() => updateCount(count + 1), [ | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/devtools/shell/app/Hydration/index.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // @flow | 2 | 2 |
| 3 | | -import React, { Fragment, useDebugValue, useState } from 'react'; | | 3 | +import React, {Fragment, useDebugValue, useState} from 'react'; | 4 | 4 |
| 5 | 5 | const div = document.createElement('div'); | 6 | 6 | const exmapleFunction = () => {}; | @@ -110,7 +110,7 @@ export default function Hydration() { | 110 | 110 | ); | 111 | 111 | } | 112 | 112 |
| 113 | | -function DehydratableProps({ array, object }: any) { | | 113 | +function DehydratableProps({array, object}: any) { | 114 | 114 | return ( | 115 | 115 | <ul> | 116 | 116 | <li>array: {JSON.stringify(array, null, 2)}</li> | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/devtools/shell/app/Iframe/index.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /** @flow */ | 2 | 2 |
| 3 | | -import React, { Fragment } from 'react'; | | 3 | +import React, {Fragment} from 'react'; | 4 | 4 | import ReactDOM from 'react-dom'; | 5 | 5 |
| 6 | 6 | export default function Iframe() { | @@ -16,7 +16,7 @@ export default function Iframe() { | 16 | 16 | ); | 17 | 17 | } | 18 | 18 |
| 19 | | -const iframeStyle = { border: '2px solid #eee', height: 80 }; | | 19 | +const iframeStyle = {border: '2px solid #eee', height: 80}; | 20 | 20 |
| 21 | 21 | function Frame(props) { | 22 | 22 | const [element, setElement] = React.useState(null); | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/devtools/shell/app/InspectableElements/Contexts.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // @flow | 2 | 2 |
| 3 | | -import React, { createContext, Component, Fragment, useContext } from 'react'; | | 3 | +import React, {createContext, Component, Fragment, useContext} from 'react'; | 4 | 4 | import PropTypes from 'prop-types'; | 5 | 5 |
| 6 | 6 | function someNamedFunction() {} | @@ -10,7 +10,7 @@ const contextData = { | 10 | 10 | bool: true, | 11 | 11 | func: someNamedFunction, | 12 | 12 | number: 123, | 13 | | - object: { outer: { inner: {} } }, | | 13 | + object: {outer: {inner: {}}}, | 14 | 14 | string: 'abc', | 15 | 15 | symbol: Symbol.for('symbol'), | 16 | 16 | null: null, | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/devtools/shell/app/InspectableElements/CustomHooks.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,7 +17,7 @@ const object = { | 17 | 17 | null: null, | 18 | 18 | undefined: undefined, | 19 | 19 | array: ['a', 'b', 'c'], | 20 | | - object: { foo: 1, bar: 2, baz: 3 }, | | 20 | + object: {foo: 1, bar: 2, baz: 3}, | 21 | 21 | }; | 22 | 22 |
| 23 | 23 | function useNestedInnerHook() { | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/devtools/shell/app/InspectableElements/InspectableElements.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // @flow | 2 | 2 |
| 3 | | -import React, { Fragment } from 'react'; | | 3 | +import React, {Fragment} from 'react'; | 4 | 4 | import Contexts from './Contexts'; | 5 | 5 | import CustomHooks from './CustomHooks'; | 6 | 6 | import CustomObject from './CustomObject'; | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/devtools/shell/app/InspectableElements/NestedProps.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -22,7 +22,7 @@ export default function ObjectProps() { | 22 | 22 | }} | 23 | 23 | array={['first', 'second', 'third']} | 24 | 24 | objectInArray={[object]} | 25 | | - arrayInObject={{ array: ['first', 'second', 'third'] }} | | 25 | + arrayInObject={{array: ['first', 'second', 'third']}} | 26 | 26 | deepObject={{ | 27 | 27 | // Known limitation: we won't go deeper than several levels. | 28 | 28 | // In the future, we might offer a way to request deeper access on demand. | |
|