forked from rome/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rome_js_formatter): Parity with prettier for many function argume…
…nts rome#4229
- Loading branch information
1 parent
40f9c7d
commit 5d20492
Showing
6 changed files
with
237 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 0 additions & 72 deletions
72
crates/rome_js_formatter/tests/specs/ts/function/function_parameters.ts.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
185 changes: 185 additions & 0 deletions
185
crates/rome_js_formatter/tests/specs/ts/function/parameters/function_parameters.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
--- | ||
source: crates/rome_formatter_test/src/snapshot_builder.rs | ||
info: ts/function/parameters/function_parameters.ts | ||
--- | ||
|
||
# Input | ||
|
||
```ts | ||
export function formatNumber1( | ||
value: string, | ||
{ | ||
a, | ||
b, | ||
c, | ||
formatNumber, | ||
...props | ||
}: Omit<NumberFormatterProps, 'value' | 'defaultFractionDigits'> & { | ||
useGrouping?: boolean; | ||
} | ||
): string {} | ||
|
||
export function formatNumber2( | ||
value: string, | ||
{ a }: Omit<NumberFormatterProps, 'value' | 'defaultFractionDigits'> & { | ||
useGrouping?: boolean; | ||
} | ||
): string {} | ||
|
||
|
||
export const findByDatefindByDatefindByDatefindByDate = | ||
(_, { date }, { req } ) => findByDatefindByDatefindByDatefindByDate; | ||
|
||
export const queryAuditLog = async ({ | ||
startDate, | ||
endDate, | ||
jobId, | ||
src, | ||
type, | ||
}: Filter): Promise<DBAuditLog[]> => { | ||
|
||
}; | ||
|
||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Line width: 80 | ||
Quote style: Double Quotes | ||
Quote properties: As needed | ||
Trailing comma: All | ||
Semicolons: Always | ||
----- | ||
|
||
```ts | ||
export function formatNumber1( | ||
value: string, | ||
{ | ||
a, | ||
b, | ||
c, | ||
formatNumber, | ||
...props | ||
}: Omit<NumberFormatterProps, "value" | "defaultFractionDigits"> & { | ||
useGrouping?: boolean; | ||
}, | ||
): string {} | ||
|
||
export function formatNumber2( | ||
value: string, | ||
{ | ||
a, | ||
}: Omit<NumberFormatterProps, "value" | "defaultFractionDigits"> & { | ||
useGrouping?: boolean; | ||
}, | ||
): string {} | ||
|
||
export const findByDatefindByDatefindByDatefindByDate = ( | ||
_, | ||
{ date }, | ||
{ req }, | ||
) => findByDatefindByDatefindByDatefindByDate; | ||
|
||
export const queryAuditLog = async ({ | ||
startDate, | ||
endDate, | ||
jobId, | ||
src, | ||
type, | ||
}: Filter): Promise<DBAuditLog[]> => {}; | ||
``` | ||
|
||
## Output 2 | ||
|
||
----- | ||
Indent style: Tab | ||
Line width: 100 | ||
Quote style: Double Quotes | ||
Quote properties: As needed | ||
Trailing comma: All | ||
Semicolons: Always | ||
----- | ||
|
||
```ts | ||
export function formatNumber1( | ||
value: string, | ||
{ | ||
a, | ||
b, | ||
c, | ||
formatNumber, | ||
...props | ||
}: Omit<NumberFormatterProps, "value" | "defaultFractionDigits"> & { | ||
useGrouping?: boolean; | ||
}, | ||
): string {} | ||
|
||
export function formatNumber2( | ||
value: string, | ||
{ | ||
a, | ||
}: Omit<NumberFormatterProps, "value" | "defaultFractionDigits"> & { | ||
useGrouping?: boolean; | ||
}, | ||
): string {} | ||
|
||
export const findByDatefindByDatefindByDatefindByDate = (_, { date }, { req }) => | ||
findByDatefindByDatefindByDatefindByDate; | ||
|
||
export const queryAuditLog = async ({ | ||
startDate, | ||
endDate, | ||
jobId, | ||
src, | ||
type, | ||
}: Filter): Promise<DBAuditLog[]> => {}; | ||
``` | ||
|
||
## Output 3 | ||
|
||
----- | ||
Indent style: Tab | ||
Line width: 120 | ||
Quote style: Double Quotes | ||
Quote properties: As needed | ||
Trailing comma: All | ||
Semicolons: Always | ||
----- | ||
|
||
```ts | ||
export function formatNumber1( | ||
value: string, | ||
{ | ||
a, | ||
b, | ||
c, | ||
formatNumber, | ||
...props | ||
}: Omit<NumberFormatterProps, "value" | "defaultFractionDigits"> & { | ||
useGrouping?: boolean; | ||
}, | ||
): string {} | ||
|
||
export function formatNumber2( | ||
value: string, | ||
{ | ||
a, | ||
}: Omit<NumberFormatterProps, "value" | "defaultFractionDigits"> & { | ||
useGrouping?: boolean; | ||
}, | ||
): string {} | ||
|
||
export const findByDatefindByDatefindByDatefindByDate = (_, { date }, { req }) => | ||
findByDatefindByDatefindByDatefindByDate; | ||
|
||
export const queryAuditLog = async ({ startDate, endDate, jobId, src, type }: Filter): Promise<DBAuditLog[]> => {}; | ||
``` | ||
|
||
|
10 changes: 10 additions & 0 deletions
10
crates/rome_js_formatter/tests/specs/ts/function/parameters/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"cases": [ | ||
{ | ||
"line_width": 100 | ||
}, | ||
{ | ||
"line_width": 120 | ||
} | ||
] | ||
} |