-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(formatter): do not break properties of type annotation in functio…
…n parameters Signed-off-by: Naoki Ikeguchi <[email protected]>
- Loading branch information
Showing
4 changed files
with
100 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@biomejs/biome": patch | ||
--- | ||
|
||
Fixed properties of object type annotation in function parameters are expanded, which is inconsistent with Prettier. |
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
19 changes: 19 additions & 0 deletions
19
crates/biome_js_formatter/tests/specs/ts/object/objects.ts
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,19 @@ | ||
let foo: { | ||
bar: string; | ||
}; | ||
|
||
const fn = ({ | ||
foo, | ||
bar, | ||
}: { | ||
foo: boolean; | ||
bar: string; | ||
}) => { | ||
console.log(foo, bar); | ||
} | ||
|
||
function fn2(foo: { | ||
bar: string; | ||
}) { | ||
console.log(foo); | ||
} |
66 changes: 66 additions & 0 deletions
66
crates/biome_js_formatter/tests/specs/ts/object/objects.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,66 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: ts/object/objects.ts | ||
--- | ||
# Input | ||
|
||
```ts | ||
let foo: { | ||
bar: string; | ||
}; | ||
|
||
const fn = ({ | ||
foo, | ||
bar, | ||
}: { | ||
foo: boolean; | ||
bar: string; | ||
}) => { | ||
console.log(foo, bar); | ||
} | ||
|
||
function fn2(foo: { | ||
bar: string; | ||
}) { | ||
console.log(foo); | ||
} | ||
|
||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line ending: LF | ||
Line width: 80 | ||
Quote style: Double Quotes | ||
JSX quote style: Double Quotes | ||
Quote properties: As needed | ||
Trailing commas: All | ||
Semicolons: Always | ||
Arrow parentheses: Always | ||
Bracket spacing: true | ||
Bracket same line: false | ||
Attribute Position: Auto | ||
Object wrap: Preserve | ||
----- | ||
|
||
```ts | ||
let foo: { | ||
bar: string; | ||
}; | ||
|
||
const fn = ({ foo, bar }: { foo: boolean; bar: string }) => { | ||
console.log(foo, bar); | ||
}; | ||
|
||
function fn2(foo: { bar: string }) { | ||
console.log(foo); | ||
} | ||
``` |