Skip to content

Commit

Permalink
feat(formatter/html): add line break at the end of files (#4010)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 authored Sep 20, 2024
1 parent d137533 commit 0254098
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions crates/biome_html_formatter/src/html/auxiliary/root.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::prelude::*;
use biome_formatter::write;
use biome_html_syntax::HtmlRoot;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatHtmlRoot;
Expand All @@ -16,6 +17,7 @@ impl FormatNodeRule<HtmlRoot> for FormatHtmlRoot {
if let Ok(eof) = node.eof_token() {
eof.format().fmt(f)?;
}
write!(f, [hard_line_break()])?;

Ok(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ Attribute Position: Auto
disabled
class="w-full h-full bg-green text-white"
id="foo"
></div>```
></div>
```
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ Attribute Position: Auto
-----

```html
<div foo="bar" id="foo"></div>```
<div foo="bar" id="foo"></div>
```
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ Attribute Position: Auto
-----

```html
<meta charset="utf-8" />```
<meta charset="utf-8" />
```
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ Attribute Position: Auto
-----

```html
<img src="foo.png'" alt='should keep "these" quotes' />```
<img src="foo.png'" alt='should keep "these" quotes' />
```
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ Attribute Position: Auto
ornare ipsum. Class aptent taciti sociosqu ad litora torquent per conubia
nostra, per inceptos himenaeos. Ut nec dapibus est. Maecenas orci purus,
blandit eu faucibus eu, lacinia id turpis.
</div>```
</div>
```
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ Attribute Position: Auto
<div>Quuz</div>
<div>Corge</div>
<div>Grault</div>
</div>```
</div>
```
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ Attribute Position: Auto
<div>
<br />
<img />
</div>```
</div>
```

0 comments on commit 0254098

Please sign in to comment.