Skip to content

Commit

Permalink
fix(js_parser): allow a trailing comma in setters (#4324)
Browse files Browse the repository at this point in the history
  • Loading branch information
fireairforce authored Oct 22, 2024
1 parent edd82c0 commit d621498
Show file tree
Hide file tree
Showing 43 changed files with 1,260 additions and 509 deletions.
16 changes: 10 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,18 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

### Parser

#### New features

- Add support for parsing the defer attribute in import statements ([#4215](https://github.com/biomejs/biome/issues/4215)).
#### Bug fixes

```js
import defer * as myModule from "my-module";
```
- Fix [#4317](https://github.com/biomejs/biome/issues/4317), setter parameter can contain a trailing comma, the following example will now parsed correctly:

```js
export class DummyClass {
set input(
value: string,
) {}
}
```

Contributed by @fireairforce

## v1.9.4 (2024-10-17)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

120 changes: 95 additions & 25 deletions crates/biome_js_factory/src/generated/node_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 32 additions & 4 deletions crates/biome_js_factory/src/generated/syntax_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ impl FormatNodeRule<JsSetterClassMember> for FormatJsSetterClassMember {
name,
l_paren_token,
parameter,
comma_token,
r_paren_token,
body,
} = node.as_fields();
Expand All @@ -29,6 +30,7 @@ impl FormatNodeRule<JsSetterClassMember> for FormatJsSetterClassMember {
name.format(),
l_paren_token.format(),
parameter.format(),
comma_token.format(),
r_paren_token.format(),
space(),
body.format(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ impl FormatNodeRule<JsSetterObjectMember> for FormatJsSetterObjectMember {
name,
l_paren_token,
parameter,
comma_token,
r_paren_token,
body,
} = node.as_fields();
Expand All @@ -26,6 +27,7 @@ impl FormatNodeRule<JsSetterObjectMember> for FormatJsSetterObjectMember {
name.format(),
l_paren_token.format(),
parameter.format(),
comma_token.format(),
r_paren_token.format(),
space(),
body.format(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ impl FormatNodeRule<TsSetterSignatureTypeMember> for FormatTsSetterSignatureType
name,
l_paren_token,
parameter,
comma_token,
r_paren_token,
separator_token,
} = node.as_fields();
Expand All @@ -30,6 +31,7 @@ impl FormatNodeRule<TsSetterSignatureTypeMember> for FormatTsSetterSignatureType
name.format(),
l_paren_token.format(),
parameter.format(),
comma_token.format(),
r_paren_token.format(),
FormatTypeMemberSeparator::new(separator_token.as_ref())
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl FormatNodeRule<TsSetterSignatureClassMember> for FormatTsSetterSignatureCla
name,
l_paren_token,
parameter,
comma_token,
r_paren_token,
semicolon_token,
} = node.as_fields();
Expand All @@ -33,6 +34,7 @@ impl FormatNodeRule<TsSetterSignatureClassMember> for FormatTsSetterSignatureCla
name.format(),
l_paren_token.format(),
parameter.format(),
comma_token.format(),
r_paren_token.format(),
FormatOptionalSemicolon::new(semicolon_token.as_ref())
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ let a = {
}
let b = {
set foo(a) {}
set bar(a, ) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let a = {
}
let b = {
set foo(a) {}
set bar(a, ) {}
}

```
Expand Down Expand Up @@ -42,6 +43,7 @@ let a = {
get foo() {},
};
let b = {
set foo(a) {},
};
set foo(a) {}
set bar(a, ) {}
}
```
Loading

0 comments on commit d621498

Please sign in to comment.