Skip to content

Commit

Permalink
challenge(formatter): handle line break and comments for array holes
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-teles committed Nov 21, 2023
1 parent e60c49b commit f6befc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
2 changes: 0 additions & 2 deletions crates/biome_js_formatter/src/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ impl CommentStyle for JsCommentStyle {
.or_else(handle_method_comment)
.or_else(handle_for_comment)
.or_else(handle_root_comments)
.or_else(handle_array_hole_comment)
.or_else(handle_variable_declarator_comment)
.or_else(handle_parameter_comment)
.or_else(handle_labelled_statement_comment)
Expand All @@ -127,7 +126,6 @@ impl CommentStyle for JsCommentStyle {
.or_else(handle_for_comment)
.or_else(handle_root_comments)
.or_else(handle_parameter_comment)
.or_else(handle_array_hole_comment)
.or_else(handle_labelled_statement_comment)
.or_else(handle_call_expression_comment)
.or_else(handle_mapped_type_comment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,37 +44,19 @@ const numberWithHoles2 = [
```diff
--- Prettier
+++ Biome
@@ -2,13 +2,13 @@
7234932941,
7234932722,
7234932312,
+ // comment before a hole 1
,
- // comment before a hole 1
7234932841,
,
7234932843,
- ,
// comment after a hole 1
+ ,
7234932436,
];

@@ -16,13 +16,13 @@
0x234932941,
0x234932722,
0x234932312,
-
+ // comment before a hole 2
,
- // comment before a hole 2
// comment before a hole 2
0x234932841,
,
0x234932843,
- ,
// comment after a hole 2
+ ,
,
+
// comment after a hole 2
0x234932436,
];
```
Expand All @@ -86,28 +68,28 @@ const numberWithHoles1 = [
7234932941,
7234932722,
7234932312,
// comment before a hole 1
,
// comment before a hole 1
7234932841,
,
7234932843,
// comment after a hole 1
,
// comment after a hole 1
7234932436,
];

const numberWithHoles2 = [
0x234932941,
0x234932722,
0x234932312,
// comment before a hole 2
,
// comment before a hole 2
0x234932841,
,
0x234932843,
// comment after a hole 2
,

// comment after a hole 2
0x234932436,
];
```
Expand Down

0 comments on commit f6befc9

Please sign in to comment.