@samitouri / QOS-React / commits / b7e7f1a3fa

[BE] upgrade prettier to 3.3.3 (#30420)

Mostly just changes in ternary formatting.

Jan Kassens committed Jul 22, 2024 at 16:09 UTC b7e7f1a3fab87e8fc19e86a8088a9e0fe4710973
50 files changed +206 -234
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md
+3 -7
@@ -6,13 +6,9 @@ import {useNoAlias} from 'shared-runtime';
6
7 function Component(props) {
8 const item = {a: props.a};
9 - const x = useNoAlias(
10 - item,
11 - () => {
12 - console.log(props);
13 - },
14 - [props.a]
15 - );
9 + const x = useNoAlias(item, () => {
10 + console.log(props);
11 + }, [props.a]);
12 return [x, item];
13 }
14
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.js
+3 -7
@@ -2,13 +2,9 @@ import {useNoAlias} from 'shared-runtime';
2
3 function Component(props) {
4 const item = {a: props.a};
5 - const x = useNoAlias(
6 - item,
7 - () => {
8 - console.log(props);
9 - },
10 - [props.a]
11 - );
5 + const x = useNoAlias(item, () => {
6 + console.log(props);
7 + }, [props.a]);
8 return [x, item];
9 }
10
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-constant-prop.expect.md
+2 -2
@@ -11,11 +11,11 @@ function useFoo(cond) {
11 const derived1 = useMemo(() => {
12 return identity(sourceDep);
13 }, [sourceDep]);
14 - const derived2 = cond ?? Math.min(sourceDep, 1) ? 1 : 2;
14 + const derived2 = (cond ?? Math.min(sourceDep, 1)) ? 1 : 2;
15 const derived3 = useMemo(() => {
16 return identity(sourceDep);
17 }, [sourceDep]);
18 - const derived4 = Math.min(sourceDep, -1) ?? cond ? 1 : 2;
18 + const derived4 = (Math.min(sourceDep, -1) ?? cond) ? 1 : 2;
19 return [derived1, derived2, derived3, derived4];
20 }
21
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-constant-prop.ts
+2 -2
@@ -7,11 +7,11 @@ function useFoo(cond) {
7 const derived1 = useMemo(() => {
8 return identity(sourceDep);
9 }, [sourceDep]);
10 - const derived2 = cond ?? Math.min(sourceDep, 1) ? 1 : 2;
10 + const derived2 = (cond ?? Math.min(sourceDep, 1)) ? 1 : 2;
11 const derived3 = useMemo(() => {
12 return identity(sourceDep);
13 }, [sourceDep]);
14 - const derived4 = Math.min(sourceDep, -1) ?? cond ? 1 : 2;
14 + const derived4 = (Math.min(sourceDep, -1) ?? cond) ? 1 : 2;
15 return [derived1, derived2, derived3, derived4];
16 }
17
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ternary-expression.expect.md
+1 -1
@@ -3,7 +3,7 @@
3
4 ```javascript
5 function ternary(props) {
6 - const a = props.a && props.b ? props.c || props.d : props.e ?? props.f;
6 + const a = props.a && props.b ? props.c || props.d : (props.e ?? props.f);
7 const b = props.a ? (props.b && props.c ? props.d : props.e) : props.f;
8 return a ? b : null;
9 }
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ternary-expression.js
+1 -1
@@ -1,5 +1,5 @@
1 function ternary(props) {
2 - const a = props.a && props.b ? props.c || props.d : props.e ?? props.f;
2 + const a = props.a && props.b ? props.c || props.d : (props.e ?? props.f);
3 const b = props.a ? (props.b && props.c ? props.d : props.e) : props.f;
4 return a ? b : null;
5 }
package.json
+1 -1
@@ -80,7 +80,7 @@
80 "minimist": "^1.2.3",
81 "mkdirp": "^0.5.1",
82 "ncp": "^2.0.0",
83 - "prettier": "3.0.3",
83 + "prettier": "^3.3.3",
84 "prettier-2": "npm:prettier@^2",
85 "pretty-format": "^29.4.1",
86 "prop-types": "^15.6.2",
packages/react-debug-tools/src/ReactDebugHooks.js
+3 -3
@@ -284,9 +284,9 @@ function useState<S>(
284 hook !== null
285 ? hook.memoizedState
286 : typeof initialState === 'function'
287 - ? // $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
288 - initialState()
289 - : initialState;
287 + ? // $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
288 + initialState()
289 + : initialState;
290 hookLog.push({
291 displayName: null,
292 primitive: 'State',
packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js
+8 -16
@@ -182,14 +182,10 @@ describe('ReactHooksInspectionIntegration', () => {
182 React.useLayoutEffect(effect);
183 React.useEffect(effect);
184
185 - React.useImperativeHandle(
186 - outsideRef,
187 - () => {
188 - // Return a function so that jest treats them as non-equal.
189 - return function Instance() {};
190 - },
191 - [],
192 - );
185 + React.useImperativeHandle(outsideRef, () => {
186 + // Return a function so that jest treats them as non-equal.
187 + return function Instance() {};
188 + }, []);
189
190 React.useMemo(() => state1 + state2, [state1]);
191
@@ -472,14 +468,10 @@ describe('ReactHooksInspectionIntegration', () => {
468 React.useLayoutEffect(effect);
469 React.useEffect(effect);
470
475 - React.useImperativeHandle(
476 - outsideRef,
477 - () => {
478 - // Return a function so that jest treats them as non-equal.
479 - return function Instance() {};
480 - },
481 - [],
482 - );
471 + React.useImperativeHandle(outsideRef, () => {
472 + // Return a function so that jest treats them as non-equal.
473 + return function Instance() {};
474 + }, []);
475
476 React.useMemo(() => state1 + state2, [state1]);
477
packages/react-devtools-shared/src/devtools/views/Settings/ComponentsSettings.js
+2 -2
@@ -349,8 +349,8 @@ export default function ComponentsSettings(_: {}): React.Node {
349 componentFilter.isValid === false
350 ? 'Filter invalid'
351 : componentFilter.isEnabled
352 - ? 'Filter enabled'
353 - : 'Filter disabled'
352 + ? 'Filter enabled'
353 + : 'Filter disabled'
354 }>
355 <ToggleIcon
356 isEnabled={componentFilter.isEnabled}
packages/react-devtools-shared/src/hooks/astUtils.js
+1 -1
@@ -289,7 +289,7 @@ function getHookVariableName(
289 const nodeType = hook.node.id.type;
290 switch (nodeType) {
291 case AST_NODE_TYPES.ARRAY_PATTERN:
292 - return !isCustomHook ? hook.node.id.elements[0]?.name ?? null : null;
292 + return !isCustomHook ? (hook.node.id.elements[0]?.name ?? null) : null;
293
294 case AST_NODE_TYPES.IDENTIFIER:
295 return hook.node.id.name;
packages/react-devtools-timeline/src/content-views/ReactMeasuresView.js
+2 -2
@@ -186,8 +186,8 @@ export class ReactMeasuresView extends View {
186 context.fillStyle = showHoverHighlight
187 ? hoveredFillStyle
188 : showGroupHighlight
189 - ? groupSelectedFillStyle
190 - : fillStyle;
189 + ? groupSelectedFillStyle
190 + : fillStyle;
191 context.fillRect(
192 drawableRect.origin.x,
193 drawableRect.origin.y,
packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
+3 -3
@@ -650,9 +650,9 @@ export const scheduleMicrotask: any =
650 typeof queueMicrotask === 'function'
651 ? queueMicrotask
652 : typeof localPromise !== 'undefined'
653 - ? callback =>
654 - localPromise.resolve(null).then(callback).catch(handleErrorInNextTick)
655 - : scheduleTimeout; // TODO: Determine the best fallback here.
653 + ? callback =>
654 + localPromise.resolve(null).then(callback).catch(handleErrorInNextTick)
655 + : scheduleTimeout; // TODO: Determine the best fallback here.
656
657 function handleErrorInNextTick(error: any) {
658 setTimeout(() => {
packages/react-dom-bindings/src/events/SyntheticEvent.js
+12 -12
@@ -564,23 +564,23 @@ const WheelEventInterface = {
564 return 'deltaX' in event
565 ? event.deltaX
566 : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
567 - 'wheelDeltaX' in event
568 - ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
569 - -event.wheelDeltaX
570 - : 0;
567 + 'wheelDeltaX' in event
568 + ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
569 + -event.wheelDeltaX
570 + : 0;
571 },
572 deltaY(event: {[propName: string]: mixed}) {
573 return 'deltaY' in event
574 ? event.deltaY
575 : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
576 - 'wheelDeltaY' in event
577 - ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
578 - -event.wheelDeltaY
579 - : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
580 - 'wheelDelta' in event
581 - ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
582 - -event.wheelDelta
583 - : 0;
576 + 'wheelDeltaY' in event
577 + ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
578 + -event.wheelDeltaY
579 + : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
580 + 'wheelDelta' in event
581 + ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
582 + -event.wheelDelta
583 + : 0;
584 },
585 deltaZ: 0,
586
packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js
+2 -2
@@ -80,8 +80,8 @@ function getEventTargetDocument(eventTarget: any) {
80 return eventTarget.window === eventTarget
81 ? eventTarget.document
82 : eventTarget.nodeType === DOCUMENT_NODE
83 - ? eventTarget
84 - : eventTarget.ownerDocument;
83 + ? eventTarget
84 + : eventTarget.ownerDocument;
85 }
86
87 /**
packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
+14 -14
@@ -515,8 +515,8 @@ export function createRenderState(
515 typeof scriptConfig === 'string' || scriptConfig.crossOrigin == null
516 ? undefined
517 : scriptConfig.crossOrigin === 'use-credentials'
518 - ? 'use-credentials'
519 - : '';
518 + ? 'use-credentials'
519 + : '';
520 }
521
522 preloadBootstrapScriptOrModule(resumableState, renderState, src, props);
@@ -567,8 +567,8 @@ export function createRenderState(
567 typeof scriptConfig === 'string' || scriptConfig.crossOrigin == null
568 ? undefined
569 : scriptConfig.crossOrigin === 'use-credentials'
570 - ? 'use-credentials'
571 - : '';
570 + ? 'use-credentials'
571 + : '';
572 }
573
574 preloadBootstrapScriptOrModule(resumableState, renderState, src, props);
@@ -736,8 +736,8 @@ export function createRootFormatContext(namespaceURI?: string): FormatContext {
736 namespaceURI === 'http://www.w3.org/2000/svg'
737 ? SVG_MODE
738 : namespaceURI === 'http://www.w3.org/1998/Math/MathML'
739 - ? MATHML_MODE
740 - : ROOT_HTML_MODE;
739 + ? MATHML_MODE
740 + : ROOT_HTML_MODE;
741 return createFormatContext(insertionMode, null, NO_SCOPE);
742 }
743
@@ -2493,8 +2493,8 @@ function pushLink(
2493 props.onLoad && props.onError
2494 ? '`onLoad` and `onError` props'
2495 : props.onLoad
2496 - ? '`onLoad` prop'
2497 - : '`onError` prop';
2496 + ? '`onLoad` prop'
2497 + : '`onError` prop';
2498 console.error(
2499 'React encountered a `<link rel="stylesheet" .../>` with a `precedence` prop and %s. The presence of loading and error handlers indicates an intent to manage the stylesheet loading state from your from your Component code and React will not hoist or deduplicate this stylesheet. If your intent was to have React hoist and deduplciate this stylesheet using the `precedence` prop remove the %s, otherwise remove the `precedence` prop.',
2500 propDescription,
@@ -2669,8 +2669,8 @@ function pushStyle(
2669 typeof child === 'function'
2670 ? 'a Function'
2671 : typeof child === 'symbol'
2672 - ? 'a Sybmol'
2673 - : 'an Array';
2672 + ? 'a Sybmol'
2673 + : 'an Array';
2674 console.error(
2675 'React expect children of <style> tags to be a string, number, or object with a `toString` method but found %s instead. ' +
2676 'In browsers style Elements can only have `Text` Nodes as children.',
@@ -3337,8 +3337,8 @@ function pushScriptImpl(
3337 typeof children === 'number'
3338 ? 'a number for children'
3339 : Array.isArray(children)
3340 - ? 'an array for children'
3341 - : 'something unexpected for children';
3340 + ? 'an array for children'
3341 + : 'something unexpected for children';
3342 console.error(
3343 'A script element was rendered with %s. If script element has children it must be a single string.' +
3344 ' Consider using dangerouslySetInnerHTML or passing a plain string as children.',
@@ -5436,8 +5436,8 @@ function preconnect(href: string, crossOrigin: ?CrossOriginEnum) {
5436 crossOrigin === 'use-credentials'
5437 ? 'credentials'
5438 : typeof crossOrigin === 'string'
5439 - ? 'anonymous'
5440 - : 'default';
5439 + ? 'anonymous'
5440 + : 'default';
5441 const key = getResourceKey(href);
5442 if (!resumableState.connectResources[bucket].hasOwnProperty(key)) {
5443 resumableState.connectResources[bucket][key] = EXISTS;
packages/react-dom-bindings/src/shared/ReactDOMResourceValidation.js
+10 -10
@@ -68,20 +68,20 @@ export function getValueDescriptorExpectingObjectForWarning(
68 return thing === null
69 ? '`null`'
70 : thing === undefined
71 - ? '`undefined`'
72 - : thing === ''
73 - ? 'an empty string'
74 - : `something with type "${typeof thing}"`;
71 + ? '`undefined`'
72 + : thing === ''
73 + ? 'an empty string'
74 + : `something with type "${typeof thing}"`;
75 }
76
77 export function getValueDescriptorExpectingEnumForWarning(thing: any): string {
78 return thing === null
79 ? '`null`'
80 : thing === undefined
81 - ? '`undefined`'
82 - : thing === ''
83 - ? 'an empty string'
84 - : typeof thing === 'string'
85 - ? JSON.stringify(thing)
86 - : `something with type "${typeof thing}"`;
81 + ? '`undefined`'
82 + : thing === ''
83 + ? 'an empty string'
84 + : typeof thing === 'string'
85 + ? JSON.stringify(thing)
86 + : `something with type "${typeof thing}"`;
87 }
packages/react-dom/src/__tests__/ReactDOMFizzStatic-test.js
+2 -2
@@ -133,8 +133,8 @@ describe('ReactDOMFizzStatic', () => {
133 return children.length === 0
134 ? undefined
135 : children.length === 1
136 - ? children[0]
137 - : children;
136 + ? children[0]
137 + : children;
138 }
139
140 function resolveText(text) {
packages/react-dom/src/__tests__/ReactDOMFizzSuppressHydrationWarning-test.js
+2 -2
@@ -135,8 +135,8 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
135 return children.length === 0
136 ? undefined
137 : children.length === 1
138 - ? children[0]
139 - : children;
138 + ? children[0]
139 + : children;
140 }
141
142 it('suppresses but does not fix text mismatches with suppressHydrationWarning', async () => {
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
+2 -2
@@ -282,8 +282,8 @@ describe('ReactDOMFloat', () => {
282 return children.length === 0
283 ? undefined
284 : children.length === 1
285 - ? children[0]
286 - : children;
285 + ? children[0]
286 + : children;
287 }
288
289 function BlockedOn({value, children}) {
packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js
+2 -2
@@ -72,8 +72,8 @@ describe('ReactDOMServerSuspense', () => {
72 return children.length === 0
73 ? undefined
74 : children.length === 1
75 - ? children[0]
76 - : children;
75 + ? children[0]
76 + : children;
77 }
78
79 it('should render the children when no promise is thrown', async () => {
packages/react-dom/src/__tests__/ReactDOMSingletonComponents-test.js
+2 -2
@@ -128,8 +128,8 @@ describe('ReactDOM HostSingleton', () => {
128 return children.length === 0
129 ? undefined
130 : children.length === 1
131 - ? children[0]
132 - : children;
131 + ? children[0]
132 + : children;
133 }
134
135 it('warns if you render the same singleton twice at the same time', async () => {
packages/react-dom/src/shared/ReactDOMFloat.js
+12 -12
@@ -336,22 +336,22 @@ function getValueDescriptorExpectingObjectForWarning(thing: any): string {
336 return thing === null
337 ? '`null`'
338 : thing === undefined
339 - ? '`undefined`'
340 - : thing === ''
341 - ? 'an empty string'
342 - : `something with type "${typeof thing}"`;
339 + ? '`undefined`'
340 + : thing === ''
341 + ? 'an empty string'
342 + : `something with type "${typeof thing}"`;
343 }
344
345 function getValueDescriptorExpectingEnumForWarning(thing: any): string {
346 return thing === null
347 ? '`null`'
348 : thing === undefined
349 - ? '`undefined`'
350 - : thing === ''
351 - ? 'an empty string'
352 - : typeof thing === 'string'
353 - ? JSON.stringify(thing)
354 - : typeof thing === 'number'
355 - ? '`' + thing + '`'
356 - : `something with type "${typeof thing}"`;
349 + ? '`undefined`'
350 + : thing === ''
351 + ? 'an empty string'
352 + : typeof thing === 'string'
353 + ? JSON.stringify(thing)
354 + : typeof thing === 'number'
355 + ? '`' + thing + '`'
356 + : `something with type "${typeof thing}"`;
357 }
packages/react-dom/src/test-utils/FizzTestUtils.js
+2 -2
@@ -210,8 +210,8 @@ function getVisibleChildren(element: Element): React$Node {
210 return children.length === 0
211 ? undefined
212 : children.length === 1
213 - ? children[0]
214 - : children;
213 + ? children[0]
214 + : children;
215 }
216
217 export {
packages/react-native-renderer/src/__tests__/ResponderEventPlugin-test.internal.js
+6 -6
@@ -81,12 +81,12 @@ const _touchConfig = function (
81 topType === 'topTouchStart'
82 ? allTouchObjects
83 : topType === 'topTouchMove'
84 - ? allTouchObjects
85 - : topType === 'topTouchEnd'
86 - ? antiSubsequence(allTouchObjects, changedIndices)
87 - : topType === 'topTouchCancel'
88 - ? antiSubsequence(allTouchObjects, changedIndices)
89 - : null;
84 + ? allTouchObjects
85 + : topType === 'topTouchEnd'
86 + ? antiSubsequence(allTouchObjects, changedIndices)
87 + : topType === 'topTouchCancel'
88 + ? antiSubsequence(allTouchObjects, changedIndices)
89 + : null;
90
91 return {
92 nativeEvent: touchEvent(
packages/react-native-renderer/src/legacy-events/EventPluginUtils.js
+4 -4
@@ -45,15 +45,15 @@ function validateEventDispatches(event) {
45 const listenersLen = listenersIsArr
46 ? dispatchListeners.length
47 : dispatchListeners
48 - ? 1
49 - : 0;
48 + ? 1
49 + : 0;
50
51 const instancesIsArr = isArray(dispatchInstances);
52 const instancesLen = instancesIsArr
53 ? dispatchInstances.length
54 : dispatchInstances
55 - ? 1
56 - : 0;
55 + ? 1
56 + : 0;
57
58 if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) {
59 console.error('EventPluginUtils: Invalid `event`.');
packages/react-native-renderer/src/legacy-events/ResponderEventPlugin.js
+10 -10
@@ -542,10 +542,10 @@ function setResponderAndExtractTransfer(
542 const shouldSetEventType = isStartish(topLevelType)
543 ? eventTypes.startShouldSetResponder
544 : isMoveish(topLevelType)
545 - ? eventTypes.moveShouldSetResponder
546 - : topLevelType === TOP_SELECTION_CHANGE
547 - ? eventTypes.selectionChangeShouldSetResponder
548 - : eventTypes.scrollShouldSetResponder;
545 + ? eventTypes.moveShouldSetResponder
546 + : topLevelType === TOP_SELECTION_CHANGE
547 + ? eventTypes.selectionChangeShouldSetResponder
548 + : eventTypes.scrollShouldSetResponder;
549
550 // TODO: stop one short of the current responder.
551 const bubbleShouldSetFrom = !responderInst
@@ -742,10 +742,10 @@ const ResponderEventPlugin = {
742 const incrementalTouch = isResponderTouchStart
743 ? eventTypes.responderStart
744 : isResponderTouchMove
745 - ? eventTypes.responderMove
746 - : isResponderTouchEnd
747 - ? eventTypes.responderEnd
748 - : null;
745 + ? eventTypes.responderMove
746 + : isResponderTouchEnd
747 + ? eventTypes.responderEnd
748 + : null;
749
750 if (incrementalTouch) {
751 const gesture = ResponderSyntheticEvent.getPooled(
@@ -769,8 +769,8 @@ const ResponderEventPlugin = {
769 const finalTouch = isResponderTerminate
770 ? eventTypes.responderTerminate
771 : isResponderRelease
772 - ? eventTypes.responderRelease
773 - : null;
772 + ? eventTypes.responderRelease
773 + : null;
774 if (finalTouch) {
775 const finalEvent = ResponderSyntheticEvent.getPooled(
776 finalTouch,
packages/react-noop-renderer/src/createReactNoop.js
+10 -10
@@ -245,7 +245,7 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
245 id: instance.id,
246 type: type,
247 parent: instance.parent,
248 - children: keepChildren ? instance.children : children ?? [],
248 + children: keepChildren ? instance.children : (children ?? []),
249 text: shouldSetTextContent(type, newProps)
250 ? computeText((newProps.children: any) + '', instance.context)
251 : null,
@@ -503,15 +503,15 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
503 typeof queueMicrotask === 'function'
504 ? queueMicrotask
505 : typeof Promise !== 'undefined'
506 - ? callback =>
507 - Promise.resolve(null)
508 - .then(callback)
509 - .catch(error => {
510 - setTimeout(() => {
511 - throw error;
512 - });
513 - })
514 - : setTimeout,
506 + ? callback =>
507 + Promise.resolve(null)
508 + .then(callback)
509 + .catch(error => {
510 + setTimeout(() => {
511 + throw error;
512 + });
513 + })
514 + : setTimeout,
515
516 prepareForCommit(): null | Object {
517 return null;
packages/react-reconciler/src/ReactFiber.js
+2 -2
@@ -588,8 +588,8 @@ export function createFiberFromTypeAndProps(
588 fiberTag = isHostHoistableType(type, pendingProps, hostContext)
589 ? HostHoistable
590 : isHostSingletonType(type)
591 - ? HostSingleton
592 - : HostComponent;
591 + ? HostSingleton
592 + : HostComponent;
593 } else if (supportsResources) {
594 const hostContext = getHostContext();
595 fiberTag = isHostHoistableType(type, pendingProps, hostContext)
packages/react-reconciler/src/__tests__/ReactFlushSync-test.js
+2 -2
@@ -74,8 +74,8 @@ describe('ReactFlushSync', () => {
74 return children.length === 0
75 ? undefined
76 : children.length === 1
77 - ? children[0]
78 - : children;
77 + ? children[0]
78 + : children;
79 }
80
81 it('changes priority of updates in useEffect', async () => {
packages/react-reconciler/src/__tests__/ReactFlushSyncNoAggregateError-test.js
+2 -2
@@ -89,8 +89,8 @@ describe('ReactFlushSync (AggregateError not available)', () => {
89 return children.length === 0
90 ? undefined
91 : children.length === 1
92 - ? children[0]
93 - : children;
92 + ? children[0]
93 + : children;
94 }
95
96 it('completely exhausts synchronous work queue even if something throws', async () => {
packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
+4 -8
@@ -3446,14 +3446,10 @@ describe('ReactHooksWithNoopRenderer', () => {
3446 let totalRefUpdates = 0;
3447 function Counter(props, ref) {
3448 const [count, dispatch] = useReducer(reducer, 0);
3449 - useImperativeHandle(
3450 - ref,
3451 - () => {
3452 - totalRefUpdates++;
3453 - return {count, dispatch};
3454 - },
3455 - [count],
3456 - );
3449 + useImperativeHandle(ref, () => {
3450 + totalRefUpdates++;
3451 + return {count, dispatch};
3452 + }, [count]);
3453 return <Text text={'Count: ' + count} />;
3454 }
3455
packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.js
+2 -2
@@ -88,8 +88,8 @@ describe('ReactIncrementalSideEffects', () => {
88 {props.text === 'World'
89 ? [<Bar key="a" text={props.text} />, <div key="b" />]
90 : props.text === 'Hi'
91 - ? [<div key="b" />, <Bar key="a" text={props.text} />]
92 - : null}
91 + ? [<div key="b" />, <Bar key="a" text={props.text} />]
92 + : null}
93 <span prop="test" />
94 </div>
95 );
packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
+4 -4
@@ -815,10 +815,10 @@ describe('ReactLazy', () => {
815 'Add: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.',
816 ]
817 : shouldWarnAboutMemoDefaultProps
818 - ? [
819 - 'Add: Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.',
820 - ]
821 - : [],
818 + ? [
819 + 'Add: Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.',
820 + ]
821 + : [],
822 );
823 expect(root).toMatchRenderedOutput('22');
824
packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js
+3 -7
@@ -91,13 +91,9 @@ describe('useSyncExternalStore', () => {
91
92 const Child = forwardRef(({store, label}, ref) => {
93 const value = useSyncExternalStore(store.subscribe, store.getState);
94 - useImperativeHandle(
95 - ref,
96 - () => {
97 - return value;
98 - },
99 - [],
100 - );
94 + useImperativeHandle(ref, () => {
95 + return value;
96 + }, []);
97 return <Text text={label + value} />;
98 });
99
packages/react-server-dom-webpack/src/__tests__/ReactFlightDOM-test.js
+2 -2
@@ -206,8 +206,8 @@ describe('ReactFlightDOM', () => {
206 return children.length === 0
207 ? undefined
208 : children.length === 1
209 - ? children[0]
210 - : children;
209 + ? children[0]
210 + : children;
211 }
212
213 it('should resolve HTML using Node streams', async () => {
packages/react-server/src/ReactFizzServer.js
+3 -3
@@ -4763,9 +4763,9 @@ export function prepareForStartFlowingIfBeforeAllReady(request: Request) {
4763 ? // Render Request, we define shell complete by the pending root tasks
4764 request.pendingRootTasks === 0
4765 : // Prerender Request, we define shell complete by completedRootSegemtn
4766 - request.completedRootSegment === null
4767 - ? request.pendingRootTasks === 0
4768 - : request.completedRootSegment.status !== POSTPONED;
4766 + request.completedRootSegment === null
4767 + ? request.pendingRootTasks === 0
4768 + : request.completedRootSegment.status !== POSTPONED;
4769 safelyEmitEarlyPreloads(request, shellComplete);
4770 }
4771
packages/react-server/src/ReactFlightServer.js
+14 -10
@@ -458,8 +458,8 @@ function RequestInstance(
458 environmentName === undefined
459 ? () => 'Server'
460 : typeof environmentName !== 'function'
461 - ? () => environmentName
462 - : environmentName;
461 + ? () => environmentName
462 + : environmentName;
463 this.didWarnForKey = null;
464 }
465 const rootTask = createTask(
@@ -3795,10 +3795,12 @@ export function abort(request: Request, reason: mixed): void {
3795 'The render was aborted by the server without a reason.',
3796 )
3797 : typeof reason === 'object' &&
3798 - reason !== null &&
3799 - typeof reason.then === 'function'
3800 - ? new Error('The render was aborted by the server with a promise.')
3801 - : reason;
3798 + reason !== null &&
3799 + typeof reason.then === 'function'
3800 + ? new Error(
3801 + 'The render was aborted by the server with a promise.',
3802 + )
3803 + : reason;
3804 const digest = logRecoverableError(request, error, null);
3805 emitErrorChunk(request, errorId, digest, error);
3806 }
@@ -3825,10 +3827,12 @@ export function abort(request: Request, reason: mixed): void {
3827 'The render was aborted by the server without a reason.',
3828 )
3829 : typeof reason === 'object' &&
3828 - reason !== null &&
3829 - typeof reason.then === 'function'
3830 - ? new Error('The render was aborted by the server with a promise.')
3831 - : reason;
3830 + reason !== null &&
3831 + typeof reason.then === 'function'
3832 + ? new Error(
3833 + 'The render was aborted by the server with a promise.',
3834 + )
3835 + : reason;
3836 }
3837 abortListeners.forEach(callback => callback(error));
3838 abortListeners.clear();
packages/scheduler/npm/umd/scheduler.development.js
+2 -2
@@ -14,8 +14,8 @@
14 typeof exports === 'object' && typeof module !== 'undefined'
15 ? (module.exports = factory(require('react')))
16 : typeof define === 'function' && define.amd // eslint-disable-line no-undef
17 - ? define(['react'], factory) // eslint-disable-line no-undef
18 - : (global.Scheduler = factory(global));
17 + ? define(['react'], factory) // eslint-disable-line no-undef
18 + : (global.Scheduler = factory(global));
19 })(this, function (global) {
20 function unstable_now() {
21 return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_now.apply(
packages/scheduler/npm/umd/scheduler.production.min.js
+2 -2
@@ -14,8 +14,8 @@
14 typeof exports === 'object' && typeof module !== 'undefined'
15 ? (module.exports = factory(require('react')))
16 : typeof define === 'function' && define.amd // eslint-disable-line no-undef
17 - ? define(['react'], factory) // eslint-disable-line no-undef
18 - : (global.Scheduler = factory(global));
17 + ? define(['react'], factory) // eslint-disable-line no-undef
18 + : (global.Scheduler = factory(global));
19 })(this, function (global) {
20 function unstable_now() {
21 return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_now.apply(
packages/scheduler/npm/umd/scheduler.profiling.min.js
+2 -2
@@ -14,8 +14,8 @@
14 typeof exports === 'object' && typeof module !== 'undefined'
15 ? (module.exports = factory(require('react')))
16 : typeof define === 'function' && define.amd // eslint-disable-line no-undef
17 - ? define(['react'], factory) // eslint-disable-line no-undef
18 - : (global.Scheduler = factory(global));
17 + ? define(['react'], factory) // eslint-disable-line no-undef
18 + : (global.Scheduler = factory(global));
19 })(this, function (global) {
20 function unstable_now() {
21 return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_now.apply(
packages/shared/ReactComponentStackFrame.js
+4 -4
@@ -39,10 +39,10 @@ export function describeBuiltInComponentFrame(name: string): string {
39 ? // V8
40 ' (<anonymous>)'
41 : // JSC/Spidermonkey
42 - x.stack.indexOf('@') > -1
43 - ? '@unknown:0:0'
44 - : // Other
45 - '';
42 + x.stack.indexOf('@') > -1
43 + ? '@unknown:0:0'
44 + : // Other
45 + '';
46 }
47 }
48 // We use the prefix to ensure our stacks line up with native stack frames.
packages/shared/ReactTypes.js
+6 -6
@@ -171,12 +171,12 @@ export type ReactFormState<S, ReferenceId> = [
171 export type Awaited<T> = T extends null | void
172 ? T // special case for `null | undefined` when not in `--strictNullChecks` mode
173 : T extends Object // `await` only unwraps object types with a callable then. Non-object types are not unwrapped.
174 - ? T extends {then(onfulfilled: infer F): any} // thenable, extracts the first argument to `then()`
175 - ? F extends (value: infer V) => any // if the argument to `then` is callable, extracts the argument
176 - ? Awaited<V> // recursively unwrap the value
177 - : empty // the argument to `then` was not callable.
178 - : T // argument was not an object
179 - : T; // non-thenable
174 + ? T extends {then(onfulfilled: infer F): any} // thenable, extracts the first argument to `then()`
175 + ? F extends (value: infer V) => any // if the argument to `then` is callable, extracts the argument
176 + ? Awaited<V> // recursively unwrap the value
177 + : empty // the argument to `then` was not callable.
178 + : T // argument was not an object
179 + : T; // non-thenable
180
181 export type ReactCallSite = [
182 string, // function name
scripts/jest/TestFlags.js
+4 -4
@@ -66,8 +66,8 @@ function getTestFlags() {
66 ? 'modern'
67 : 'classic'
68 : __EXPERIMENTAL__
69 - ? 'experimental'
70 - : 'stable';
69 + ? 'experimental'
70 + : 'stable';
71
72 // Return a proxy so we can throw if you attempt to access a flag that
73 // doesn't exist.
@@ -90,8 +90,8 @@ function getTestFlags() {
90 shouldUseFizzExternalRuntime: !featureFlags.enableFizzExternalRuntime
91 ? false
92 : www
93 - ? __VARIANT__
94 - : __EXPERIMENTAL__,
93 + ? __VARIANT__
94 + : __EXPERIMENTAL__,
95
96 // This is used by useSyncExternalStoresShared-test.js to decide whether
97 // to test the shim or the native implementation of useSES.
scripts/jest/config.build-devtools.js
+2 -3
@@ -44,9 +44,8 @@ packages.forEach(name => {
44 // Root entry point
45 moduleNameMapper[`^${name}$`] = `<rootDir>/build/${NODE_MODULES_DIR}/${name}`;
46 // Named entry points
47 - moduleNameMapper[
48 - `^${name}\/([^\/]+)$`
49 - ] = `<rootDir>/build/${NODE_MODULES_DIR}/${name}/$1`;
47 + moduleNameMapper[`^${name}\/([^\/]+)$`] =
48 + `<rootDir>/build/${NODE_MODULES_DIR}/${name}/$1`;
49 });
50
51 // Allow tests to import shared code (e.g. feature flags, getStackByFiberInDevAndProd)
scripts/jest/config.build.js
+8 -12
@@ -37,26 +37,22 @@ const moduleNameMapper = {};
37 // Allow bundle tests to read (but not write!) default feature flags.
38 // This lets us determine whether we're running in different modes
39 // without making relevant tests internal-only.
40 -moduleNameMapper[
41 - '^shared/ReactFeatureFlags'
42 -] = `<rootDir>/packages/shared/forks/ReactFeatureFlags.readonly`;
40 +moduleNameMapper['^shared/ReactFeatureFlags'] =
41 + `<rootDir>/packages/shared/forks/ReactFeatureFlags.readonly`;
42
43 // Map packages to bundles
44 packages.forEach(name => {
45 // Root entry point
46 moduleNameMapper[`^${name}$`] = `<rootDir>/build/${NODE_MODULES_DIR}/${name}`;
47 // Named entry points
49 - moduleNameMapper[
50 - `^${name}\/([^\/]+)$`
51 - ] = `<rootDir>/build/${NODE_MODULES_DIR}/${name}/$1`;
48 + moduleNameMapper[`^${name}\/([^\/]+)$`] =
49 + `<rootDir>/build/${NODE_MODULES_DIR}/${name}/$1`;
50 });
51
54 -moduleNameMapper[
55 - 'use-sync-external-store/shim/with-selector'
56 -] = `<rootDir>/build/${NODE_MODULES_DIR}/use-sync-external-store/shim/with-selector`;
57 -moduleNameMapper[
58 - 'use-sync-external-store/shim/index.native'
59 -] = `<rootDir>/build/${NODE_MODULES_DIR}/use-sync-external-store/shim/index.native`;
52 +moduleNameMapper['use-sync-external-store/shim/with-selector'] =
53 + `<rootDir>/build/${NODE_MODULES_DIR}/use-sync-external-store/shim/with-selector`;
54 +moduleNameMapper['use-sync-external-store/shim/index.native'] =
55 + `<rootDir>/build/${NODE_MODULES_DIR}/use-sync-external-store/shim/index.native`;
56
57 module.exports = Object.assign({}, baseConfig, {
58 // Redirect imports to the compiled bundles
scripts/jest/devtools/config.build-devtools-regression.js
+6 -9
@@ -16,20 +16,17 @@ if (REACT_VERSION) {
16 // React version 16.5 has a schedule package instead of a scheduler
17 // package, so we need to rename them accordingly
18 if (semver.satisfies(REACT_VERSION, '16.5')) {
19 - moduleNameMapper[
20 - `^schedule$`
21 - ] = `<rootDir>/build/${NODE_MODULES_DIR}/schedule`;
22 - moduleNameMapper[
23 - '^schedule/tracing$'
24 - ] = `<rootDir>/build/${NODE_MODULES_DIR}/schedule/tracing-profiling`;
19 + moduleNameMapper[`^schedule$`] =
20 + `<rootDir>/build/${NODE_MODULES_DIR}/schedule`;
21 + moduleNameMapper['^schedule/tracing$'] =
22 + `<rootDir>/build/${NODE_MODULES_DIR}/schedule/tracing-profiling`;
23 }
24
25 // react-dom/client is only in v18.0.0 and up, so we
26 // map it to react-dom instead
27 if (semver.satisfies(REACT_VERSION, '<18.0')) {
30 - moduleNameMapper[
31 - '^react-dom/client$'
32 - ] = `<rootDir>/build/${NODE_MODULES_DIR}/react-dom`;
28 + moduleNameMapper['^react-dom/client$'] =
29 + `<rootDir>/build/${NODE_MODULES_DIR}/react-dom`;
30 }
31
32 setupFiles.push(require.resolve('./setupTests.build-devtools-regression'));
scripts/rollup/build-ghaction.js
+2 -2
@@ -459,8 +459,8 @@ function getPlugins(
459 bundleType === NODE_ES2015
460 ? 'ECMASCRIPT_2020'
461 : bundleType === BROWSER_SCRIPT
462 - ? 'ECMASCRIPT5'
463 - : 'ECMASCRIPT5_STRICT',
462 + ? 'ECMASCRIPT5'
463 + : 'ECMASCRIPT5_STRICT',
464 emit_use_strict:
465 bundleType !== BROWSER_SCRIPT &&
466 bundleType !== ESM_PROD &&
scripts/rollup/build.js
+2 -2
@@ -459,8 +459,8 @@ function getPlugins(
459 bundleType === NODE_ES2015
460 ? 'ECMASCRIPT_2020'
461 : bundleType === BROWSER_SCRIPT
462 - ? 'ECMASCRIPT5'
463 - : 'ECMASCRIPT5_STRICT',
462 + ? 'ECMASCRIPT5'
463 + : 'ECMASCRIPT5_STRICT',
464 emit_use_strict:
465 bundleType !== BROWSER_SCRIPT &&
466 bundleType !== ESM_PROD &&
yarn.lock
+4 -4
@@ -13206,10 +13206,10 @@ prepend-http@^2.0.0:
13206 resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
13207 integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
13208
13209 -prettier@*, prettier@3.0.3:
13210 - version "3.0.3"
13211 - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"
13212 - integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==
13209 +prettier@*, prettier@^3.3.3:
13210 + version "3.3.3"
13211 + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105"
13212 + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==
13213
13214 pretty-format@^27.2.5, pretty-format@^27.3.1:
13215 version "27.3.1"