@samitouri / QOS-React-1 / commits / c998bb1ed4

[compiler] Run prettier, fix snap

After this is merged, I'll add it to .git-blame-ignore-revs. I can't do it now as the hash will change after ghstack lands this stack. ghstack-source-id: 054ca869b7839c589524c47d1962262f6b50f8ed Pull Request resolved: https://github.com/facebook/react/pull/29214

Lauren Tan committed May 29, 2024 at 11:41 UTC c998bb1ed4b3285398c9c7797135d3f060243c6a
57 files changed +97 -105
compiler/apps/playground/colors.js
-1
@@ -5,7 +5,6 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 /**
9 * Sync from <https://github.com/reactjs/reactjs.org/blob/main/beta/colors.js>.
10 */
compiler/apps/playground/components/Editor/EditorImpl.tsx
+8 -10
@@ -43,7 +43,7 @@ import {
43 } from "./Output";
44
45 function parseFunctions(
46 - source: string,
46 + source: string
47 ): Array<
48 NodePath<
49 t.FunctionDeclaration | t.ArrowFunctionExpression | t.FunctionExpression
@@ -148,7 +148,7 @@ function isHookName(s: string): boolean {
148 }
149
150 function getReactFunctionType(
151 - id: NodePath<t.Identifier | null | undefined>,
151 + id: NodePath<t.Identifier | null | undefined>
152 ): ReactFunctionType {
153 if (id && id.node && id.isIdentifier()) {
154 if (isHookName(id.node.name)) {
@@ -189,7 +189,7 @@ function compile(source: string): CompilerOutput {
189 severity: ErrorSeverity.Todo,
190 loc: fn.node.loc ?? null,
191 suggestions: null,
192 - }),
192 + })
193 );
194 continue;
195 }
@@ -205,7 +205,7 @@ function compile(source: string): CompilerOutput {
205 "_c",
206 null,
207 null,
208 - null,
208 + null
209 )) {
210 const fnName = fn.node.id?.name ?? null;
211 switch (result.kind) {
@@ -274,7 +274,7 @@ function compile(source: string): CompilerOutput {
274 reason: `Unexpected failure when transforming input! ${err}`,
275 loc: null,
276 suggestions: null,
277 - }),
277 + })
278 );
279 }
280 }
@@ -291,7 +291,7 @@ export default function Editor() {
291 const { enqueueSnackbar } = useSnackbar();
292 const compilerOutput = useMemo(
293 () => compile(deferredStore.source),
294 - [deferredStore.source],
294 + [deferredStore.source]
295 );
296
297 useMountEffect(() => {
@@ -305,7 +305,7 @@ export default function Editor() {
305 ...createMessage(
306 "Bad URL - fell back to the default Playground.",
307 MessageLevel.Info,
308 - MessageSource.Playground,
308 + MessageSource.Playground
309 ),
310 });
311 mountStore = defaultStore;
@@ -319,9 +319,7 @@ export default function Editor() {
319 return (
320 <>
321 <div className="relative flex basis top-14">
322 - <div
323 - className={clsx("relative sm:basis-1/4")}
324 - >
322 + <div className={clsx("relative sm:basis-1/4")}>
323 <Input
324 errors={
325 compilerOutput.kind === "err" ? compilerOutput.error.details : []
compiler/apps/playground/components/Editor/Input.tsx
+1 -1
@@ -76,7 +76,7 @@ export default function Input({ errors }: Props) {
76 allowSyntheticDefaultImports: true,
77 };
78 monaco.languages.typescript.javascriptDefaults.setCompilerOptions(
79 - tscOptions,
79 + tscOptions
80 );
81 monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
82 ...tscOptions,
compiler/apps/playground/components/Editor/Output.tsx
+9 -9
@@ -106,7 +106,7 @@ async function tabify(source: string, compilerOutput: CompilerOutput) {
106 output={text}
107 diff={lastPassOutput ?? null}
108 showInfoPanel={true}
109 - ></TextTabContent>,
109 + ></TextTabContent>
110 );
111 lastPassOutput = text;
112 }
@@ -122,7 +122,7 @@ async function tabify(source: string, compilerOutput: CompilerOutput) {
122 output={code}
123 diff={null}
124 showInfoPanel={false}
125 - ></TextTabContent>,
125 + ></TextTabContent>
126 );
127 if (sourceMapUrl) {
128 reorderedTabs.set(
@@ -133,7 +133,7 @@ async function tabify(source: string, compilerOutput: CompilerOutput) {
133 className="w-full h-monaco_small sm:h-monaco"
134 title="Generated Code"
135 />
136 - </>,
136 + </>
137 );
138 }
139 }
@@ -145,16 +145,16 @@ async function tabify(source: string, compilerOutput: CompilerOutput) {
145
146 async function codegen(
147 ast: t.Program,
148 - source: string,
148 + source: string
149 ): Promise<{ code: any; sourceMapUrl: string | null }> {
150 const generated = generate(
151 ast,
152 { sourceMaps: true, sourceFileName: "input.js" },
153 - source,
153 + source
154 );
155 const sourceMapUrl = getSourceMapUrl(
156 generated.code,
157 - JSON.stringify(generated.map),
157 + JSON.stringify(generated.map)
158 );
159 const codegenOutput = await prettier.format(generated.code, {
160 semi: true,
@@ -172,14 +172,14 @@ function getSourceMapUrl(code: string, map: string): string | null {
172 code = utf16ToUTF8(code);
173 map = utf16ToUTF8(map);
174 return `https://evanw.github.io/source-map-visualization/#${btoa(
175 - `${code.length}\0${code}${map.length}\0${map}`,
175 + `${code.length}\0${code}${map.length}\0${map}`
176 )}`;
177 }
178
179 function Output({ store, compilerOutput }: Props) {
180 - const [tabsOpen, setTabsOpen] = useState<Set<string>>(() => new Set(['JS']));
180 + const [tabsOpen, setTabsOpen] = useState<Set<string>>(() => new Set(["JS"]));
181 const [tabs, setTabs] = useState<Map<string, React.ReactNode>>(
182 - () => new Map(),
182 + () => new Map()
183 );
184 useEffect(() => {
185 tabify(store.source, compilerOutput).then((tabs) => {
compiler/apps/playground/components/Editor/index.tsx
+1 -1
@@ -13,4 +13,4 @@ const Editor = dynamic(() => import("./EditorImpl"), {
13 ssr: false,
14 });
15
16 -export default Editor;
\ No newline at end of file
16 +export default Editor;
compiler/apps/playground/components/Editor/monacoOptions.ts
-1
@@ -5,7 +5,6 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 import type { EditorProps } from "@monaco-editor/react";
9
10 export const monacoOptions: Partial<EditorProps["options"]> = {
compiler/apps/playground/components/Header.tsx
+1 -1
@@ -50,7 +50,7 @@ export default function Header() {
50 <Logo
51 className={clsx(
52 "w-8 h-8 text-link",
53 - process.env.NODE_ENV === "development" && "text-yellow-600",
53 + process.env.NODE_ENV === "development" && "text-yellow-600"
54 )}
55 />
56 <p className="hidden select-none sm:block">React Compiler Playground</p>
compiler/apps/playground/components/Icons/IconGitHub.tsx
+1 -1
@@ -21,5 +21,5 @@ export const IconGitHub = memo<JSX.IntrinsicElements["svg"]>(
21 <path d="M10 0a10 10 0 0 0-3.16 19.49c.5.1.68-.22.68-.48l-.01-1.7c-2.78.6-3.37-1.34-3.37-1.34-.46-1.16-1.11-1.47-1.11-1.47-.9-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.52 2.34 1.08 2.91.83.1-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.1.39-1.99 1.03-2.69a3.6 3.6 0 0 1 .1-2.64s.84-.27 2.75 1.02a9.58 9.58 0 0 1 5 0c1.91-1.3 2.75-1.02 2.75-1.02.55 1.37.2 2.4.1 2.64.64.7 1.03 1.6 1.03 2.69 0 3.84-2.34 4.68-4.57 4.93.36.31.68.92.68 1.85l-.01 2.75c0 .26.18.58.69.48A10 10 0 0 0 10 0"></path>
22 </svg>
23 );
24 - },
24 + }
25 );
compiler/apps/playground/components/Logo.tsx
-1
@@ -5,7 +5,6 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 // https://github.com/reactjs/reactjs.org/blob/main/beta/src/components/Logo.tsx
9
10 export default function Logo(props: JSX.IntrinsicElements["svg"]) {
compiler/apps/playground/components/StoreContext.tsx
-1
@@ -5,7 +5,6 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 import type { Dispatch, ReactNode } from "react";
9 import { useReducer } from "react";
10 import createContext from "../lib/createContext";
compiler/apps/playground/components/TabbedWindow.tsx
+2 -2
@@ -78,7 +78,7 @@ function TabbedWindowItem({
78 title="Minimize tab"
79 aria-label="Minimize tab"
80 onClick={toggleTabs}
81 - className={`p-4 duration-150 ease-in border-b cursor-pointer border-grey-200 ${hasChanged ? 'font-bold' : 'font-light'} text-secondary hover:text-link`}
81 + className={`p-4 duration-150 ease-in border-b cursor-pointer border-grey-200 ${hasChanged ? "font-bold" : "font-light"} text-secondary hover:text-link`}
82 >
83 - {name}
84 </h2>
@@ -91,7 +91,7 @@ function TabbedWindowItem({
91 aria-label={`Expand compiler tab: ${name}`}
92 style={{ transform: "rotate(90deg) translate(-50%)" }}
93 onClick={toggleTabs}
94 - className={`flex-grow-0 w-5 transition-colors duration-150 ease-in ${hasChanged ? 'font-bold' : 'font-light'} text-secondary hover:text-link`}
94 + className={`flex-grow-0 w-5 transition-colors duration-150 ease-in ${hasChanged ? "font-bold" : "font-light"} text-secondary hover:text-link`}
95 >
96 {name}
97 </button>
compiler/apps/playground/components/index.ts
-1
@@ -5,7 +5,6 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 export { default as Editor } from "./Editor";
9 export { default as Header } from "./Header";
10 export { StoreProvider } from "./StoreContext";
compiler/apps/playground/hooks/index.ts
-1
@@ -5,5 +5,4 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 export { default as useMountEffect } from "./useMountEffect";
compiler/apps/playground/hooks/useMountEffect.ts
-1
@@ -5,7 +5,6 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 import type { EffectCallback } from "react";
9 import { useEffect } from "react";
10
compiler/apps/playground/lib/createContext.ts
-1
@@ -5,7 +5,6 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 import React from "react";
9
10 /**
compiler/apps/playground/lib/reactCompilerMonacoDiagnostics.ts
+4 -4
@@ -14,7 +14,7 @@ import { MarkerSeverity, type editor } from "monaco-editor";
14
15 function mapReactCompilerSeverityToMonaco(
16 level: ErrorSeverity,
17 - monaco: Monaco,
17 + monaco: Monaco
18 ): MarkerSeverity {
19 switch (level) {
20 case ErrorSeverity.Todo:
@@ -26,7 +26,7 @@ function mapReactCompilerSeverityToMonaco(
26
27 function mapReactCompilerDiagnosticToMonacoMarker(
28 detail: CompilerErrorDetail,
29 - monaco: Monaco,
29 + monaco: Monaco
30 ): editor.IMarkerData | null {
31 if (detail.loc == null || typeof detail.loc === "symbol") {
32 return null;
@@ -70,7 +70,7 @@ export function renderReactCompilerMarkers({
70 marker.startLineNumber,
71 marker.startColumn,
72 marker.endLineNumber,
73 - marker.endColumn,
73 + marker.endColumn
74 ),
75 options: {
76 isWholeLine: true,
@@ -83,7 +83,7 @@ export function renderReactCompilerMarkers({
83 monaco.editor.setModelMarkers(model, "owner", []);
84 decorations = model.deltaDecorations(
85 model.getAllDecorations().map((d) => d.id),
86 - [],
86 + []
87 );
88 }
89 }
compiler/apps/playground/lib/stores/index.ts
-1
@@ -5,6 +5,5 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 export * from "./messages";
9 export * from "./store";
compiler/apps/playground/lib/stores/messages.ts
-1
@@ -5,7 +5,6 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 export enum MessageSource {
9 Babel,
10 Forget,
compiler/apps/playground/next.config.js
+2 -2
@@ -23,7 +23,7 @@ const nextConfig = {
23 new MonacoWebpackPlugin({
24 languages: ["typescript", "javascript"],
25 filename: "static/[name].worker.js",
26 - }),
26 + })
27 );
28 }
29
@@ -31,7 +31,7 @@ const nextConfig = {
31 ...config.resolve.alias,
32 "react-compiler-runtime": path.resolve(
33 __dirname,
34 - "../../packages/react-compiler-runtime",
34 + "../../packages/react-compiler-runtime"
35 ),
36 };
37
compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts
+1 -1
@@ -78,7 +78,7 @@ export type ReactiveInstructionStatement = {
78 };
79
80 export type ReactiveTerminalStatement<
81 - Tterminal extends ReactiveTerminal = ReactiveTerminal
81 + Tterminal extends ReactiveTerminal = ReactiveTerminal,
82 > = {
83 kind: "terminal";
84 terminal: Tterminal;
compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts
+1 -1
@@ -876,7 +876,7 @@ export function mapTerminalSuccessors(
876
877 export function terminalHasFallthrough<
878 T extends Terminal,
879 - U extends T & { fallthrough: BlockId }
879 + U extends T & { fallthrough: BlockId },
880 >(terminal: T): terminal is U {
881 switch (terminal.kind) {
882 case "maybe-throw":
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts
+1 -1
@@ -257,7 +257,7 @@ export type Transformed<T> =
257 | { kind: "replace-many"; value: Array<T> };
258
259 export class ReactiveFunctionTransform<
260 - TState = void
260 + TState = void,
261 > extends ReactiveFunctionVisitor<TState> {
262 override traverseBlock(block: ReactiveBlock, state: TState): void {
263 let nextBlock: ReactiveBlock | null = null;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allocating-logical-expression-instruction-scope.expect.md
+1 -2
@@ -24,8 +24,7 @@ export const FIXTURE_ENTRYPOINT = {
24 ## Code
25
26 ```javascript
27 -import { c as _c } from "react/compiler-runtime";
28 -/**
27 +import { c as _c } from "react/compiler-runtime"; /**
28 * This is a weird case as data has type `BuiltInMixedReadonly`.
29 * The only scoped value we currently infer in this program is the
30 * PropertyLoad `data?.toString`.
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md
+1 -1
@@ -76,7 +76,7 @@ function getNativeLogFunction(level) {
76 INSPECTOR_LEVELS[logLevel],
77 str,
78 [].slice.call(arguments),
79 - INSPECTOR_FRAMES_TO_SKIP
79 + INSPECTOR_FRAMES_TO_SKIP,
80 );
81 }
82 if (groupStack.length) {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/computed-call-evaluation-order.expect.md
+1 -1
@@ -46,7 +46,7 @@ function Component() {
46 x = { f: () => console.log("original") };
47
48 (console.log("A"), x)[(console.log("B"), "f")](
49 - (changeF(x), console.log("arg"), 1)
49 + (changeF(x), console.log("arg"), 1),
50 );
51 $[1] = x;
52 } else {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md
+1 -2
@@ -29,8 +29,7 @@ export const FIXTURE_ENTRYPOINT = {
29 ## Code
30
31 ```javascript
32 -import { c as _c } from "react/compiler-runtime";
33 -/**
32 +import { c as _c } from "react/compiler-runtime"; /**
33 * props.b *does* influence `a`
34 */
35 function Component(props) {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-early-return.expect.md
+1 -2
@@ -66,8 +66,7 @@ export const FIXTURE_ENTRYPOINT = {
66 ## Code
67
68 ```javascript
69 -import { c as _c } from "react/compiler-runtime";
70 -/**
69 +import { c as _c } from "react/compiler-runtime"; /**
70 * props.b does *not* influence `a`
71 */
72 function ComponentA(props) {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbs-params.expect.md
+1 -1
@@ -40,7 +40,7 @@ function Component(props) {
40 title={fbs._(
41 "Hello {user name}",
42 [fbs._param("user name", props.name)],
43 - { hk: "2zEDKF" }
43 + { hk: "2zEDKF" },
44 )}
45 >
46 Hover me
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-call-complex-param-value.expect.md
+1 -1
@@ -34,7 +34,7 @@ function Component(props) {
34 t0 = fbt._(
35 "Hello, {(key) name}!",
36 [fbt._param("(key) name", identity(props.name))],
37 - { hk: "2sOsn5" }
37 + { hk: "2sOsn5" },
38 );
39 $[0] = props.name;
40 $[1] = t0;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-call.expect.md
+1 -1
@@ -32,7 +32,7 @@ function Component(props) {
32 t0 = fbt._(
33 "{(key) count} items",
34 [fbt._param("(key) count", props.count)],
35 - { hk: "3yW91j" }
35 + { hk: "3yW91j" },
36 );
37 $[0] = props.count;
38 $[1] = t0;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-no-whitespace-btw-text-and-param.expect.md
+1 -1
@@ -35,7 +35,7 @@ function Component(t0) {
35 t1 = fbt._(
36 "Before text{paramName}After text",
37 [fbt._param("paramName", value)],
38 - { hk: "aKEGX" }
38 + { hk: "aKEGX" },
39 );
40 $[0] = value;
41 $[1] = t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-leading-whitespace.expect.md
+2 -2
@@ -56,10 +56,10 @@ function Component(props) {
56 fbt._param(
57 "option",
58
59 - props.option
59 + props.option,
60 ),
61 ],
62 - { hk: "3Bg20a" }
62 + { hk: "3Bg20a" },
63 )}
64 !
65 </span>
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-trailing-whitespace.expect.md
+2 -2
@@ -56,10 +56,10 @@ function Component(props) {
56 fbt._param(
57 "option",
58
59 - props.option
59 + props.option,
60 ),
61 ],
62 - { hk: "3Bg20a" }
62 + { hk: "3Bg20a" },
63 )}
64 !
65 </span>
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params-complex-param-value.expect.md
+1 -1
@@ -27,7 +27,7 @@ function Component(props) {
27 t0 = fbt._(
28 "Hello {user name}",
29 [fbt._param("user name", capitalize(props.name))],
30 - { hk: "2zEDKF" }
30 + { hk: "2zEDKF" },
31 );
32 $[0] = props.name;
33 $[1] = t0;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-preserve-jsxtext.expect.md
+2 -2
@@ -36,10 +36,10 @@ function Foo(props) {
36 fbt._param(
37 "value",
38
39 - props.value
39 + props.value,
40 ),
41 ],
42 - { hk: "Ri5kJ" }
42 + { hk: "Ri5kJ" },
43 );
44 $[0] = props.value;
45 $[1] = t0;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-preserve-whitespace.expect.md
+2 -2
@@ -39,10 +39,10 @@ function Component(t0) {
39 fbt._param(
40 "paramName",
41
42 - value
42 + value,
43 ),
44 ],
45 - { hk: "3z5SVE" }
45 + { hk: "3z5SVE" },
46 );
47 $[0] = value;
48 $[1] = t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-single-space-btw-param-and-text.expect.md
+1 -1
@@ -35,7 +35,7 @@ function Component(t0) {
35 t1 = fbt._(
36 "Before text {paramName} after text",
37 [fbt._param("paramName", value)],
38 - { hk: "26pxNm" }
38 + { hk: "26pxNm" },
39 );
40 $[0] = value;
41 $[1] = t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-around-param-value.expect.md
+1 -1
@@ -35,7 +35,7 @@ function Component(t0) {
35 t1 = fbt._(
36 "Before text {paramName} after text",
37 [fbt._param("paramName", value)],
38 - { hk: "26pxNm" }
38 + { hk: "26pxNm" },
39 );
40 $[0] = value;
41 $[1] = t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-within-text.expect.md
+1 -1
@@ -37,7 +37,7 @@ function Component(t0) {
37 t1 = fbt._(
38 "Before text {paramName} after text more text and more and more and more and more and more and more and more and more and blah blah blah blah",
39 [fbt._param("paramName", value)],
40 - { hk: "24ZPpO" }
40 + { hk: "24ZPpO" },
41 );
42 $[0] = value;
43 $[1] = t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md
+4 -4
@@ -41,12 +41,12 @@ function Component(t0) {
41 fbt._param(
42 "item author",
43
44 - <Text type="h4">{name}</Text>
44 + <Text type="h4">{name}</Text>,
45 ),
46 fbt._param(
47 "icon",
48
49 - icon
49 + icon,
50 ),
51 fbt._implicitParam(
52 "=m2",
@@ -54,10 +54,10 @@ function Component(t0) {
54 {fbt._("{item details}", [fbt._param("item details", data)], {
55 hk: "4jLfVq",
56 })}
57 - </Text>
57 + </Text>,
58 ),
59 ],
60 - { hk: "2HLm2j" }
60 + { hk: "2HLm2j" },
61 )}
62 </Text>
63 );
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-fragment-value.expect.md
+1 -1
@@ -35,7 +35,7 @@ function Component(props) {
35 value={fbt._(
36 "{value}%",
37 [fbt._param("value", <>{identity(props.text)}</>)],
38 - { hk: "10F5Cc" }
38 + { hk: "10F5Cc" },
39 )}
40 />
41 );
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/lambda-with-fbt.expect.md
+1 -1
@@ -57,7 +57,7 @@ function Component() {
57 return fbt._(
58 "Gift | {price}",
59 [fbt._param("price", item?.current_gift_offer?.price?.formatted)],
60 - { hk: "3GTnGE" }
60 + { hk: "3GTnGE" },
61 );
62 } else {
63 if (!iconOnly && !showPrice) {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md
+1 -1
@@ -107,7 +107,7 @@ function Component(t0) {
107 } finally {
108 $dispatcherGuard(3);
109 }
110 - })()
110 + })(),
111 );
112 } finally {
113 $dispatcherGuard(3);
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-mutate.expect.md
+1 -1
@@ -35,7 +35,7 @@ function Component(_props) {
35 const results = [];
36 for (const item of collection) {
37 results.push(
38 - <div key={toJSON(item)}>{toJSON(mutateAndReturn(item))}</div>
38 + <div key={toJSON(item)}>{toJSON(mutateAndReturn(item))}</div>,
39 );
40 }
41
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md
+1 -1
@@ -46,7 +46,7 @@ function Component(props) {
46 () => {
47 console.log(props);
48 },
49 - [props.a]
49 + [props.a],
50 );
51 let t1;
52 if ($[2] !== x || $[3] !== item) {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/independent.expect.md
+1 -2
@@ -27,8 +27,7 @@ function Foo() {}
27 ## Code
28
29 ```javascript
30 -import { c as _c } from "react/compiler-runtime";
31 -/**
30 +import { c as _c } from "react/compiler-runtime"; /**
31 * Should produce 3 scopes:
32 *
33 * a: inputs=props.a, outputs=a
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-function-expression-React-memo-gating.expect.md
+1 -1
@@ -31,7 +31,7 @@ export default React.forwardRef(
31 }
32 : function notNamedLikeAComponent(props) {
33 return <div />;
34 - }
34 + },
35 );
36
37 ```
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/interdependent.expect.md
+1 -2
@@ -27,8 +27,7 @@ function Foo() {}
27 ## Code
28
29 ```javascript
30 -import { c as _c } from "react/compiler-runtime";
31 -/**
30 +import { c as _c } from "react/compiler-runtime"; /**
31 * Should produce 1 scope:
32 *
33 * return: inputs=props.a & props.b; outputs=return
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md
+1 -1
@@ -31,7 +31,7 @@ function Component(props) {
31 t0 = x?.(
32 <div>
33 <span>{props.text}</span>
34 - </div>
34 + </div>,
35 );
36 $[0] = props;
37 $[1] = t0;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/readonly-object-method-calls-mutable-lambda.expect.md
+1 -1
@@ -29,7 +29,7 @@ function Component(props) {
29 const x = makeObject();
30 const user = useFragment(
31 graphql`fragment Component_user on User { ... }`,
32 - props.user
32 + props.user,
33 );
34 const posts = user.timeline.posts.edges.nodes.map((node) => {
35 x.y = true;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/readonly-object-method-calls.expect.md
+1 -1
@@ -26,7 +26,7 @@ function Component(props) {
26 const $ = _c(5);
27 const user = useFragment(
28 graphql`fragment Component_user on User { ... }`,
29 - props.user
29 + props.user,
30 );
31 let posts;
32 if ($[0] !== user.timeline.posts.edges.nodes) {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary-reactive-scope-with-early-return.expect.md
+1 -1
@@ -56,7 +56,7 @@ function Component(props) {
56 {fbt._(
57 "Lorum ipsum{thing} blah blah blah",
58 [fbt._param("thing", object.b)],
59 - { hk: "lwmuH" }
59 + { hk: "lwmuH" },
60 )}
61 </div>
62 );
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unmerged-fbt-call-merge-overlapping-reactive-scopes.expect.md
+1 -1
@@ -42,7 +42,7 @@ function Component(props) {
42 const label = fbt._(
43 { "*": "{number} bars", _1: "1 bar" },
44 [fbt._plural(props.value.length, "number")],
45 - { hk: "4mUen7" }
45 + { hk: "4mUen7" },
46 );
47
48 t0 = props.cond ? (
compiler/packages/make-read-only-util/src/makeReadOnly.ts
+5 -1
@@ -127,7 +127,11 @@ function buildMakeReadOnly(
127 Object.getOwnPropertyDescriptors(o)
128 )) {
129 if (!cache.has(k) && isWriteable(prop)) {
130 - if (prop.hasOwnProperty("set") || prop.hasOwnProperty("get") || k === "current") {
130 + if (
131 + prop.hasOwnProperty("set") ||
132 + prop.hasOwnProperty("get") ||
133 + k === "current"
134 + ) {
135 // - we currently don't handle accessor properties
136 // - we currently have no other way of checking whether an object
137 // is a `ref` (i.e. returned by useRef).
compiler/packages/react-compiler-healthcheck/src/checks/reactCompiler.ts
+4 -4
@@ -16,7 +16,7 @@ import BabelPluginReactCompiler, {
16 import { LoggerEvent as RawLoggerEvent } from "babel-plugin-react-compiler/src/Entrypoint";
17 import chalk from "chalk";
18
19 -type LoggerEvent = RawLoggerEvent & {filename: string | null};
19 +type LoggerEvent = RawLoggerEvent & { filename: string | null };
20
21 const SucessfulCompilation: Array<LoggerEvent> = [];
22 const ActionableFailures: Array<LoggerEvent> = [];
@@ -24,7 +24,7 @@ const OtherFailures: Array<LoggerEvent> = [];
24
25 const logger = {
26 logEvent(filename: string | null, rawEvent: RawLoggerEvent) {
27 - const event = {...rawEvent, filename};
27 + const event = { ...rawEvent, filename };
28 switch (event.kind) {
29 case "CompileSuccess": {
30 SucessfulCompilation.push(event);
@@ -140,8 +140,8 @@ export default {
140 report(): void {
141 const totalComponents =
142 SucessfulCompilation.length +
143 - countUniqueLocInEvents(OtherFailures) +
144 - countUniqueLocInEvents(ActionableFailures)
143 + countUniqueLocInEvents(OtherFailures) +
144 + countUniqueLocInEvents(ActionableFailures);
145 console.log(
146 chalk.green(
147 `Successfully compiled ${SucessfulCompilation.length} out of ${totalComponents} components.`
compiler/packages/snap/src/compiler.ts
+7 -2
@@ -271,7 +271,10 @@ function getEvaluatorPresets(
271 );
272 return presets;
273 }
274 -async function format(inputCode: string, language: "typescript" | "flow"): Promise<string> {
274 +async function format(
275 + inputCode: string,
276 + language: "typescript" | "flow"
277 +): Promise<string> {
278 return await prettier.format(inputCode, {
279 semi: true,
280 parser: language === "typescript" ? "babel-ts" : "flow",
@@ -294,7 +297,9 @@ export async function transformFixtureInput(
297 parseConfigPragmaFn: typeof ParseConfigPragma,
298 plugin: BabelCore.PluginObj,
299 includeEvaluator: boolean
297 -): Promise<{ kind: "ok"; value: TransformResult } | { kind: "err"; msg: string }> {
300 +): Promise<
301 + { kind: "ok"; value: TransformResult } | { kind: "err"; msg: string }
302 +> {
303 // Extract the first line to quickly check for custom test directives
304 const firstLine = input.substring(0, input.indexOf("\n"));
305
compiler/scripts/release/publish-manual.js
+11 -11
@@ -25,7 +25,7 @@ const spawnHelper = util.promisify(_spawn);
25 function execHelper(command, options, streamStdout = false) {
26 return new Promise((resolve, reject) => {
27 const proc = cp.exec(command, options, (error, stdout) =>
28 - error ? reject(error) : resolve(stdout.trim()),
28 + error ? reject(error) : resolve(stdout.trim())
29 );
30 if (streamStdout) {
31 proc.stdout.pipe(process.stdout);
@@ -39,7 +39,7 @@ function sleep(ms) {
39
40 async function getDateStringForCommit(commit) {
41 let dateString = await execHelper(
42 - `git show -s --no-show-signature --format=%cd --date=format:%Y%m%d ${commit}`,
42 + `git show -s --no-show-signature --format=%cd --date=format:%Y%m%d ${commit}`
43 );
44
45 // On CI environment, this string is wrapped with quotes '...'s
@@ -99,7 +99,7 @@ async function main() {
99 const isPristine = (await execHelper("git status --porcelain")) === "";
100 if (currBranchName !== "main" || isPristine === false) {
101 throw new Error(
102 - "This script must be run from the `main` branch with no uncommitted changes",
102 + "This script must be run from the `main` branch with no uncommitted changes"
103 );
104 }
105 }
@@ -111,7 +111,7 @@ async function main() {
111 const spinner = ora(
112 `Preparing to publish ${
113 forReal === true ? "(for real)" : "(dry run)"
114 - } [debug=${debug}]`,
114 + } [debug=${debug}]`
115 ).info();
116
117 spinner.info("Building packages");
@@ -145,7 +145,7 @@ async function main() {
145 spinner.stop(`Successfully packed ${pkgName} (dry run)`);
146 }
147 spinner.succeed(
148 - "Please confirm contents of packages before publishing. You can run this command again with --for-real to publish to npm",
148 + "Please confirm contents of packages before publishing. You can run this command again with --for-real to publish to npm"
149 );
150 }
151
@@ -155,7 +155,7 @@ async function main() {
155 "git show -s --no-show-signature --format=%h",
156 {
157 cwd: path.resolve(__dirname, ".."),
158 - },
158 + }
159 );
160 const dateString = await getDateStringForCommit(commit);
161
@@ -175,20 +175,20 @@ async function main() {
175 `yarn version --new-version ${newVersion} --no-git-tag-version`,
176 {
177 cwd: pkgDir,
178 - },
178 + }
179 );
180 await execHelper(
181 `git add package.json && git commit -m "Bump version to ${newVersion}"`,
182 {
183 cwd: pkgDir,
184 - },
184 + }
185 );
186 } catch (e) {
187 spinner.fail(e.toString());
188 throw e;
189 }
190 spinner.succeed(
191 - `Bumped ${pkgName} to ${newVersion} and added a git commit`,
191 + `Bumped ${pkgName} to ${newVersion} and added a git commit`
192 );
193 }
194
@@ -196,7 +196,7 @@ async function main() {
196 spinner.info(
197 `🚨🚨🚨 About to publish to npm in ${
198 TIME_TO_RECONSIDER / 1000
199 - } seconds. You still have time to kill this script!`,
199 + } seconds. You still have time to kill this script!`
200 );
201 await sleep(TIME_TO_RECONSIDER);
202 }
@@ -214,7 +214,7 @@ async function main() {
214 {
215 cwd: pkgDir,
216 stdio: "inherit",
217 - },
217 + }
218 );
219 console.log("\n");
220 } catch (e) {