Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler: unfork prettier config #30205

Merged
merged 3 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
yarn workspace babel-plugin-react-compiler snap --update
  • Loading branch information
kassens committed Jul 18, 2024
commit 9fbd2d4de67d52be84a343c76cd61cc832af25fc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
import { makeObject_Primitives, mutate } from "shared-runtime";
import {makeObject_Primitives, mutate} from 'shared-runtime';

function Component() {
// a's mutable range should be the same as x's mutable range,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

```javascript
function component(a) {
let x = { a };
let x = {a};
let y = {};

y.x = x["a"];
y.x = x['a'];
mutate(y);
return x;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
import { mutate } from "shared-runtime";
import {mutate} from 'shared-runtime';

/**
* Similar fixture to `align-scopes-nested-block-structure`, but
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
import { getNull } from "shared-runtime";
import {getNull} from 'shared-runtime';

function Component(props) {
const items = (() => {
Expand All @@ -14,7 +14,7 @@ function Component(props) {

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ a: {} }],
params: [{a: {}}],
};

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
import { mutate } from "shared-runtime";
import {mutate} from 'shared-runtime';
/**
* Fixture showing that it's not sufficient to only align direct scoped
* accesses of a block-fallthrough pair.
Expand Down Expand Up @@ -42,7 +42,7 @@ import { mutate } from "shared-runtime";
* │return s; │◄──┘
* └───────────┘
*/
function useFoo({ cond1, cond2 }) {
function useFoo({cond1, cond2}) {
let s = null;
if (cond1) {
s = {};
Expand All @@ -59,13 +59,13 @@ function useFoo({ cond1, cond2 }) {

export const FIXTURE_ENTRYPOINT = {
fn: useFoo,
params: [{ cond1: true, cond2: false }],
params: [{cond1: true, cond2: false}],
sequentialRenders: [
{ cond1: true, cond2: false },
{ cond1: true, cond2: false },
{ cond1: true, cond2: true },
{ cond1: true, cond2: true },
{ cond1: false, cond2: true },
{cond1: true, cond2: false},
{cond1: true, cond2: false},
{cond1: true, cond2: true},
{cond1: true, cond2: true},
{cond1: false, cond2: true},
],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
function useFoo({ cond }) {
function useFoo({cond}) {
let items: any = {};
b0: {
if (cond) {
Expand All @@ -19,13 +19,13 @@ function useFoo({ cond }) {

export const FIXTURE_ENTRYPOINT = {
fn: useFoo,
params: [{ cond: true }],
params: [{cond: true}],
sequentialRenders: [
{ cond: true },
{ cond: true },
{ cond: false },
{ cond: false },
{ cond: true },
{cond: true},
{cond: true},
{cond: false},
{cond: false},
{cond: true},
],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
## Input

```javascript
import { arrayPush } from "shared-runtime";
import {arrayPush} from 'shared-runtime';

function useFoo({ cond, value }) {
function useFoo({cond, value}) {
let items;
label: {
items = [];
Expand All @@ -19,12 +19,12 @@ function useFoo({ cond, value }) {

export const FIXTURE_ENTRYPOINT = {
fn: useFoo,
params: [{ cond: true, value: 2 }],
params: [{cond: true, value: 2}],
sequentialRenders: [
{ cond: true, value: 2 },
{ cond: true, value: 2 },
{ cond: true, value: 3 },
{ cond: false, value: 3 },
{cond: true, value: 2},
{cond: true, value: 2},
{cond: true, value: 3},
{cond: false, value: 3},
],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
## Input

```javascript
import { arrayPush, mutate } from "shared-runtime";
import {arrayPush, mutate} from 'shared-runtime';

function useFoo({ value }) {
function useFoo({value}) {
let items = null;
try {
// Mutable range of `items` begins here, but its reactive scope block
Expand All @@ -20,8 +20,8 @@ function useFoo({ value }) {

export const FIXTURE_ENTRYPOINT = {
fn: useFoo,
params: [{ value: 2 }],
sequentialRenders: [{ value: 2 }, { value: 2 }, { value: 3 }],
params: [{value: 2}],
sequentialRenders: [{value: 2}, {value: 2}, {value: 3}],
};

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
import { CONST_TRUE, makeObject_Primitives } from "shared-runtime";
import {CONST_TRUE, makeObject_Primitives} from 'shared-runtime';

function Foo() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
```javascript
// @enableReactiveScopesInHIR:false

import { Stringify, identity, makeArray, mutate } from "shared-runtime";
import {Stringify, identity, makeArray, mutate} from 'shared-runtime';

/**
* Here, identity('foo') is an immutable allocating instruction.
Expand All @@ -16,20 +16,20 @@ import { Stringify, identity, makeArray, mutate } from "shared-runtime";
* (e.g. `cond1 ? <>: null`). The HIR version of alignScopesToBlocks
* handles this correctly.
*/
function Foo({ cond1, cond2 }) {
const arr = makeArray<any>({ a: 2 }, 2, []);
function Foo({cond1, cond2}) {
const arr = makeArray<any>({a: 2}, 2, []);

return cond1 ? (
<>
<div>{identity("foo")}</div>
<div>{identity('foo')}</div>
<Stringify value={cond2 ? arr.map(mutate) : null} />
</>
) : null;
}

export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{ cond1: true, cond2: true }],
params: [{cond1: true, cond2: true}],
};

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
* The only scoped value we currently infer in this program is the
* PropertyLoad `data?.toString`.
*/
import { useFragment } from "shared-runtime";
import {useFragment} from 'shared-runtime';

function Foo() {
const data = useFragment();
return [data?.toString() || ""];
return [data?.toString() || ''];
}

export const FIXTURE_ENTRYPOINT = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// that Forget should memoize it.
// Correctness:

import { identity, mutate, setProperty } from "shared-runtime";
import {identity, mutate, setProperty} from 'shared-runtime';

// - y depends on either bar(props.b) or bar(props.b) + 1
function AllocatingPrimitiveAsDepNested(props) {
Expand All @@ -19,16 +19,16 @@ function AllocatingPrimitiveAsDepNested(props) {

export const FIXTURE_ENTRYPOINT = {
fn: AllocatingPrimitiveAsDepNested,
params: [{ a: 1, b: 2 }],
params: [{a: 1, b: 2}],
sequentialRenders: [
// change b
{ a: 1, b: 3 },
{a: 1, b: 3},
// change b
{ a: 1, b: 4 },
{a: 1, b: 4},
// change a
{ a: 2, b: 4 },
{a: 2, b: 4},
// change a
{ a: 3, b: 4 },
{a: 3, b: 4},
],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

```javascript
// @validatePreserveExistingMemoizationGuarantees
import { useCallback, useEffect, useState } from "react";
import {useCallback, useEffect, useState} from 'react';

let someGlobal = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
import { useEffect, useState } from "react";
import {useEffect, useState} from 'react';

let someGlobal = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
import { useCallback, useEffect, useState } from "react";
import {useCallback, useEffect, useState} from 'react';

function Component() {
const callback = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
import { useEffect, useState } from "react";
import {useEffect, useState} from 'react';

let someGlobal = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Input

```javascript
import { useEffect, useState } from "react";
import {useEffect, useState} from 'react';

let someGlobal = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
## Input

```javascript
import { useMemo } from "react";
import {useMemo} from 'react';

const someGlobal = { value: 0 };
const someGlobal = {value: 0};

function Component({ value }) {
function Component({value}) {
const onClick = () => {
someGlobal.value = value;
};
Expand All @@ -17,13 +17,13 @@ function Component({ value }) {

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ value: 0 }],
params: [{value: 0}],
sequentialRenders: [
{ value: 1 },
{ value: 1 },
{ value: 42 },
{ value: 42 },
{ value: 0 },
{value: 1},
{value: 1},
{value: 42},
{value: 42},
{value: 0},
],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
## Input

```javascript
import { useEffect, useState } from "react";
import {useEffect, useState} from 'react';

let someGlobal = { value: null };
let someGlobal = {value: null};

function Component() {
const [state, setState] = useState(someGlobal);
Expand All @@ -20,7 +20,7 @@ function Component() {
// capture into a separate variable that is not a context variable.
const y = x;
useEffect(() => {
y.value = "hello";
y.value = 'hello';
}, []);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

```javascript
// @validateRefAccessDuringRender
import { useRef } from "react";
import {useRef} from 'react';

function Component() {
const ref = useRef(null);

const setRef = () => {
if (ref.current !== null) {
ref.current = "";
ref.current = '';
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

```javascript
// @validateRefAccessDuringRender
import { useRef } from "react";
import {useRef} from 'react';

function Component() {
const ref = useRef(null);

const onClick = () => {
if (ref.current !== null) {
ref.current = "";
ref.current = '';
}
};

Expand Down
Loading
Loading