diff --git a/.github/workflows/compiler-typescript.yml b/.github/workflows/compiler-typescript.yml index 1448f6696176d..4b4a668c724e1 100644 --- a/.github/workflows/compiler-typescript.yml +++ b/.github/workflows/compiler-typescript.yml @@ -24,6 +24,25 @@ jobs: run: echo "matrix=$(find packages -mindepth 1 -maxdepth 1 -type d | sed 's!packages/!!g' | tr '\n' ',' | sed s/.$// | jq -Rsc '. / "," - [""]')" >> $GITHUB_OUTPUT # Hardcoded to improve parallelism for babel-plugin-react-compiler + prettier: + name: Run prettier + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: "yarn" + cache-dependency-path: compiler/yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + with: + path: "**/node_modules" + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('compiler/**/yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: yarn prettier:ci + + # Hardcoded to improve parallelism lint: name: Lint babel-plugin-react-compiler runs-on: ubuntu-latest @@ -40,10 +59,9 @@ jobs: path: "**/node_modules" key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('compiler/**/yarn.lock') }} - run: yarn install --frozen-lockfile - - run: yarn workspace babel-plugin-react-compiler prettier:ci - run: yarn workspace babel-plugin-react-compiler lint - # Hardcoded to improve parallelism for babel-plugin-react-compiler + # Hardcoded to improve parallelism jest: name: Jest babel-plugin-react-compiler runs-on: ubuntu-latest diff --git a/compiler/apps/playground/colors.js b/compiler/apps/playground/colors.js index fb9f181af5ecc..7259e1f32bc8f 100644 --- a/compiler/apps/playground/colors.js +++ b/compiler/apps/playground/colors.js @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ - /** * Sync from . */ diff --git a/compiler/apps/playground/components/Editor/EditorImpl.tsx b/compiler/apps/playground/components/Editor/EditorImpl.tsx index 340a7cd0a7fe8..e8a1177b4e439 100644 --- a/compiler/apps/playground/components/Editor/EditorImpl.tsx +++ b/compiler/apps/playground/components/Editor/EditorImpl.tsx @@ -43,7 +43,7 @@ import { } from "./Output"; function parseFunctions( - source: string, + source: string ): Array< NodePath< t.FunctionDeclaration | t.ArrowFunctionExpression | t.FunctionExpression @@ -148,7 +148,7 @@ function isHookName(s: string): boolean { } function getReactFunctionType( - id: NodePath, + id: NodePath ): ReactFunctionType { if (id && id.node && id.isIdentifier()) { if (isHookName(id.node.name)) { @@ -189,7 +189,7 @@ function compile(source: string): CompilerOutput { severity: ErrorSeverity.Todo, loc: fn.node.loc ?? null, suggestions: null, - }), + }) ); continue; } @@ -205,7 +205,7 @@ function compile(source: string): CompilerOutput { "_c", null, null, - null, + null )) { const fnName = fn.node.id?.name ?? null; switch (result.kind) { @@ -274,7 +274,7 @@ function compile(source: string): CompilerOutput { reason: `Unexpected failure when transforming input! ${err}`, loc: null, suggestions: null, - }), + }) ); } } @@ -291,7 +291,7 @@ export default function Editor() { const { enqueueSnackbar } = useSnackbar(); const compilerOutput = useMemo( () => compile(deferredStore.source), - [deferredStore.source], + [deferredStore.source] ); useMountEffect(() => { @@ -305,7 +305,7 @@ export default function Editor() { ...createMessage( "Bad URL - fell back to the default Playground.", MessageLevel.Info, - MessageSource.Playground, + MessageSource.Playground ), }); mountStore = defaultStore; @@ -319,9 +319,7 @@ export default function Editor() { return ( <>
-
+
, + > ); lastPassOutput = text; } @@ -122,7 +122,7 @@ async function tabify(source: string, compilerOutput: CompilerOutput) { output={code} diff={null} showInfoPanel={false} - >, + > ); if (sourceMapUrl) { reorderedTabs.set( @@ -133,7 +133,7 @@ async function tabify(source: string, compilerOutput: CompilerOutput) { className="w-full h-monaco_small sm:h-monaco" title="Generated Code" /> - , + ); } } @@ -145,16 +145,16 @@ async function tabify(source: string, compilerOutput: CompilerOutput) { async function codegen( ast: t.Program, - source: string, + source: string ): Promise<{ code: any; sourceMapUrl: string | null }> { const generated = generate( ast, { sourceMaps: true, sourceFileName: "input.js" }, - source, + source ); const sourceMapUrl = getSourceMapUrl( generated.code, - JSON.stringify(generated.map), + JSON.stringify(generated.map) ); const codegenOutput = await prettier.format(generated.code, { semi: true, @@ -172,14 +172,14 @@ function getSourceMapUrl(code: string, map: string): string | null { code = utf16ToUTF8(code); map = utf16ToUTF8(map); return `https://evanw.github.io/source-map-visualization/#${btoa( - `${code.length}\0${code}${map.length}\0${map}`, + `${code.length}\0${code}${map.length}\0${map}` )}`; } function Output({ store, compilerOutput }: Props) { - const [tabsOpen, setTabsOpen] = useState>(() => new Set(['JS'])); + const [tabsOpen, setTabsOpen] = useState>(() => new Set(["JS"])); const [tabs, setTabs] = useState>( - () => new Map(), + () => new Map() ); useEffect(() => { tabify(store.source, compilerOutput).then((tabs) => { diff --git a/compiler/apps/playground/components/Editor/index.tsx b/compiler/apps/playground/components/Editor/index.tsx index 8a32f962bce8b..81b3b75e3452c 100644 --- a/compiler/apps/playground/components/Editor/index.tsx +++ b/compiler/apps/playground/components/Editor/index.tsx @@ -13,4 +13,4 @@ const Editor = dynamic(() => import("./EditorImpl"), { ssr: false, }); -export default Editor; \ No newline at end of file +export default Editor; diff --git a/compiler/apps/playground/components/Editor/monacoOptions.ts b/compiler/apps/playground/components/Editor/monacoOptions.ts index df6fccef459cf..d5ce32039cd91 100644 --- a/compiler/apps/playground/components/Editor/monacoOptions.ts +++ b/compiler/apps/playground/components/Editor/monacoOptions.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ - import type { EditorProps } from "@monaco-editor/react"; export const monacoOptions: Partial = { diff --git a/compiler/apps/playground/components/Header.tsx b/compiler/apps/playground/components/Header.tsx index c8996a74945a7..2588e6d25c9a4 100644 --- a/compiler/apps/playground/components/Header.tsx +++ b/compiler/apps/playground/components/Header.tsx @@ -50,7 +50,7 @@ export default function Header() {

React Compiler Playground

diff --git a/compiler/apps/playground/components/Icons/IconGitHub.tsx b/compiler/apps/playground/components/Icons/IconGitHub.tsx index af3b54fda035b..b96d6a6aa7091 100644 --- a/compiler/apps/playground/components/Icons/IconGitHub.tsx +++ b/compiler/apps/playground/components/Icons/IconGitHub.tsx @@ -21,5 +21,5 @@ export const IconGitHub = memo( ); - }, + } ); diff --git a/compiler/apps/playground/components/Logo.tsx b/compiler/apps/playground/components/Logo.tsx index 54ad5fffa684a..07ab2bd265721 100644 --- a/compiler/apps/playground/components/Logo.tsx +++ b/compiler/apps/playground/components/Logo.tsx @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ - // https://github.com/reactjs/reactjs.org/blob/main/beta/src/components/Logo.tsx export default function Logo(props: JSX.IntrinsicElements["svg"]) { diff --git a/compiler/apps/playground/components/StoreContext.tsx b/compiler/apps/playground/components/StoreContext.tsx index 09dafae813cea..2f533c50c5173 100644 --- a/compiler/apps/playground/components/StoreContext.tsx +++ b/compiler/apps/playground/components/StoreContext.tsx @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ - import type { Dispatch, ReactNode } from "react"; import { useReducer } from "react"; import createContext from "../lib/createContext"; diff --git a/compiler/apps/playground/components/TabbedWindow.tsx b/compiler/apps/playground/components/TabbedWindow.tsx index 29d094298e5da..6d7ed3517bf77 100644 --- a/compiler/apps/playground/components/TabbedWindow.tsx +++ b/compiler/apps/playground/components/TabbedWindow.tsx @@ -78,7 +78,7 @@ function TabbedWindowItem({ title="Minimize tab" aria-label="Minimize tab" onClick={toggleTabs} - className={`p-4 duration-150 ease-in border-b cursor-pointer border-grey-200 ${hasChanged ? 'font-bold' : 'font-light'} text-secondary hover:text-link`} + className={`p-4 duration-150 ease-in border-b cursor-pointer border-grey-200 ${hasChanged ? "font-bold" : "font-light"} text-secondary hover:text-link`} > - {name} @@ -91,7 +91,7 @@ function TabbedWindowItem({ aria-label={`Expand compiler tab: ${name}`} style={{ transform: "rotate(90deg) translate(-50%)" }} onClick={toggleTabs} - className={`flex-grow-0 w-5 transition-colors duration-150 ease-in ${hasChanged ? 'font-bold' : 'font-light'} text-secondary hover:text-link`} + className={`flex-grow-0 w-5 transition-colors duration-150 ease-in ${hasChanged ? "font-bold" : "font-light"} text-secondary hover:text-link`} > {name} diff --git a/compiler/apps/playground/components/index.ts b/compiler/apps/playground/components/index.ts index 283a7c74cc3fc..b4018dace3120 100644 --- a/compiler/apps/playground/components/index.ts +++ b/compiler/apps/playground/components/index.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ - export { default as Editor } from "./Editor"; export { default as Header } from "./Header"; export { StoreProvider } from "./StoreContext"; diff --git a/compiler/apps/playground/hooks/index.ts b/compiler/apps/playground/hooks/index.ts index 2cca4a9007fde..04ad9063af4c4 100644 --- a/compiler/apps/playground/hooks/index.ts +++ b/compiler/apps/playground/hooks/index.ts @@ -5,5 +5,4 @@ * LICENSE file in the root directory of this source tree. */ - export { default as useMountEffect } from "./useMountEffect"; diff --git a/compiler/apps/playground/hooks/useMountEffect.ts b/compiler/apps/playground/hooks/useMountEffect.ts index b08003bcf74b1..a37e0535138b2 100644 --- a/compiler/apps/playground/hooks/useMountEffect.ts +++ b/compiler/apps/playground/hooks/useMountEffect.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ - import type { EffectCallback } from "react"; import { useEffect } from "react"; diff --git a/compiler/apps/playground/lib/createContext.ts b/compiler/apps/playground/lib/createContext.ts index c6f129b7d2eef..f9e00ee90abed 100644 --- a/compiler/apps/playground/lib/createContext.ts +++ b/compiler/apps/playground/lib/createContext.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ - import React from "react"; /** diff --git a/compiler/apps/playground/lib/reactCompilerMonacoDiagnostics.ts b/compiler/apps/playground/lib/reactCompilerMonacoDiagnostics.ts index 9a7084cd695cf..b5dbb03d5c5e7 100644 --- a/compiler/apps/playground/lib/reactCompilerMonacoDiagnostics.ts +++ b/compiler/apps/playground/lib/reactCompilerMonacoDiagnostics.ts @@ -14,7 +14,7 @@ import { MarkerSeverity, type editor } from "monaco-editor"; function mapReactCompilerSeverityToMonaco( level: ErrorSeverity, - monaco: Monaco, + monaco: Monaco ): MarkerSeverity { switch (level) { case ErrorSeverity.Todo: @@ -26,7 +26,7 @@ function mapReactCompilerSeverityToMonaco( function mapReactCompilerDiagnosticToMonacoMarker( detail: CompilerErrorDetail, - monaco: Monaco, + monaco: Monaco ): editor.IMarkerData | null { if (detail.loc == null || typeof detail.loc === "symbol") { return null; @@ -70,7 +70,7 @@ export function renderReactCompilerMarkers({ marker.startLineNumber, marker.startColumn, marker.endLineNumber, - marker.endColumn, + marker.endColumn ), options: { isWholeLine: true, @@ -83,7 +83,7 @@ export function renderReactCompilerMarkers({ monaco.editor.setModelMarkers(model, "owner", []); decorations = model.deltaDecorations( model.getAllDecorations().map((d) => d.id), - [], + [] ); } } diff --git a/compiler/apps/playground/lib/stores/index.ts b/compiler/apps/playground/lib/stores/index.ts index 880ec1c2fd7d7..aa00e375f1062 100644 --- a/compiler/apps/playground/lib/stores/index.ts +++ b/compiler/apps/playground/lib/stores/index.ts @@ -5,6 +5,5 @@ * LICENSE file in the root directory of this source tree. */ - export * from "./messages"; export * from "./store"; diff --git a/compiler/apps/playground/lib/stores/messages.ts b/compiler/apps/playground/lib/stores/messages.ts index f3f1495783449..7c791386c53d7 100644 --- a/compiler/apps/playground/lib/stores/messages.ts +++ b/compiler/apps/playground/lib/stores/messages.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ - export enum MessageSource { Babel, Forget, diff --git a/compiler/apps/playground/next.config.js b/compiler/apps/playground/next.config.js index 4d00624b35678..ddb2f958caedf 100644 --- a/compiler/apps/playground/next.config.js +++ b/compiler/apps/playground/next.config.js @@ -23,7 +23,7 @@ const nextConfig = { new MonacoWebpackPlugin({ languages: ["typescript", "javascript"], filename: "static/[name].worker.js", - }), + }) ); } @@ -31,7 +31,7 @@ const nextConfig = { ...config.resolve.alias, "react-compiler-runtime": path.resolve( __dirname, - "../../packages/react-compiler-runtime", + "../../packages/react-compiler-runtime" ), }; diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts index a9cb55e39e147..da900c275ca7e 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts @@ -78,7 +78,7 @@ export type ReactiveInstructionStatement = { }; export type ReactiveTerminalStatement< - Tterminal extends ReactiveTerminal = ReactiveTerminal + Tterminal extends ReactiveTerminal = ReactiveTerminal, > = { kind: "terminal"; terminal: Tterminal; diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts index e6e5878cc0dd9..aaf3ffc4c5379 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts @@ -876,7 +876,7 @@ export function mapTerminalSuccessors( export function terminalHasFallthrough< T extends Terminal, - U extends T & { fallthrough: BlockId } + U extends T & { fallthrough: BlockId }, >(terminal: T): terminal is U { switch (terminal.kind) { case "maybe-throw": diff --git a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts index 2e2fd1b5d05c9..4d40f6537b496 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts @@ -257,7 +257,7 @@ export type Transformed = | { kind: "replace-many"; value: Array }; export class ReactiveFunctionTransform< - TState = void + TState = void, > extends ReactiveFunctionVisitor { override traverseBlock(block: ReactiveBlock, state: TState): void { let nextBlock: ReactiveBlock | null = null; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allocating-logical-expression-instruction-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allocating-logical-expression-instruction-scope.expect.md index 84887a36c6039..f7bf45db86b97 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allocating-logical-expression-instruction-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allocating-logical-expression-instruction-scope.expect.md @@ -24,8 +24,7 @@ export const FIXTURE_ENTRYPOINT = { ## Code ```javascript -import { c as _c } from "react/compiler-runtime"; -/** +import { c as _c } from "react/compiler-runtime"; /** * This is a weird case as data has type `BuiltInMixedReadonly`. * The only scoped value we currently infer in this program is the * PropertyLoad `data?.toString`. diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md index 8b9da4435b5d2..c3f7e3b0c26e2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md @@ -7,7 +7,7 @@ function Component(props) { const y = x(
{props.text} -
+
, ); return y; } diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md index 3e3c262220e67..1b0ef7a27717e 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md @@ -30,7 +30,7 @@ function getNativeLogFunction(level) { INSPECTOR_LEVELS[logLevel], str, [].slice.call(arguments), - INSPECTOR_FRAMES_TO_SKIP + INSPECTOR_FRAMES_TO_SKIP, ); } if (groupStack.length) { @@ -76,7 +76,7 @@ function getNativeLogFunction(level) { INSPECTOR_LEVELS[logLevel], str, [].slice.call(arguments), - INSPECTOR_FRAMES_TO_SKIP + INSPECTOR_FRAMES_TO_SKIP, ); } if (groupStack.length) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md index cf60e8c0d3370..f36e904eaf094 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md @@ -7,7 +7,7 @@ function Foo(props) { (reason) => { log(props.router.location); }, - [props.router.location] + [props.router.location], ); return onFoo; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/computed-call-evaluation-order.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/computed-call-evaluation-order.expect.md index 3ea5625688d27..44b745e16c3ad 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/computed-call-evaluation-order.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/computed-call-evaluation-order.expect.md @@ -12,7 +12,7 @@ function Component() { }; (console.log("A"), x)[(console.log("B"), "f")]( - (changeF(x), console.log("arg"), 1) + (changeF(x), console.log("arg"), 1), ); return x; } @@ -46,7 +46,7 @@ function Component() { x = { f: () => console.log("original") }; (console.log("A"), x)[(console.log("B"), "f")]( - (changeF(x), console.log("arg"), 1) + (changeF(x), console.log("arg"), 1), ); $[1] = x; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md index 5160f9fecb972..2c6b373f0c45c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md @@ -29,8 +29,7 @@ export const FIXTURE_ENTRYPOINT = { ## Code ```javascript -import { c as _c } from "react/compiler-runtime"; -/** +import { c as _c } from "react/compiler-runtime"; /** * props.b *does* influence `a` */ function Component(props) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-early-return.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-early-return.expect.md index 1cc33444dc20e..04012db573309 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-early-return.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-early-return.expect.md @@ -66,8 +66,7 @@ export const FIXTURE_ENTRYPOINT = { ## Code ```javascript -import { c as _c } from "react/compiler-runtime"; -/** +import { c as _c } from "react/compiler-runtime"; /** * props.b does *not* influence `a` */ function ComponentA(props) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.default-param-accesses-local.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.default-param-accesses-local.expect.md index dbf084466d80d..cf629066e74fd 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.default-param-accesses-local.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.default-param-accesses-local.expect.md @@ -6,7 +6,7 @@ function Component( x, y = () => { return x; - } + }, ) { return y(); } @@ -28,7 +28,7 @@ export const FIXTURE_ENTRYPOINT = { | ^^^^^^^ > 4 | return x; | ^^^^^^^^^^^^^ -> 5 | } +> 5 | }, | ^^^^ Todo: (BuildHIR::node.lowerReorderableExpression) Expression type `ArrowFunctionExpression` cannot be safely reordered (3:5) 6 | ) { 7 | return y(); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.sketchy-code-exhaustive-deps.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.sketchy-code-exhaustive-deps.expect.md index 78342576a64b6..8f5b79f1c10ad 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.sketchy-code-exhaustive-deps.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.sketchy-code-exhaustive-deps.expect.md @@ -8,7 +8,7 @@ function Component() { () => { item.push(1); }, // eslint-disable-next-line react-hooks/exhaustive-deps - [] + [], ); return
, ); } return
{items}
; @@ -43,7 +43,7 @@ export const FIXTURE_ENTRYPOINT = { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 12 | {key} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 13 |
+> 13 | , | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 14 | ); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-for-of-loop-with-context-variable-iterator.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-for-of-loop-with-context-variable-iterator.expect.md index 05b17b3137a9d..754f691f170f9 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-for-of-loop-with-context-variable-iterator.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-for-of-loop-with-context-variable-iterator.expect.md @@ -14,7 +14,7 @@ function Component(props) { items.push(
data.set(item)}> {item.id} -
+ , ); } return
{items}
; @@ -43,7 +43,7 @@ export const FIXTURE_ENTRYPOINT = { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 12 | {item.id} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 13 | +> 13 | , | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 14 | ); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.useMemo-non-literal-depslist.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.useMemo-non-literal-depslist.expect.md index 285d3e0361e71..a74cc2da913ae 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.useMemo-non-literal-depslist.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.useMemo-non-literal-depslist.expect.md @@ -11,7 +11,7 @@ function App({ text, hasDeps }) { () => { return text.toUpperCase(); }, - hasDeps ? null : [text] // should be DCE'd + hasDeps ? null : [text], // should be DCE'd ); return resolvedText; } @@ -30,7 +30,7 @@ export const FIXTURE_ENTRYPOINT = { ``` 8 | return text.toUpperCase(); 9 | }, -> 10 | hasDeps ? null : [text] // should be DCE'd +> 10 | hasDeps ? null : [text], // should be DCE'd | ^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Expected the dependency list for useMemo to be an array literal (10:10) 11 | ); 12 | return resolvedText; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbs-params.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbs-params.expect.md index 68c74a3c04129..d2a4c665aff11 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbs-params.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbs-params.expect.md @@ -40,7 +40,7 @@ function Component(props) { title={fbs._( "Hello {user name}", [fbs._param("user name", props.name)], - { hk: "2zEDKF" } + { hk: "2zEDKF" }, )} > Hover me diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-call-complex-param-value.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-call-complex-param-value.expect.md index 0b76eb43e017c..40afaadd059b3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-call-complex-param-value.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-call-complex-param-value.expect.md @@ -8,7 +8,7 @@ import { identity } from "shared-runtime"; function Component(props) { const text = fbt( `Hello, ${fbt.param("(key) name", identity(props.name))}!`, - "(description) Greeting" + "(description) Greeting", ); return
{text}
; } @@ -34,7 +34,7 @@ function Component(props) { t0 = fbt._( "Hello, {(key) name}!", [fbt._param("(key) name", identity(props.name))], - { hk: "2sOsn5" } + { hk: "2sOsn5" }, ); $[0] = props.name; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-call.expect.md index ca0d760534d49..d4b5f7e487a06 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-call.expect.md @@ -7,7 +7,7 @@ import fbt from "fbt"; function Component(props) { const text = fbt( `${fbt.param("(key) count", props.count)} items`, - "(description) Number of items" + "(description) Number of items", ); return
{text}
; } @@ -32,7 +32,7 @@ function Component(props) { t0 = fbt._( "{(key) count} items", [fbt._param("(key) count", props.count)], - { hk: "3yW91j" } + { hk: "3yW91j" }, ); $[0] = props.count; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-no-whitespace-btw-text-and-param.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-no-whitespace-btw-text-and-param.expect.md index a080b44870264..b48c92bb761d0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-no-whitespace-btw-text-and-param.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-no-whitespace-btw-text-and-param.expect.md @@ -35,7 +35,7 @@ function Component(t0) { t1 = fbt._( "Before text{paramName}After text", [fbt._param("paramName", value)], - { hk: "aKEGX" } + { hk: "aKEGX" }, ); $[0] = value; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-leading-whitespace.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-leading-whitespace.expect.md index 1b7fa4353b68d..a62bbbcdf90de 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-leading-whitespace.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-leading-whitespace.expect.md @@ -56,10 +56,10 @@ function Component(props) { fbt._param( "option", - props.option + props.option, ), ], - { hk: "3Bg20a" } + { hk: "3Bg20a" }, )} ! diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-trailing-whitespace.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-trailing-whitespace.expect.md index 6c2a7e8572b30..3f5fdf9a2b6e6 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-trailing-whitespace.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-trailing-whitespace.expect.md @@ -56,10 +56,10 @@ function Component(props) { fbt._param( "option", - props.option + props.option, ), ], - { hk: "3Bg20a" } + { hk: "3Bg20a" }, )} ! diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params-complex-param-value.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params-complex-param-value.expect.md index 2bfd419adad01..44461081d7d03 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params-complex-param-value.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params-complex-param-value.expect.md @@ -27,7 +27,7 @@ function Component(props) { t0 = fbt._( "Hello {user name}", [fbt._param("user name", capitalize(props.name))], - { hk: "2zEDKF" } + { hk: "2zEDKF" }, ); $[0] = props.name; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-preserve-jsxtext.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-preserve-jsxtext.expect.md index f4eeb80bb46d1..d2f10350bc148 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-preserve-jsxtext.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-preserve-jsxtext.expect.md @@ -36,10 +36,10 @@ function Foo(props) { fbt._param( "value", - props.value + props.value, ), ], - { hk: "Ri5kJ" } + { hk: "Ri5kJ" }, ); $[0] = props.value; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-preserve-whitespace.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-preserve-whitespace.expect.md index 995f9c6ffc3dc..5e67bbc163194 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-preserve-whitespace.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-preserve-whitespace.expect.md @@ -39,10 +39,10 @@ function Component(t0) { fbt._param( "paramName", - value + value, ), ], - { hk: "3z5SVE" } + { hk: "3z5SVE" }, ); $[0] = value; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-single-space-btw-param-and-text.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-single-space-btw-param-and-text.expect.md index 4d29c6650c63f..7fa312c49f791 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-single-space-btw-param-and-text.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-single-space-btw-param-and-text.expect.md @@ -35,7 +35,7 @@ function Component(t0) { t1 = fbt._( "Before text {paramName} after text", [fbt._param("paramName", value)], - { hk: "26pxNm" } + { hk: "26pxNm" }, ); $[0] = value; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-template-string-same-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-template-string-same-scope.expect.md index 2e792bf896482..f5c5e816340a1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-template-string-same-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-template-string-same-scope.expect.md @@ -15,7 +15,7 @@ export function Component(props) { {fbt( `for ${fbt.param("count", count)} experiences`, `Label for the number of items`, - { project: "public" } + { project: "public" }, )} ); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-around-param-value.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-around-param-value.expect.md index bd62994eaa891..3bfd3bab52c15 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-around-param-value.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-around-param-value.expect.md @@ -35,7 +35,7 @@ function Component(t0) { t1 = fbt._( "Before text {paramName} after text", [fbt._param("paramName", value)], - { hk: "26pxNm" } + { hk: "26pxNm" }, ); $[0] = value; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-within-text.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-within-text.expect.md index 16aecf45803b0..55326204caa41 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-within-text.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-within-text.expect.md @@ -37,7 +37,7 @@ function Component(t0) { t1 = fbt._( "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", [fbt._param("paramName", value)], - { hk: "24ZPpO" } + { hk: "24ZPpO" }, ); $[0] = value; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md index fd0c5e72e3207..387031fc181c7 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md @@ -41,12 +41,12 @@ function Component(t0) { fbt._param( "item author", - {name} + {name}, ), fbt._param( "icon", - icon + icon, ), fbt._implicitParam( "=m2", @@ -54,10 +54,10 @@ function Component(t0) { {fbt._("{item details}", [fbt._param("item details", data)], { hk: "4jLfVq", })} - + , ), ], - { hk: "2HLm2j" } + { hk: "2HLm2j" }, )} ); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-fragment-value.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-fragment-value.expect.md index 20c916cbff73e..210bad8cf16ee 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-fragment-value.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-fragment-value.expect.md @@ -35,7 +35,7 @@ function Component(props) { value={fbt._( "{value}%", [fbt._param("value", <>{identity(props.text)})], - { hk: "10F5Cc" } + { hk: "10F5Cc" }, )} /> ); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/lambda-with-fbt.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/lambda-with-fbt.expect.md index bb85e2c0becad..5ac0ad17a0645 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/lambda-with-fbt.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/lambda-with-fbt.expect.md @@ -57,7 +57,7 @@ function Component() { return fbt._( "Gift | {price}", [fbt._param("price", item?.current_gift_offer?.price?.formatted)], - { hk: "3GTnGE" } + { hk: "3GTnGE" }, ); } else { if (!iconOnly && !showPrice) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md index e49b3a4189538..b3a98ab6269ff 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md @@ -107,7 +107,7 @@ function Component(t0) { } finally { $dispatcherGuard(3); } - })() + })(), ); } finally { $dispatcherGuard(3); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-mutate.expect.md index 98f132d44f321..e8175be98e8b6 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-mutate.expect.md @@ -35,7 +35,7 @@ function Component(_props) { const results = []; for (const item of collection) { results.push( -
{toJSON(mutateAndReturn(item))}
+
{toJSON(mutateAndReturn(item))}
, ); } diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md index 4010d006998ad..b7e0749c08b41 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md @@ -11,7 +11,7 @@ function Component(props) { () => { console.log(props); }, - [props.a] + [props.a], ); return [x, item]; } @@ -46,7 +46,7 @@ function Component(props) { () => { console.log(props); }, - [props.a] + [props.a], ); let t1; if ($[2] !== x || $[3] !== item) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/independent.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/independent.expect.md index b981b0adaa23c..ac8a952e78d9e 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/independent.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/independent.expect.md @@ -27,8 +27,7 @@ function Foo() {} ## Code ```javascript -import { c as _c } from "react/compiler-runtime"; -/** +import { c as _c } from "react/compiler-runtime"; /** * Should produce 3 scopes: * * a: inputs=props.a, outputs=a diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-function-expression-React-memo-gating.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-function-expression-React-memo-gating.expect.md index d513bffd4f31f..91d4fc15fbf29 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-function-expression-React-memo-gating.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-function-expression-React-memo-gating.expect.md @@ -31,7 +31,7 @@ export default React.forwardRef( } : function notNamedLikeAComponent(props) { return
; - } + }, ); ``` diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/interdependent.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/interdependent.expect.md index 243331bfe889a..32e87ab33f2e6 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/interdependent.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/interdependent.expect.md @@ -27,8 +27,7 @@ function Foo() {} ## Code ```javascript -import { c as _c } from "react/compiler-runtime"; -/** +import { c as _c } from "react/compiler-runtime"; /** * Should produce 1 scope: * * return: inputs=props.a & props.b; outputs=return diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md index b47275f203ac4..fc1e711661dca 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md @@ -11,7 +11,7 @@ function Component(props) { const y = x?.(
{props.text} -
+
, ); return y; } @@ -31,7 +31,7 @@ function Component(props) { t0 = x?.(
{props.text} -
+ , ); $[0] = props; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/readonly-object-method-calls-mutable-lambda.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/readonly-object-method-calls-mutable-lambda.expect.md index bc275604f784f..b6111b424dd9d 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/readonly-object-method-calls-mutable-lambda.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/readonly-object-method-calls-mutable-lambda.expect.md @@ -6,7 +6,7 @@ function Component(props) { const x = makeObject(); const user = useFragment( graphql`fragment Component_user on User { ... }`, - props.user + props.user, ); const posts = user.timeline.posts.edges.nodes.map((node) => { x.y = true; @@ -29,7 +29,7 @@ function Component(props) { const x = makeObject(); const user = useFragment( graphql`fragment Component_user on User { ... }`, - props.user + props.user, ); const posts = user.timeline.posts.edges.nodes.map((node) => { x.y = true; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/readonly-object-method-calls.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/readonly-object-method-calls.expect.md index 7c6e440be4eeb..9d074c8678973 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/readonly-object-method-calls.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/readonly-object-method-calls.expect.md @@ -5,7 +5,7 @@ function Component(props) { const user = useFragment( graphql`fragment Component_user on User { ... }`, - props.user + props.user, ); const posts = user.timeline.posts.edges.nodes.map((node) => ( @@ -26,7 +26,7 @@ function Component(props) { const $ = _c(5); const user = useFragment( graphql`fragment Component_user on User { ... }`, - props.user + props.user, ); let posts; if ($[0] !== user.timeline.posts.edges.nodes) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-declarations-in-reactive-scope-with-early-return.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-declarations-in-reactive-scope-with-early-return.expect.md index ffd18500f1d2c..9d34703ae6a45 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-declarations-in-reactive-scope-with-early-return.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-declarations-in-reactive-scope-with-early-return.expect.md @@ -10,7 +10,7 @@ function Component() { items.filter(([item]) => { return item.name != null; }), - [item] + [item], ); if (filteredItems.length === 0) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary-reactive-scope-with-early-return.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary-reactive-scope-with-early-return.expect.md index e75ea0254502f..2f52cfb76fdea 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary-reactive-scope-with-early-return.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary-reactive-scope-with-early-return.expect.md @@ -17,7 +17,7 @@ function Component(props) {
{fbt( "Lorum ipsum" + fbt.param("thing", object.b) + " blah blah blah", - "More text" + "More text", )}
); @@ -56,7 +56,7 @@ function Component(props) { {fbt._( "Lorum ipsum{thing} blah blah blah", [fbt._param("thing", object.b)], - { hk: "lwmuH" } + { hk: "lwmuH" }, )} ); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unmerged-fbt-call-merge-overlapping-reactive-scopes.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unmerged-fbt-call-merge-overlapping-reactive-scopes.expect.md index da1dcfb74250a..dbc151dd89266 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unmerged-fbt-call-merge-overlapping-reactive-scopes.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unmerged-fbt-call-merge-overlapping-reactive-scopes.expect.md @@ -11,7 +11,7 @@ function Component(props) { many: "bars", showCount: "yes", }), - "The label text" + "The label text", ); return props.cond ? ( { fn(); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect-namespace-pruned.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect-namespace-pruned.expect.md index 0c6f4d582f607..a11dab48a1d0a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect-namespace-pruned.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect-namespace-pruned.expect.md @@ -11,7 +11,7 @@ function useFoo() { function () { someGlobal(); }, - [] + [], ); React.useEffect(() => { fn(); diff --git a/compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts b/compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts index 3c16941e75a14..ae263621722b1 100644 --- a/compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts +++ b/compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts @@ -143,6 +143,7 @@ const rule: Rule.RuleModule = { [BabelPluginReactCompiler, options], ], sourceType: "module", + configFile: false, }); } catch (err) { if (isReactCompilerError(err) && Array.isArray(err.details)) { diff --git a/compiler/packages/make-read-only-util/src/makeReadOnly.ts b/compiler/packages/make-read-only-util/src/makeReadOnly.ts index a9df3bacdb73e..4c5279eccd7d5 100644 --- a/compiler/packages/make-read-only-util/src/makeReadOnly.ts +++ b/compiler/packages/make-read-only-util/src/makeReadOnly.ts @@ -127,7 +127,11 @@ function buildMakeReadOnly( Object.getOwnPropertyDescriptors(o) )) { if (!cache.has(k) && isWriteable(prop)) { - if (prop.hasOwnProperty("set") || prop.hasOwnProperty("get") || k === "current") { + if ( + prop.hasOwnProperty("set") || + prop.hasOwnProperty("get") || + k === "current" + ) { // - we currently don't handle accessor properties // - we currently have no other way of checking whether an object // is a `ref` (i.e. returned by useRef). diff --git a/compiler/packages/react-compiler-healthcheck/src/checks/reactCompiler.ts b/compiler/packages/react-compiler-healthcheck/src/checks/reactCompiler.ts index 1cf668eae1cba..ce8423d7ef0d1 100644 --- a/compiler/packages/react-compiler-healthcheck/src/checks/reactCompiler.ts +++ b/compiler/packages/react-compiler-healthcheck/src/checks/reactCompiler.ts @@ -16,7 +16,7 @@ import BabelPluginReactCompiler, { import { LoggerEvent as RawLoggerEvent } from "babel-plugin-react-compiler/src/Entrypoint"; import chalk from "chalk"; -type LoggerEvent = RawLoggerEvent & {filename: string | null}; +type LoggerEvent = RawLoggerEvent & { filename: string | null }; const SucessfulCompilation: Array = []; const ActionableFailures: Array = []; @@ -24,7 +24,7 @@ const OtherFailures: Array = []; const logger = { logEvent(filename: string | null, rawEvent: RawLoggerEvent) { - const event = {...rawEvent, filename}; + const event = { ...rawEvent, filename }; switch (event.kind) { case "CompileSuccess": { SucessfulCompilation.push(event); @@ -85,6 +85,7 @@ function runBabelPluginReactCompiler( retainLines: true, plugins: [[BabelPluginReactCompiler, options]], sourceType: "module", + configFile: false, }); if (result?.code == null) { throw new Error( @@ -140,8 +141,8 @@ export default { report(): void { const totalComponents = SucessfulCompilation.length + - countUniqueLocInEvents(OtherFailures) + - countUniqueLocInEvents(ActionableFailures) + countUniqueLocInEvents(OtherFailures) + + countUniqueLocInEvents(ActionableFailures); console.log( chalk.green( `Successfully compiled ${SucessfulCompilation.length} out of ${totalComponents} components.` diff --git a/compiler/packages/snap/src/compiler.ts b/compiler/packages/snap/src/compiler.ts index 6c947273b10d5..25234796a0da1 100644 --- a/compiler/packages/snap/src/compiler.ts +++ b/compiler/packages/snap/src/compiler.ts @@ -271,7 +271,10 @@ function getEvaluatorPresets( ); return presets; } -async function format(inputCode: string, language: "typescript" | "flow"): Promise { +async function format( + inputCode: string, + language: "typescript" | "flow" +): Promise { return await prettier.format(inputCode, { semi: true, parser: language === "typescript" ? "babel-ts" : "flow", @@ -294,7 +297,9 @@ export async function transformFixtureInput( parseConfigPragmaFn: typeof ParseConfigPragma, plugin: BabelCore.PluginObj, includeEvaluator: boolean -): Promise<{ kind: "ok"; value: TransformResult } | { kind: "err"; msg: string }> { +): Promise< + { kind: "ok"; value: TransformResult } | { kind: "err"; msg: string } +> { // Extract the first line to quickly check for custom test directives const firstLine = input.substring(0, input.indexOf("\n")); @@ -328,6 +333,7 @@ export async function transformFixtureInput( sourceType: "module", ast: includeEvaluator, cloneInputAst: includeEvaluator, + configFile: false, }); invariant( forgetResult?.code != null, @@ -350,6 +356,7 @@ export async function transformFixtureInput( const result = transformFromAstSync(forgetResult.ast, forgetOutput, { presets, filename: virtualFilepath, + configFile: false, }); if (result?.code == null) { return { @@ -374,6 +381,7 @@ export async function transformFixtureInput( const result = transformFromAstSync(inputAst, input, { presets, filename: virtualFilepath, + configFile: false, }); if (result?.code == null) { diff --git a/compiler/scripts/release/publish-manual.js b/compiler/scripts/release/publish-manual.js index bb40c63b7c11a..203510983ec43 100644 --- a/compiler/scripts/release/publish-manual.js +++ b/compiler/scripts/release/publish-manual.js @@ -25,7 +25,7 @@ const spawnHelper = util.promisify(_spawn); function execHelper(command, options, streamStdout = false) { return new Promise((resolve, reject) => { const proc = cp.exec(command, options, (error, stdout) => - error ? reject(error) : resolve(stdout.trim()), + error ? reject(error) : resolve(stdout.trim()) ); if (streamStdout) { proc.stdout.pipe(process.stdout); @@ -39,7 +39,7 @@ function sleep(ms) { async function getDateStringForCommit(commit) { let dateString = await execHelper( - `git show -s --no-show-signature --format=%cd --date=format:%Y%m%d ${commit}`, + `git show -s --no-show-signature --format=%cd --date=format:%Y%m%d ${commit}` ); // On CI environment, this string is wrapped with quotes '...'s @@ -99,7 +99,7 @@ async function main() { const isPristine = (await execHelper("git status --porcelain")) === ""; if (currBranchName !== "main" || isPristine === false) { throw new Error( - "This script must be run from the `main` branch with no uncommitted changes", + "This script must be run from the `main` branch with no uncommitted changes" ); } } @@ -111,7 +111,7 @@ async function main() { const spinner = ora( `Preparing to publish ${ forReal === true ? "(for real)" : "(dry run)" - } [debug=${debug}]`, + } [debug=${debug}]` ).info(); spinner.info("Building packages"); @@ -145,7 +145,7 @@ async function main() { spinner.stop(`Successfully packed ${pkgName} (dry run)`); } spinner.succeed( - "Please confirm contents of packages before publishing. You can run this command again with --for-real to publish to npm", + "Please confirm contents of packages before publishing. You can run this command again with --for-real to publish to npm" ); } @@ -155,7 +155,7 @@ async function main() { "git show -s --no-show-signature --format=%h", { cwd: path.resolve(__dirname, ".."), - }, + } ); const dateString = await getDateStringForCommit(commit); @@ -175,20 +175,20 @@ async function main() { `yarn version --new-version ${newVersion} --no-git-tag-version`, { cwd: pkgDir, - }, + } ); await execHelper( `git add package.json && git commit -m "Bump version to ${newVersion}"`, { cwd: pkgDir, - }, + } ); } catch (e) { spinner.fail(e.toString()); throw e; } spinner.succeed( - `Bumped ${pkgName} to ${newVersion} and added a git commit`, + `Bumped ${pkgName} to ${newVersion} and added a git commit` ); } @@ -196,7 +196,7 @@ async function main() { spinner.info( `🚨🚨🚨 About to publish to npm in ${ TIME_TO_RECONSIDER / 1000 - } seconds. You still have time to kill this script!`, + } seconds. You still have time to kill this script!` ); await sleep(TIME_TO_RECONSIDER); } @@ -214,7 +214,7 @@ async function main() { { cwd: pkgDir, stdio: "inherit", - }, + } ); console.log("\n"); } catch (e) {