Skip to content

Commit

Permalink
chore: update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Jan 31, 2024
1 parent 930b778 commit 92afc75
Show file tree
Hide file tree
Showing 36 changed files with 323 additions and 619 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const x = {
8: "yay",
01: "one",
0: "zero",
"0": "zero",
"010": "oh no",
};
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
const y = 5




<|>
const y = 5<>;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
foo <|> (bar);
foo<>(bar);
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const y = 5

<|>
const y = 5<>;

const z = 9;
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const y = 5
<|>
const y = 5<>;

const z = 9;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
thisWillBeFormatted <|> (2 ,3, )
thisWillBeFormatted<>(2, 3);
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// hi lol
haha()<|>
haha()<>;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
thisWontBeFormatted <|> ( 1 ,3)
<<<PRETTIER_RANGE_START>>>
thisWontBeFormatted<>(1, 3) <<
<PRETTIER_RANGE_START>>>
thisWillBeFormatted (2 ,3, )

<<<PRETTIER_RANGE_END>>> thisWontBeFormatted (2, 90 ,)

;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Something {
@Annotateme()
// comment
static property: Array<string>;
// comment
static property: Array<string>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const e = {
const f = {
// These should be unquoted for quoteProps=as-needed.
NaN: null,
1: null,
1.5: null,
"1": null,
"1.5": null,
// These should never be unquoted. `1e+100` technically could (it’s the only
// one where `String(Number(key)) === key`), but we came to the conclusion
// that it is unexpected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,34 @@ const bar1 = [1, 2, 3].reduce(
[] as unknown as number[],
);

const bar2 = [1, 2, 3].reduce(
(carry, value) => {
return [...carry, value];
},
<Array<number>>[],
);
const bar2 = [1,2,3].reduce((carry, value) => {
return [...carry, value];
}, <Array<number>>[]);

const bar3 = [1, 2, 3].reduce(
(carry, value) => {
return [...carry, value];
},
[1, 2, 3] as unknown as number[],
);
const bar3 = [1,2,3].reduce((carry, value) => {
return [...carry, value];
}, ([1, 2, 3] as unknown) as number[]);

const bar4 = [1, 2, 3].reduce(
(carry, value) => {
return [...carry, value];
},
<Array<number>>[1, 2, 3],
);
const bar4 = [1,2,3].reduce((carry, value) => {
return [...carry, value];
}, <Array<number>>[1, 2, 3]);

const bar5 = [1, 2, 3].reduce(
(carry, value) => {
return { ...carry, [value]: true };
},
{} as unknown as { [key: number]: boolean },
);
const bar5 = [1,2,3].reduce((carry, value) => {
return {...carry, [value]: true};
}, ({} as unknown) as {[key: number]: boolean});

const bar6 = [1, 2, 3].reduce(
(carry, value) => {
return { ...carry, [value]: true };
},
<{ [key: number]: boolean }>{},
);
const bar6 = [1,2,3].reduce((carry, value) => {
return {...carry, [value]: true};
}, <{[key: number]: boolean}>{});

const bar7 = [1, 2, 3].reduce(
(carry, value) => {
return { ...carry, [value]: true };
},
{ 1: true } as unknown as { [key: number]: boolean },
);
const bar7 = [1,2,3].reduce((carry, value) => {
return {...carry, [value]: true};
}, ({1: true} as unknown) as {[key: number]: boolean});

const bar8 = [1, 2, 3].reduce(
(carry, value) => {
return { ...carry, [value]: true };
},
<{ [key: number]: boolean }>{ 1: true },
);
const bar8 = [1,2,3].reduce((carry, value) => {
return {...carry, [value]: true};
}, <{[key: number]: boolean}>{1: true});

const bar9 = [1, 2, 3].reduce((carry, value) => {
return [...carry, value];
const bar9 = [1,2,3].reduce((carry, value) => {
return [...carry, value];
}, [] as foo);
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<T>(a) => {};
<T>(a) => { }
34 changes: 7 additions & 27 deletions crates/biome_fmt/test_data/specs/prettier/typescript/as/as.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,11 @@ const state = JSON.stringify({
(bValue as boolean) ? 0 : -1;
<boolean>bValue ? 0 : -1;

const value1 =
thisIsAReallyReallyReallyReallyReallyLongIdentifier as SomeInterface;
const value2 =
thisIsAnIdentifier as thisIsAReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongInterface;
const value3 = thisIsAReallyLongIdentifier as
| SomeInterface
| SomeOtherInterface;
const value4 = thisIsAReallyLongIdentifier as {
prop1: string;
prop2: number;
prop3: number;
}[];
const value5 =
thisIsAReallyReallyReallyReallyReallyReallyReallyReallyReallyLongIdentifier as [
string,
number,
];
const value1 = thisIsAReallyReallyReallyReallyReallyLongIdentifier as SomeInterface;
const value2 = thisIsAnIdentifier as thisIsAReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongInterface;
const value3 = thisIsAReallyLongIdentifier as (SomeInterface | SomeOtherInterface);
const value4 = thisIsAReallyLongIdentifier as { prop1: string, prop2: number, prop3: number }[];
const value5 = thisIsAReallyReallyReallyReallyReallyReallyReallyReallyReallyLongIdentifier as [string, number];

const iter1 = createIterator(
this.controller,
child,
this.tag as SyncFunctionComponent,
);
const iter2 = createIterator(
self.controller,
child,
self.tag as SyncFunctionComponent,
);
const iter1 = createIterator(this.controller, child, this.tag as SyncFunctionComponent);
const iter2 = createIterator(self.controller, child, self.tag as SyncFunctionComponent);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://github.com/babel/babel/pull/12933/files
(<number>x) = null;
x! = null;
(x!) = null;
(a as any) = null;
(a as number) = 42;
(a as any as string) = null;
((a as any) as string) = null;
Loading

0 comments on commit 92afc75

Please sign in to comment.