Skip to content

Commit c998bb1

Browse files
committed
[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: 054ca86 Pull Request resolved: #29214
1 parent 61aa159 commit c998bb1

File tree

57 files changed

+97
-105
lines changed

Some content is hidden

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

57 files changed

+97
-105
lines changed

compiler/apps/playground/colors.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
98
/**
109
* Sync from <https://github.com/reactjs/reactjs.org/blob/main/beta/colors.js>.
1110
*/

compiler/apps/playground/components/Editor/EditorImpl.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import {
4343
} from "./Output";
4444

4545
function parseFunctions(
46-
source: string,
46+
source: string
4747
): Array<
4848
NodePath<
4949
t.FunctionDeclaration | t.ArrowFunctionExpression | t.FunctionExpression
@@ -148,7 +148,7 @@ function isHookName(s: string): boolean {
148148
}
149149

150150
function getReactFunctionType(
151-
id: NodePath<t.Identifier | null | undefined>,
151+
id: NodePath<t.Identifier | null | undefined>
152152
): ReactFunctionType {
153153
if (id && id.node && id.isIdentifier()) {
154154
if (isHookName(id.node.name)) {
@@ -189,7 +189,7 @@ function compile(source: string): CompilerOutput {
189189
severity: ErrorSeverity.Todo,
190190
loc: fn.node.loc ?? null,
191191
suggestions: null,
192-
}),
192+
})
193193
);
194194
continue;
195195
}
@@ -205,7 +205,7 @@ function compile(source: string): CompilerOutput {
205205
"_c",
206206
null,
207207
null,
208-
null,
208+
null
209209
)) {
210210
const fnName = fn.node.id?.name ?? null;
211211
switch (result.kind) {
@@ -274,7 +274,7 @@ function compile(source: string): CompilerOutput {
274274
reason: `Unexpected failure when transforming input! ${err}`,
275275
loc: null,
276276
suggestions: null,
277-
}),
277+
})
278278
);
279279
}
280280
}
@@ -291,7 +291,7 @@ export default function Editor() {
291291
const { enqueueSnackbar } = useSnackbar();
292292
const compilerOutput = useMemo(
293293
() => compile(deferredStore.source),
294-
[deferredStore.source],
294+
[deferredStore.source]
295295
);
296296

297297
useMountEffect(() => {
@@ -305,7 +305,7 @@ export default function Editor() {
305305
...createMessage(
306306
"Bad URL - fell back to the default Playground.",
307307
MessageLevel.Info,
308-
MessageSource.Playground,
308+
MessageSource.Playground
309309
),
310310
});
311311
mountStore = defaultStore;
@@ -319,9 +319,7 @@ export default function Editor() {
319319
return (
320320
<>
321321
<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")}>
325323
<Input
326324
errors={
327325
compilerOutput.kind === "err" ? compilerOutput.error.details : []

compiler/apps/playground/components/Editor/Input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default function Input({ errors }: Props) {
7676
allowSyntheticDefaultImports: true,
7777
};
7878
monaco.languages.typescript.javascriptDefaults.setCompilerOptions(
79-
tscOptions,
79+
tscOptions
8080
);
8181
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
8282
...tscOptions,

compiler/apps/playground/components/Editor/Output.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async function tabify(source: string, compilerOutput: CompilerOutput) {
106106
output={text}
107107
diff={lastPassOutput ?? null}
108108
showInfoPanel={true}
109-
></TextTabContent>,
109+
></TextTabContent>
110110
);
111111
lastPassOutput = text;
112112
}
@@ -122,7 +122,7 @@ async function tabify(source: string, compilerOutput: CompilerOutput) {
122122
output={code}
123123
diff={null}
124124
showInfoPanel={false}
125-
></TextTabContent>,
125+
></TextTabContent>
126126
);
127127
if (sourceMapUrl) {
128128
reorderedTabs.set(
@@ -133,7 +133,7 @@ async function tabify(source: string, compilerOutput: CompilerOutput) {
133133
className="w-full h-monaco_small sm:h-monaco"
134134
title="Generated Code"
135135
/>
136-
</>,
136+
</>
137137
);
138138
}
139139
}
@@ -145,16 +145,16 @@ async function tabify(source: string, compilerOutput: CompilerOutput) {
145145

146146
async function codegen(
147147
ast: t.Program,
148-
source: string,
148+
source: string
149149
): Promise<{ code: any; sourceMapUrl: string | null }> {
150150
const generated = generate(
151151
ast,
152152
{ sourceMaps: true, sourceFileName: "input.js" },
153-
source,
153+
source
154154
);
155155
const sourceMapUrl = getSourceMapUrl(
156156
generated.code,
157-
JSON.stringify(generated.map),
157+
JSON.stringify(generated.map)
158158
);
159159
const codegenOutput = await prettier.format(generated.code, {
160160
semi: true,
@@ -172,14 +172,14 @@ function getSourceMapUrl(code: string, map: string): string | null {
172172
code = utf16ToUTF8(code);
173173
map = utf16ToUTF8(map);
174174
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}`
176176
)}`;
177177
}
178178

179179
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"]));
181181
const [tabs, setTabs] = useState<Map<string, React.ReactNode>>(
182-
() => new Map(),
182+
() => new Map()
183183
);
184184
useEffect(() => {
185185
tabify(store.source, compilerOutput).then((tabs) => {

compiler/apps/playground/components/Editor/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ const Editor = dynamic(() => import("./EditorImpl"), {
1313
ssr: false,
1414
});
1515

16-
export default Editor;
16+
export default Editor;

compiler/apps/playground/components/Editor/monacoOptions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
98
import type { EditorProps } from "@monaco-editor/react";
109

1110
export const monacoOptions: Partial<EditorProps["options"]> = {

compiler/apps/playground/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default function Header() {
5050
<Logo
5151
className={clsx(
5252
"w-8 h-8 text-link",
53-
process.env.NODE_ENV === "development" && "text-yellow-600",
53+
process.env.NODE_ENV === "development" && "text-yellow-600"
5454
)}
5555
/>
5656
<p className="hidden select-none sm:block">React Compiler Playground</p>

compiler/apps/playground/components/Icons/IconGitHub.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ export const IconGitHub = memo<JSX.IntrinsicElements["svg"]>(
2121
<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>
2222
</svg>
2323
);
24-
},
24+
}
2525
);

compiler/apps/playground/components/Logo.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
98
// https://github.com/reactjs/reactjs.org/blob/main/beta/src/components/Logo.tsx
109

1110
export default function Logo(props: JSX.IntrinsicElements["svg"]) {

compiler/apps/playground/components/StoreContext.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
98
import type { Dispatch, ReactNode } from "react";
109
import { useReducer } from "react";
1110
import createContext from "../lib/createContext";

0 commit comments

Comments
 (0)