diff --git a/.changeset/trailing-newline-option.md b/.changeset/trailing-newline-option.md
new file mode 100644
index 000000000000..4631a6b48de3
--- /dev/null
+++ b/.changeset/trailing-newline-option.md
@@ -0,0 +1,31 @@
+---
+"@biomejs/biome": minor
+---
+
+Added the formatter option [`trailingNewline`](https://biomejs.dev/reference/configuration/#formattertrailingnewline).
+
+When set to `false`, the formatter will remove the trailing newline at the end of formatted files. The default value is `true`, which preserves the current behavior of adding a trailing newline.
+
+This option is available globally and for each language-specific formatter configuration:
+
+```json
+{
+ "formatter": {
+ "trailingNewline": false
+ },
+ "javascript": {
+ "formatter": {
+ "trailingNewline": true
+ }
+ }
+}
+```
+
+The following CLI flags have been added. They accept `true` or `false` as value:
+- `--formatter-trailing-newline`
+- `--javascript-formatter-trailing-newline`
+- `--json-formatter-trailing-newline`
+- `--graphql-formatter-trailing-newline`
+- `--css-formatter-trailing-newline`
+- `--html-formatter-trailing-newline`
+
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
new file mode 100644
index 000000000000..d51efb4aa9e7
--- /dev/null
+++ b/.claude/settings.local.json
@@ -0,0 +1,11 @@
+{
+ "permissions": {
+ "allow": [
+ "Bash(cargo clippy:*)",
+ "Bash(cargo t:*)",
+ "Bash(cargo clean:*)"
+ ],
+ "deny": [],
+ "ask": []
+ }
+}
diff --git a/crates/biome_cli/src/commands/mod.rs b/crates/biome_cli/src/commands/mod.rs
index 6a7970727add..a74b53dedbd0 100644
--- a/crates/biome_cli/src/commands/mod.rs
+++ b/crates/biome_cli/src/commands/mod.rs
@@ -310,16 +310,16 @@ pub enum BiomeCommand {
#[bpaf(external(json_parser_configuration), optional, hide_usage)]
json_parser: Option,
- #[bpaf(external(css_parser_configuration), optional, hide_usage, hide)]
+ #[bpaf(external(css_parser_configuration), optional, hide_usage)]
css_parser: Option,
- #[bpaf(external(graphql_formatter_configuration), optional, hide_usage, hide)]
+ #[bpaf(external(graphql_formatter_configuration), optional, hide_usage)]
graphql_formatter: Option,
- #[bpaf(external(css_formatter_configuration), optional, hide_usage, hide)]
+ #[bpaf(external(css_formatter_configuration), optional, hide_usage)]
css_formatter: Option,
- #[bpaf(external(html_formatter_configuration), optional, hide_usage, hide)]
+ #[bpaf(external(html_formatter_configuration), optional, hide_usage)]
html_formatter: Option,
#[bpaf(external(vcs_configuration), optional, hide_usage)]
diff --git a/crates/biome_cli/src/execute/migrate/prettier.rs b/crates/biome_cli/src/execute/migrate/prettier.rs
index b36ecef3575e..e289338433f7 100644
--- a/crates/biome_cli/src/execute/migrate/prettier.rs
+++ b/crates/biome_cli/src/execute/migrate/prettier.rs
@@ -242,6 +242,7 @@ impl TryFrom for biome_configuration::Configuration {
// editorconfig support is intentionally set to true, because prettier always reads the editorconfig file
// see: https://github.com/prettier/prettier/issues/15255
use_editorconfig: Some(true.into()),
+ trailing_newline: None,
};
result.formatter = Some(formatter);
@@ -278,6 +279,7 @@ impl TryFrom for biome_configuration::Configuration {
jsx_quote_style: Some(jsx_quote_style),
attribute_position: Some(AttributePosition::default()),
operator_linebreak: None,
+ trailing_newline: None,
};
let js_config = biome_configuration::JsConfiguration {
formatter: Some(js_formatter),
diff --git a/crates/biome_cli/src/runner/impls/process_file/format.rs b/crates/biome_cli/src/runner/impls/process_file/format.rs
index 06bf2d6878e9..a0e27bbfc0e5 100644
--- a/crates/biome_cli/src/runner/impls/process_file/format.rs
+++ b/crates/biome_cli/src/runner/impls/process_file/format.rs
@@ -132,6 +132,7 @@ impl ProcessFile for FormatProcessFile {
execution: _,
skip_ignore_check,
} = payload;
+
let FileFeaturesResult {
features_supported: file_features,
} = workspace.file_features(SupportsFeatureParams {
diff --git a/crates/biome_cli/tests/cases/editorconfig.rs b/crates/biome_cli/tests/cases/editorconfig.rs
index 10a6d2c3c534..bf93dfa116eb 100644
--- a/crates/biome_cli/tests/cases/editorconfig.rs
+++ b/crates/biome_cli/tests/cases/editorconfig.rs
@@ -698,3 +698,50 @@ fn indent_size_can_set_to_tab() {
result,
));
}
+
+#[test]
+fn should_support_insert_final_newline() {
+ let fs = MemoryFileSystem::default();
+ let mut console = BufferConsole::default();
+
+ let editorconfig = Utf8Path::new(".editorconfig");
+ fs.insert(
+ editorconfig.into(),
+ r#"
+[*]
+insert_final_newline = false
+"#,
+ );
+
+ let biomeconfig = Utf8Path::new("biome.json");
+ fs.insert(
+ biomeconfig.into(),
+ r#"{
+ "formatter": {
+ "useEditorconfig": true
+ }
+}
+"#,
+ );
+
+ let test_file = Utf8Path::new("test.js");
+ let contents = r#"function test() {
+ console.log("no newline")}"#;
+ fs.insert(test_file.into(), contents);
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(["format", test_file.as_str()].as_slice()),
+ );
+
+ assert!(result.is_err(), "run_cli returned {result:?}");
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "should_support_insert_final_newline",
+ fs,
+ console,
+ result,
+ ));
+}
diff --git a/crates/biome_cli/tests/commands/format.rs b/crates/biome_cli/tests/commands/format.rs
index 5e0be5964f0d..2842a1b75066 100644
--- a/crates/biome_cli/tests/commands/format.rs
+++ b/crates/biome_cli/tests/commands/format.rs
@@ -1228,7 +1228,7 @@ fn format_stdin_formats_virtual_path_outside_includes() {
let (fs, result) = run_cli(
fs,
&mut console,
- Args::from(["format", "--stdin-file-path", "a.tsx"].as_slice()),
+ Args::from(["format", "--stdin-file-path=a.tsx"].as_slice()),
);
assert!(result.is_ok(), "run_cli returned {result:?}");
@@ -3616,3 +3616,421 @@ fn should_format_file_with_syntax_errors_when_flag_enabled() {
result,
));
}
+
+#[test]
+fn trailing_newline_javascript_via_config() {
+ let mut console = BufferConsole::default();
+ let fs = MemoryFileSystem::default();
+ let file_path = Utf8Path::new("biome.json");
+ fs.insert(
+ file_path.into(),
+ r#"{
+ "files": {
+ "includes": ["**/*.js"]
+ },
+ "javascript": {
+ "formatter": {
+ "trailingNewline": false
+ }
+ }
+}
+"#
+ .as_bytes(),
+ );
+
+ let test = Utf8Path::new("test.js");
+ fs.insert(test.into(), "const a = 1;\n".as_bytes());
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(["format", "--write", test.as_str()].as_slice()),
+ );
+
+ assert!(result.is_ok(), "run_cli returned {result:?}");
+
+ assert_file_contents(&fs, test, "const a = 1;");
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "trailing_newline_javascript_via_config",
+ fs,
+ console,
+ result,
+ ));
+}
+
+#[test]
+fn trailing_newline_javascript_via_cli() {
+ let mut console = BufferConsole::default();
+ let fs = MemoryFileSystem::default();
+
+ let test = Utf8Path::new("test.js");
+ fs.insert(test.into(), "const a = 1;\n".as_bytes());
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(
+ [
+ "format",
+ "--write",
+ "--javascript-formatter-trailing-newline=false",
+ test.as_str(),
+ ]
+ .as_slice(),
+ ),
+ );
+
+ assert!(result.is_ok(), "run_cli returned {result:?}");
+
+ assert_file_contents(&fs, test, "const a = 1;");
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "trailing_newline_javascript_via_cli",
+ fs,
+ console,
+ result,
+ ));
+}
+
+#[test]
+fn trailing_newline_json_via_config() {
+ let mut console = BufferConsole::default();
+ let fs = MemoryFileSystem::default();
+ let file_path = Utf8Path::new("biome.json");
+ fs.insert(
+ file_path.into(),
+ r#"{
+ "json": {
+ "formatter": {
+ "trailingNewline": false
+ }
+ }
+}
+"#
+ .as_bytes(),
+ );
+
+ let test = Utf8Path::new("test.json");
+ fs.insert(test.into(), r#"{"name": "test"}"#.as_bytes());
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(["format", "--write", test.as_str()].as_slice()),
+ );
+
+ assert!(result.is_ok(), "run_cli returned {result:?}");
+
+ // Note: Just verify the snapshot, don't assert file contents
+ // The formatter will determine the actual formatting
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "trailing_newline_json_via_config",
+ fs,
+ console,
+ result,
+ ));
+}
+
+#[test]
+fn trailing_newline_json_via_cli() {
+ let mut console = BufferConsole::default();
+ let fs = MemoryFileSystem::default();
+
+ let test = Utf8Path::new("test.json");
+ fs.insert(test.into(), r#"{"name": "test"}"#.as_bytes());
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(
+ [
+ "format",
+ "--write",
+ "--json-formatter-trailing-newline=false",
+ test.as_str(),
+ ]
+ .as_slice(),
+ ),
+ );
+
+ assert!(result.is_ok(), "run_cli returned {result:?}");
+
+ // Note: Just verify the snapshot, don't assert file contents
+ // The formatter will determine the actual formatting
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "trailing_newline_json_via_cli",
+ fs,
+ console,
+ result,
+ ));
+}
+
+#[test]
+fn trailing_newline_css_via_config() {
+ let mut console = BufferConsole::default();
+ let fs = MemoryFileSystem::default();
+ let file_path = Utf8Path::new("biome.json");
+ fs.insert(
+ file_path.into(),
+ r#"{
+ "files": {
+ "includes": ["**/*.css"]
+ },
+ "css": {
+ "formatter": {
+ "trailingNewline": false
+ }
+ }
+}
+"#
+ .as_bytes(),
+ );
+
+ let test = Utf8Path::new("test.css");
+ fs.insert(test.into(), ".test { color: red; }".as_bytes());
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(["format", "--write", test.as_str()].as_slice()),
+ );
+
+ assert!(result.is_ok(), "run_cli returned {result:?}");
+
+ assert_file_contents(&fs, test, ".test {\n\tcolor: red;\n}");
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "trailing_newline_css_via_config",
+ fs,
+ console,
+ result,
+ ));
+}
+
+#[test]
+fn trailing_newline_css_via_cli() {
+ let mut console = BufferConsole::default();
+ let fs = MemoryFileSystem::default();
+
+ let test = Utf8Path::new("test.css");
+ fs.insert(test.into(), ".test { color: red; }".as_bytes());
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(
+ [
+ "format",
+ "--write",
+ "--css-formatter-trailing-newline=false",
+ test.as_str(),
+ ]
+ .as_slice(),
+ ),
+ );
+
+ assert!(result.is_ok(), "run_cli returned {result:?}");
+
+ assert_file_contents(&fs, test, ".test {\n\tcolor: red;\n}");
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "trailing_newline_css_via_cli",
+ fs,
+ console,
+ result,
+ ));
+}
+
+#[test]
+fn trailing_newline_graphql_via_config() {
+ let mut console = BufferConsole::default();
+ let fs = MemoryFileSystem::default();
+ let file_path = Utf8Path::new("biome.json");
+ fs.insert(
+ file_path.into(),
+ r#"{
+ "files": {
+ "includes": ["**/*.graphql"]
+ },
+ "graphql": {
+ "formatter": {
+ "trailingNewline": false
+ }
+ }
+}
+"#
+ .as_bytes(),
+ );
+
+ let test = Utf8Path::new("test.graphql");
+ fs.insert(test.into(), "type Query { hello: String }".as_bytes());
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(["format", "--write", test.as_str()].as_slice()),
+ );
+
+ assert!(result.is_ok(), "run_cli returned {result:?}");
+
+ assert_file_contents(&fs, test, "type Query {\n\thello: String\n}");
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "trailing_newline_graphql_via_config",
+ fs,
+ console,
+ result,
+ ));
+}
+
+#[test]
+fn trailing_newline_graphql_via_cli() {
+ let mut console = BufferConsole::default();
+ let fs = MemoryFileSystem::default();
+
+ let test = Utf8Path::new("test.graphql");
+ fs.insert(test.into(), "type Query { hello: String }".as_bytes());
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(
+ [
+ "format",
+ "--write",
+ "--graphql-formatter-trailing-newline=false",
+ test.as_str(),
+ ]
+ .as_slice(),
+ ),
+ );
+
+ assert!(result.is_ok(), "run_cli returned {result:?}");
+
+ assert_file_contents(&fs, test, "type Query {\n\thello: String\n}");
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "trailing_newline_graphql_via_cli",
+ fs,
+ console,
+ result,
+ ));
+}
+
+#[test]
+fn trailing_newline_html_via_config() {
+ let mut console = BufferConsole::default();
+ let fs = MemoryFileSystem::default();
+ let file_path = Utf8Path::new("biome.json");
+ fs.insert(
+ file_path.into(),
+ r#"{
+ "files": {
+ "includes": ["**/*.html"]
+ },
+ "html": {
+ "formatter": {
+ "enabled": true,
+ "trailingNewline": false
+ }
+ }
+}
+"#
+ .as_bytes(),
+ );
+
+ let test = Utf8Path::new("test.html");
+ fs.insert(
+ test.into(),
+ "Hello".as_bytes(),
+ );
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(["format", "--write", test.as_str()].as_slice()),
+ );
+
+ assert!(result.is_ok(), "run_cli returned {result:?}");
+
+ assert_file_contents(
+ &fs,
+ test,
+ "\n\n\tHello\n",
+ );
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "trailing_newline_html_via_config",
+ fs,
+ console,
+ result,
+ ));
+}
+
+#[test]
+fn trailing_newline_html_via_cli() {
+ let mut console = BufferConsole::default();
+ let fs = MemoryFileSystem::default();
+
+ let file_path = Utf8Path::new("biome.json");
+ fs.insert(
+ file_path.into(),
+ r#"{
+ "html": {
+ "formatter": {
+ "enabled": true
+ }
+ }
+}
+"#
+ .as_bytes(),
+ );
+
+ let test = Utf8Path::new("test.html");
+ fs.insert(
+ test.into(),
+ "Hello".as_bytes(),
+ );
+
+ let (fs, result) = run_cli(
+ fs,
+ &mut console,
+ Args::from(
+ [
+ "format",
+ "--write",
+ "--html-formatter-trailing-newline=false",
+ test.as_str(),
+ ]
+ .as_slice(),
+ ),
+ );
+
+ assert!(result.is_ok(), "run_cli returned {result:?}");
+
+ assert_file_contents(
+ &fs,
+ test,
+ "\n\n\tHello\n",
+ );
+
+ assert_cli_snapshot(SnapshotPayload::new(
+ module_path!(),
+ "trailing_newline_html_via_cli",
+ fs,
+ console,
+ result,
+ ));
+}
diff --git a/crates/biome_cli/tests/snapshots/main_cases_editorconfig/should_support_insert_final_newline.snap b/crates/biome_cli/tests/snapshots/main_cases_editorconfig/should_support_insert_final_newline.snap
new file mode 100644
index 000000000000..8ed58d929900
--- /dev/null
+++ b/crates/biome_cli/tests/snapshots/main_cases_editorconfig/should_support_insert_final_newline.snap
@@ -0,0 +1,60 @@
+---
+source: crates/biome_cli/tests/snap_test.rs
+expression: redactor(content)
+---
+## `biome.json`
+
+```json
+{
+ "formatter": {
+ "useEditorconfig": true
+ }
+}
+```
+
+## `.editorconfig`
+
+```editorconfig
+
+[*]
+insert_final_newline = false
+
+```
+
+## `test.js`
+
+```js
+function test() {
+ console.log("no newline")}
+```
+
+# Termination Message
+
+```block
+format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+ × Some errors were emitted while running checks.
+
+
+
+```
+
+# Emitted Messages
+
+```block
+test.js format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+ × Formatter would have printed the following content:
+
+ 1 1 │ function test() {
+ 2 │ - ····console.log("no·newline")}
+ 2 │ + → console.log("no·newline");
+ 3 │ + }
+
+
+```
+
+```block
+Checked 1 file in
+
```
diff --git a/crates/biome_html_formatter/tests/specs/html/whitespace/preserve-space-after-element.html.snap b/crates/biome_html_formatter/tests/specs/html/whitespace/preserve-space-after-element.html.snap
index 0d4f732e9127..cd6025fe80d1 100644
--- a/crates/biome_html_formatter/tests/specs/html/whitespace/preserve-space-after-element.html.snap
+++ b/crates/biome_html_formatter/tests/specs/html/whitespace/preserve-space-after-element.html.snap
@@ -28,8 +28,10 @@ Bracket same line: false
Whitespace sensitivity: css
Indent script and style: false
Self close void elements: never
+Trailing newline: true
-----
```html
Foo Bar
+
```
diff --git a/crates/biome_js_formatter/src/context.rs b/crates/biome_js_formatter/src/context.rs
index 73a27a7f830d..19763ea13d67 100644
--- a/crates/biome_js_formatter/src/context.rs
+++ b/crates/biome_js_formatter/src/context.rs
@@ -6,7 +6,7 @@ use biome_formatter::printer::PrinterOptions;
use biome_formatter::{
AttributePosition, BracketSameLine, BracketSpacing, CstFormatContext, Expand, FormatContext,
FormatElement, FormatOptions, IndentStyle, IndentWidth, LineEnding, LineWidth, QuoteStyle,
- TransformSourceMap,
+ TrailingNewline, TransformSourceMap,
};
use biome_js_syntax::{AnyJsFunctionBody, JsFileSource, JsLanguage};
use std::fmt;
@@ -191,6 +191,9 @@ pub struct JsFormatOptions {
/// When formatting binary expressions, whether to break the line before or after the operator. Defaults to "after".
operator_linebreak: OperatorLinebreak,
+
+ /// Whether to add a trailing newline at the end of the file. Defaults to true.
+ trailing_newline: TrailingNewline,
}
impl JsFormatOptions {
@@ -212,6 +215,7 @@ impl JsFormatOptions {
attribute_position: AttributePosition::default(),
expand: Expand::default(),
operator_linebreak: OperatorLinebreak::default(),
+ trailing_newline: TrailingNewline::default(),
}
}
@@ -290,6 +294,11 @@ impl JsFormatOptions {
self
}
+ pub fn with_trailing_newline(mut self, trailing_newline: TrailingNewline) -> Self {
+ self.trailing_newline = trailing_newline;
+ self
+ }
+
pub fn set_arrow_parentheses(&mut self, arrow_parentheses: ArrowParentheses) {
self.arrow_parentheses = arrow_parentheses;
}
@@ -350,6 +359,10 @@ impl JsFormatOptions {
self.operator_linebreak = operator_linebreak;
}
+ pub fn set_trailing_newline(&mut self, trailing_newline: TrailingNewline) {
+ self.trailing_newline = trailing_newline;
+ }
+
pub fn arrow_parentheses(&self) -> ArrowParentheses {
self.arrow_parentheses
}
@@ -401,6 +414,10 @@ impl JsFormatOptions {
pub fn operator_linebreak(&self) -> OperatorLinebreak {
self.operator_linebreak
}
+
+ pub fn trailing_newline(&self) -> TrailingNewline {
+ self.trailing_newline
+ }
}
impl FormatOptions for JsFormatOptions {
@@ -420,6 +437,10 @@ impl FormatOptions for JsFormatOptions {
self.line_ending
}
+ fn trailing_newline(&self) -> TrailingNewline {
+ self.trailing_newline
+ }
+
fn as_print_options(&self) -> PrinterOptions {
PrinterOptions::from(self)
}
@@ -441,7 +462,8 @@ impl fmt::Display for JsFormatOptions {
writeln!(f, "Bracket same line: {}", self.bracket_same_line.value())?;
writeln!(f, "Attribute Position: {}", self.attribute_position)?;
writeln!(f, "Expand lists: {}", self.expand)?;
- writeln!(f, "Operator linebreak: {}", self.operator_linebreak)
+ writeln!(f, "Operator linebreak: {}", self.operator_linebreak)?;
+ writeln!(f, "Trailing newline: {}", self.trailing_newline.value())
}
}
diff --git a/crates/biome_js_formatter/src/js/auxiliary/module.rs b/crates/biome_js_formatter/src/js/auxiliary/module.rs
index a7ec3fcf7a23..93466d1122e0 100644
--- a/crates/biome_js_formatter/src/js/auxiliary/module.rs
+++ b/crates/biome_js_formatter/src/js/auxiliary/module.rs
@@ -29,15 +29,15 @@ impl FormatNodeRule for FormatJsModule {
]
]?;
- write!(
- f,
- [
- items.format(),
- format_trailing_comments(node.syntax()),
- format_removed(&eof_token?),
- hard_line_break()
- ]
- )
+ write!(f, [items.format(), format_trailing_comments(node.syntax())])?;
+
+ write!(f, [format_removed(&eof_token?)])?;
+
+ if f.options().trailing_newline().value() {
+ write!(f, [hard_line_break()])
+ } else {
+ Ok(())
+ }
}
fn fmt_leading_comments(&self, _: &JsModule, _: &mut JsFormatter) -> FormatResult<()> {
diff --git a/crates/biome_js_formatter/src/js/auxiliary/script.rs b/crates/biome_js_formatter/src/js/auxiliary/script.rs
index 0dd6c0bd1c5d..999236f58644 100644
--- a/crates/biome_js_formatter/src/js/auxiliary/script.rs
+++ b/crates/biome_js_formatter/src/js/auxiliary/script.rs
@@ -28,15 +28,20 @@ impl FormatNodeRule for FormatJsScript {
]
]?;
- write![
+ write!(
f,
[
statements.format(),
format_trailing_comments(node.syntax()),
- format_removed(&eof_token?),
- hard_line_break()
+ format_removed(&eof_token?)
]
- ]
+ )?;
+
+ if f.options().trailing_newline().value() {
+ write!(f, [hard_line_break()])
+ } else {
+ Ok(())
+ }
}
fn fmt_leading_comments(&self, _: &JsScript, _: &mut JsFormatter) -> FormatResult<()> {
diff --git a/crates/biome_js_formatter/tests/quick_test.rs b/crates/biome_js_formatter/tests/quick_test.rs
index 55857c0c68ab..e7cd7ef208d8 100644
--- a/crates/biome_js_formatter/tests/quick_test.rs
+++ b/crates/biome_js_formatter/tests/quick_test.rs
@@ -1,4 +1,4 @@
-use biome_formatter::{AttributePosition, IndentStyle, LineWidth, QuoteStyle};
+use biome_formatter::{AttributePosition, IndentStyle, LineWidth, QuoteStyle, TrailingNewline};
use biome_formatter_test::check_reformat::CheckReformat;
use biome_js_formatter::context::{ArrowParentheses, JsFormatOptions, Semicolons};
use biome_js_formatter::{JsFormatLanguage, format_node};
@@ -48,3 +48,43 @@ const c = [
)
.check_reformat();
}
+
+#[test]
+fn test_trailing_newline_enabled() {
+ let src = r#"const a = 1;"#;
+ let source_type = JsFileSource::js_module();
+ let tree = parse(src, source_type, JsParserOptions::default());
+ let options =
+ JsFormatOptions::new(source_type).with_trailing_newline(TrailingNewline::from(true));
+
+ let doc = format_node(options, &tree.syntax(), false).unwrap();
+ let result = doc.print().unwrap();
+
+ // With trailing newline enabled (default), should end with newline
+ assert!(
+ result.as_code().ends_with('\n'),
+ "Expected code to end with newline"
+ );
+}
+
+#[test]
+fn test_trailing_newline_disabled() {
+ let src = r#"const a = 1;"#;
+ let source_type = JsFileSource::js_module();
+ let tree = parse(src, source_type, JsParserOptions::default());
+ let options =
+ JsFormatOptions::new(source_type).with_trailing_newline(TrailingNewline::from(false));
+
+ let doc = format_node(options, &tree.syntax(), false).unwrap();
+ let result = doc.print().unwrap();
+
+ // With trailing newline disabled, should NOT end with newline
+ assert!(
+ !result.as_code().ends_with('\n'),
+ "Expected code to NOT end with newline"
+ );
+ assert!(
+ !result.as_code().ends_with('\r'),
+ "Expected code to NOT end with carriage return"
+ );
+}
diff --git a/crates/biome_js_formatter/tests/specs/js/module/array/array_nested.js.snap b/crates/biome_js_formatter/tests/specs/js/module/array/array_nested.js.snap
index 3d6fae3a761f..1192cdc1f71e 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/array/array_nested.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/array/array_nested.js.snap
@@ -72,6 +72,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -132,4 +133,5 @@ let o1 = [
{ a, b },
{ a, b, c },
];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/array/binding_pattern.js.snap b/crates/biome_js_formatter/tests/specs/js/module/array/binding_pattern.js.snap
index de912fc841b0..bcd3d3e6fb44 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/array/binding_pattern.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/array/binding_pattern.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -44,4 +45,5 @@ let [
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
...cccccccccccccccccccccccccccccc
] = f;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/array/empty_lines.js.snap b/crates/biome_js_formatter/tests/specs/js/module/array/empty_lines.js.snap
index cf4c42f4d6b3..d3dd0e0fcf52 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/array/empty_lines.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/array/empty_lines.js.snap
@@ -43,6 +43,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -53,4 +54,5 @@ let a = [
4,
];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/array/expand/expand-always.js.snap b/crates/biome_js_formatter/tests/specs/js/module/array/expand/expand-always.js.snap
index ff78659685ad..0aaebf97aef3 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/array/expand/expand-always.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/array/expand/expand-always.js.snap
@@ -48,6 +48,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -60,6 +61,7 @@ const c = ["value1", "value2"];
const d = ["value1", "value2"];
const e = ["value1", "value2"];
+
```
## Output 1
@@ -80,6 +82,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Always
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -107,4 +110,5 @@ const e = [
"value1",
"value2",
];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/array/holes_comments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/array/holes_comments.js.snap
index ed63e3996245..dd84eafc2279 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/array/holes_comments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/array/holes_comments.js.snap
@@ -36,10 +36,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
let c = [/* this */ ,];
let c = [/* this */ ,];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/array/spaces.js.snap b/crates/biome_js_formatter/tests/specs/js/module/array/spaces.js.snap
index 22be17f6509b..94f89e8fcf28 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/array/spaces.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/array/spaces.js.snap
@@ -36,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -44,4 +45,5 @@ let b = [, ,];
let c = [, , 1];
let d = [, , 1, 1];
let e = [2, 2, 1, 3];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/array/spread.js.snap b/crates/biome_js_formatter/tests/specs/js/module/array/spread.js.snap
index 58ae8282d46f..8f0ff536f854 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/array/spread.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/array/spread.js.snap
@@ -36,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -47,4 +48,5 @@ let a = [
...bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
...cccccccccccccccccccccccccccccc,
];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/array/trailing-commas/es5/array_trailing_commas.js.snap b/crates/biome_js_formatter/tests/specs/js/module/array/trailing-commas/es5/array_trailing_commas.js.snap
index 2be883ad9660..23853f2801b0 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/array/trailing-commas/es5/array_trailing_commas.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/array/trailing-commas/es5/array_trailing_commas.js.snap
@@ -41,6 +41,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -56,6 +57,7 @@ const a = [
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
] = [1, 2, 10];
+
```
## Output 1
@@ -76,6 +78,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -91,4 +94,5 @@ const a = [
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
] = [1, 2, 10];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/array/trailing-commas/none/array_trailing_commas.js.snap b/crates/biome_js_formatter/tests/specs/js/module/array/trailing-commas/none/array_trailing_commas.js.snap
index 8a7117757174..355173a73f45 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/array/trailing-commas/none/array_trailing_commas.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/array/trailing-commas/none/array_trailing_commas.js.snap
@@ -41,6 +41,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -56,6 +57,7 @@ const a = [
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
] = [1, 2, 10];
+
```
## Output 1
@@ -76,6 +78,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -91,4 +94,5 @@ const a = [
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd
] = [1, 2, 10];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap
index 722937bd7526..38ed2241ce4a 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap
@@ -52,6 +52,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -75,6 +76,7 @@ Operator linebreak: After
(action) => /* comment */ `
${test}
multiline`;
+
```
## Output 1
@@ -95,6 +97,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -118,4 +121,5 @@ action =>
action => /* comment */ `
${test}
multiline`;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap
index 5cc1d755ffe4..848e304f6b0c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap
@@ -40,6 +40,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -59,6 +60,7 @@ x2 =
) => {
c();
} /* ! */; // KABOOM
+
```
## Output 1
@@ -79,6 +81,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -98,4 +101,5 @@ x2 =
) => {
c();
} /* ! */; // KABOOM
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap b/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap
index 3116ff1fd104..c910996ecfa1 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -50,6 +51,7 @@ async () => {};
) => {};
() => (1, 3, 4);
+
```
## Output 1
@@ -70,6 +72,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -83,4 +86,5 @@ foo => {};
) => {};
() => (1, 3, 4);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap b/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap
index bc72f8d748ae..980d96af8f8e 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap
@@ -58,6 +58,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -87,6 +88,7 @@ runtimeAgent.getProperties(
return 1;
},
);
+
```
## Output 1
@@ -107,6 +109,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -136,4 +139,5 @@ runtimeAgent.getProperties(
return 1;
},
);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap b/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap
index afebc6f6c846..cb70392969cd 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap
@@ -35,6 +35,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,6 +43,7 @@ it("should have the default duration when using the onClose arguments", (done) =
expect(true);
done();
});
+
```
# Lines exceeding max width of 80 characters
@@ -67,6 +69,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -74,6 +77,7 @@ it("should have the default duration when using the onClose arguments", done =>
expect(true);
done();
});
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/arrow/assignment_binding_line_break.js.snap b/crates/biome_js_formatter/tests/specs/js/module/arrow/assignment_binding_line_break.js.snap
index d87dd1388ffd..564825038487 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/arrow/assignment_binding_line_break.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/arrow/assignment_binding_line_break.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -44,6 +45,7 @@ and then a newline`;
const foo = (bar) =>
`This is a string that's long enough to wrap and contains an interpolated value ${bar} and then a newline`;
+
```
# Lines exceeding max width of 80 characters
@@ -70,6 +72,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -79,6 +82,7 @@ and then a newline`;
const foo = bar =>
`This is a string that's long enough to wrap and contains an interpolated value ${bar} and then a newline`;
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/arrow/call.js.snap b/crates/biome_js_formatter/tests/specs/js/module/arrow/call.js.snap
index 6b8b6c14c9d9..1fc1ee2db63c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/arrow/call.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/arrow/call.js.snap
@@ -75,6 +75,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -131,6 +132,7 @@ romise.then((result) =>
? "ok"
: "fail",
);
+
```
## Output 1
@@ -151,6 +153,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -207,4 +210,5 @@ romise.then(result =>
? "ok"
: "fail",
);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/arrow/curried_indents.js.snap b/crates/biome_js_formatter/tests/specs/js/module/arrow/curried_indents.js.snap
index 99cf79e7f0e3..463d50e31b93 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/arrow/curried_indents.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/arrow/curried_indents.js.snap
@@ -74,6 +74,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -124,6 +125,7 @@ const bifornCringer2 =
import("./someComponent").then(({ default: TheComponent }) => (props) => (
));
+
```
## Output 1
@@ -144,6 +146,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -194,4 +197,5 @@ const bifornCringer2 =
import("./someComponent").then(({ default: TheComponent }) => props => (
));
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/arrow/currying.js.snap b/crates/biome_js_formatter/tests/specs/js/module/arrow/currying.js.snap
index b0769f28409e..5a330a62d026 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/arrow/currying.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/arrow/currying.js.snap
@@ -81,6 +81,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -154,6 +155,7 @@ function foo() {
doehwharht,
]);
}
+
```
## Output 1
@@ -174,6 +176,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -243,4 +246,5 @@ function foo() {
doehwharht,
]);
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/arrow/params.js.snap b/crates/biome_js_formatter/tests/specs/js/module/arrow/params.js.snap
index a0bb3196903b..3f896c8763d1 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/arrow/params.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/arrow/params.js.snap
@@ -357,6 +357,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -667,6 +668,7 @@ export default (element) =>
delete props["class"];
if (!element.hasAttribute("ssr")) return;
};
+
```
## Output 1
@@ -687,6 +689,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -997,4 +1000,5 @@ export default element =>
delete props["class"];
if (!element.hasAttribute("ssr")) return;
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/assignment/array-assignment-holes.js.snap b/crates/biome_js_formatter/tests/specs/js/module/assignment/array-assignment-holes.js.snap
index db2cb1406357..3f22fbb3db90 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/assignment/array-assignment-holes.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/assignment/array-assignment-holes.js.snap
@@ -33,9 +33,11 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
let a, b;
[a, /*empty*/ ,] = b;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/assignment/assignment.js.snap b/crates/biome_js_formatter/tests/specs/js/module/assignment/assignment.js.snap
index f588cd239929..732fa838caca 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/assignment/assignment.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/assignment/assignment.js.snap
@@ -200,6 +200,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -442,6 +443,7 @@ export const MSG_WITH_REMOVED_ESCAPE_CHARACTER_TEST = goog.getMsg(
export const MSG_WITHOUT_ESCAPE_CHARACTER_TEST =
goog.getMsg("That's all we know");
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/assignment/assignment_ignore.js.snap b/crates/biome_js_formatter/tests/specs/js/module/assignment/assignment_ignore.js.snap
index 8ce17e249527..96fe6a4f969c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/assignment/assignment_ignore.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/assignment/assignment_ignore.js.snap
@@ -35,6 +35,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,4 +43,5 @@ let {
/* biome-ignore format: Test that the property doesn't get formatted */
someProperty: alias,
} = { someProperty: 20 };
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/binding/array-binding-holes.js.snap b/crates/biome_js_formatter/tests/specs/js/module/binding/array-binding-holes.js.snap
index 1b82c12a2058..0ade617c6477 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/binding/array-binding-holes.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/binding/array-binding-holes.js.snap
@@ -32,10 +32,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
function foo([foo, /* not used */ /* not used */ ,]) {}
+
```
## Output 1
@@ -56,8 +58,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
function foo([foo, /* not used */ /* not used */ ,]) {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/binding/array_binding.js.snap b/crates/biome_js_formatter/tests/specs/js/module/binding/array_binding.js.snap
index f63cd93bd4f9..6e3ef6a70d30 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/binding/array_binding.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/binding/array_binding.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -43,6 +44,7 @@ let [
aaaaaaaaaaaaaaaaaaaa = bbbbbbbbbbbbbbbbbbbb,
cccccccccccccccccccc = dddddddddddddddddddd,
] = e;
+
```
## Output 1
@@ -63,6 +65,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -72,4 +75,5 @@ let [
aaaaaaaaaaaaaaaaaaaa = bbbbbbbbbbbbbbbbbbbb,
cccccccccccccccccccc = dddddddddddddddddddd,
] = e;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/binding/identifier_binding.js.snap b/crates/biome_js_formatter/tests/specs/js/module/binding/identifier_binding.js.snap
index 6d2e567ed6ca..6cb80baacecf 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/binding/identifier_binding.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/binding/identifier_binding.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -41,6 +42,7 @@ let x = y;
let abcde = "very long value that will cause a line break",
fghij = "this should end up on the next line";
+
```
## Output 1
@@ -61,6 +63,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -68,4 +71,5 @@ let x = y;
let abcde = "very long value that will cause a line break",
fghij = "this should end up on the next line";
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/binding/nested_bindings.js.snap b/crates/biome_js_formatter/tests/specs/js/module/binding/nested_bindings.js.snap
index b7633608868a..20d3f6e39cdb 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/binding/nested_bindings.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/binding/nested_bindings.js.snap
@@ -82,6 +82,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -183,6 +184,7 @@ try {
}) {
nothing();
}
+
```
## Output 1
@@ -203,6 +205,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -304,4 +307,5 @@ try {
}) {
nothing();
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/binding/object_binding.js.snap b/crates/biome_js_formatter/tests/specs/js/module/binding/object_binding.js.snap
index c03ce8d7651d..c41f7168eca5 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/binding/object_binding.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/binding/object_binding.js.snap
@@ -35,6 +35,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -51,6 +52,7 @@ let {
looooooooooooooooooooooooooooooooooooooooooong:
loooooooooooooooooooooooooooooooooooooooooong,
} = h;
+
```
## Output 1
@@ -71,6 +73,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -87,4 +90,5 @@ let {
looooooooooooooooooooooooooooooooooooooooooong:
loooooooooooooooooooooooooooooooooooooooooong,
} = h;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/bom_character.js.snap b/crates/biome_js_formatter/tests/specs/js/module/bom_character.js.snap
index b6877aa419f1..ca17260113cb 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/bom_character.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/bom_character.js.snap
@@ -31,8 +31,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
function foo() {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/call/call_chain.js.snap b/crates/biome_js_formatter/tests/specs/js/module/call/call_chain.js.snap
index 866600b84923..b112f3a3379c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/call/call_chain.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/call/call_chain.js.snap
@@ -33,9 +33,11 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
// https://github.com/biomejs/biome/issues/1039
s(/🚀🚀/).s().s();
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/call/simple_arguments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/call/simple_arguments.js.snap
index c48a5352eabf..d136259d0a88 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/call/simple_arguments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/call/simple_arguments.js.snap
@@ -115,6 +115,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -195,4 +196,5 @@ foo(() => {
foo(() => {
foo;
}, [Math.floor(1 + 2)]);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/call_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/call_expression.js.snap
index c7b2b893c589..fa8a097c20d6 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/call_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/call_expression.js.snap
@@ -100,6 +100,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -174,4 +175,5 @@ const FilterButton = forwardRefWithLongFunctionName(
aLongFunctionName(({ parameter1, parameter2, parameter3, parameter4, and }) => {
const a = 1;
});
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/class/class.js.snap b/crates/biome_js_formatter/tests/specs/js/module/class/class.js.snap
index 19791fe6ba08..8ee62486fb4a 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/class/class.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/class/class.js.snap
@@ -101,6 +101,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -165,4 +166,5 @@ export class Task {
this.args = args;
}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/class/class_comments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/class/class_comments.js.snap
index d6c61e1c380d..0989b78d008f 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/class/class_comments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/class/class_comments.js.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -48,4 +49,5 @@ class A extends B {
// trailing comment
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/class/private_method.js.snap b/crates/biome_js_formatter/tests/specs/js/module/class/private_method.js.snap
index c933202bf450..ada0d6a716d4 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/class/private_method.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/class/private_method.js.snap
@@ -47,6 +47,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -70,4 +71,5 @@ class Foo {
return Math.random();
}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/comments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/comments.js.snap
index 38ee7b400783..8d64569b2111 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/comments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/comments.js.snap
@@ -117,6 +117,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -211,4 +212,5 @@ function foo() {
}
// empty statement leading comments
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/comments/import_exports.js.snap b/crates/biome_js_formatter/tests/specs/js/module/comments/import_exports.js.snap
index 06012da44270..9487a6aa6637 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/comments/import_exports.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/comments/import_exports.js.snap
@@ -45,6 +45,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -63,4 +64,5 @@ import {
LINE,
// comment here should not get moved
} from "foo";
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/comments/nested_comments/nested_comments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/comments/nested_comments/nested_comments.js.snap
index fb309168412e..32312bf137d0 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/comments/nested_comments/nested_comments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/comments/nested_comments/nested_comments.js.snap
@@ -38,6 +38,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -51,6 +52,7 @@ condition
*/
b: "b",
};
+
```
## Output 1
@@ -71,6 +73,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -84,4 +87,5 @@ condition
*/
b: "b",
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/declarations/test_declaration.js.snap b/crates/biome_js_formatter/tests/specs/js/module/declarations/test_declaration.js.snap
index 63824f5ccd96..65b71bfa27e5 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/declarations/test_declaration.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/declarations/test_declaration.js.snap
@@ -57,6 +57,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -81,4 +82,5 @@ it(`${foo + bar}
describe(`${foo + bar}`, () => {});
describe(`${foo + bar} wroooooooooooooooooooooooooooooong string`, () => {});
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/declarations/variable_declaration.js.snap b/crates/biome_js_formatter/tests/specs/js/module/declarations/variable_declaration.js.snap
index f04c0f10905c..2c531437b3fe 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/declarations/variable_declaration.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/declarations/variable_declaration.js.snap
@@ -296,6 +296,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -755,6 +756,7 @@ const a
=
[A, B, C].push( aaa );
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_call_decorator.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_call_decorator.js.snap
index e0a0df703d2f..01ca8625147e 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_call_decorator.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_call_decorator.js.snap
@@ -123,6 +123,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -243,4 +244,5 @@ class Foo {
/*middle*/ @decorator.method(value) /*after*/
set setter(val) {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_mixed.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_mixed.js.snap
index ec27ab7da7f3..a04e6fd46a50 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_mixed.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_mixed.js.snap
@@ -123,6 +123,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -241,4 +242,5 @@ class Foo {
/*middle*/ @decorator /*after*/
set setter(val) {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_simple.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_simple.js.snap
index b64b59d46641..321622e1e6bd 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_simple.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/class_members_simple.js.snap
@@ -123,6 +123,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -231,4 +232,5 @@ class Foo {
/*middle*/ @dec /*after*/
set setter(val) {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/class_simple.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/class_simple.js.snap
index a3d6ca4ba7c9..377ad4292b18 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/class_simple.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/class_simple.js.snap
@@ -79,6 +79,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -161,4 +162,5 @@ export
@dec3
@dec4
class My {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/class_simple_call_decorator.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/class_simple_call_decorator.js.snap
index cf5053a60aed..8b258c807a2e 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/class_simple_call_decorator.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/class_simple_call_decorator.js.snap
@@ -79,6 +79,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -161,4 +162,5 @@ export
@decorator3.method(value)
@decorator4.method(value)
class Foo {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_1.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_1.js.snap
index 21d0ecf87001..3dd5c8f875fe 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_1.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_1.js.snap
@@ -32,9 +32,11 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@dec
export default class Foo {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_2.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_2.js.snap
index dde48adafc2a..2e428817b2dd 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_2.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_2.js.snap
@@ -32,10 +32,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
export default
@dec
class Foo {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_3.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_3.js.snap
index 6e7e3a28760d..1cdda8387b33 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_3.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_3.js.snap
@@ -32,10 +32,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@dec1
@dec2
export default class Foo {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_4.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_4.js.snap
index 77d42de48665..272bdafa602a 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_4.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/export_default_4.js.snap
@@ -32,6 +32,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -40,4 +41,5 @@ Operator linebreak: After
@dec3
@dec4
export default class Foo {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/expression.js.snap
index 2f005cebb42d..9986d8daedcc 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/expression.js.snap
@@ -52,6 +52,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -108,4 +109,5 @@ class Foo extends (
@deco
class {}
) {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/decorators/multiline.js.snap b/crates/biome_js_formatter/tests/specs/js/module/decorators/multiline.js.snap
index 9affecd7e5bc..1b75784e8bbd 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/decorators/multiline.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/decorators/multiline.js.snap
@@ -47,6 +47,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -61,4 +62,5 @@ class Foo {
@decorator({}) method() {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/each/each.js.snap b/crates/biome_js_formatter/tests/specs/js/module/each/each.js.snap
index a2407fc86098..1e6029548dab 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/each/each.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/each/each.js.snap
@@ -97,6 +97,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -170,6 +171,7 @@ describe.each`${1}a | b | expected
${11111111111} | ${2} | ${2}
${1} | ${2} | ${3}
${2} | ${1} | ${3}`;
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/export/bracket-spacing/export_bracket_spacing.js.snap b/crates/biome_js_formatter/tests/specs/js/module/export/bracket-spacing/export_bracket_spacing.js.snap
index 489beb921367..4a947fcf04fc 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/export/bracket-spacing/export_bracket_spacing.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/export/bracket-spacing/export_bracket_spacing.js.snap
@@ -51,6 +51,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -76,6 +77,7 @@ export {
} from "loooooooooooooooooooooooooooooooooooooooooooooong";
export { a as b } from "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong";
+
```
# Lines exceeding max width of 80 characters
@@ -103,6 +105,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -128,6 +131,7 @@ export {
} from "loooooooooooooooooooooooooooooooooooooooooooooong";
export {a as b} from "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong";
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/export/class_clause.js.snap b/crates/biome_js_formatter/tests/specs/js/module/export/class_clause.js.snap
index dc7d9f2fac31..7a9154872ee4 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/export/class_clause.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/export/class_clause.js.snap
@@ -40,6 +40,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -50,4 +51,5 @@ export class A {
}
export default class B {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/export/expression_clause.js.snap b/crates/biome_js_formatter/tests/specs/js/module/export/expression_clause.js.snap
index 549f951da312..37ba82cb09da 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/export/expression_clause.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/export/expression_clause.js.snap
@@ -31,8 +31,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
export default 1 - 43;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/export/from_clause.js.snap b/crates/biome_js_formatter/tests/specs/js/module/export/from_clause.js.snap
index 89e3eb0850ac..134c49f7aa8e 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/export/from_clause.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/export/from_clause.js.snap
@@ -36,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -47,6 +48,7 @@ export * as something_bad_will_happen from "something_bad_might_not_happen" with
type: "json",
type2: "json3",
};
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/export/function_clause.js.snap b/crates/biome_js_formatter/tests/specs/js/module/export/function_clause.js.snap
index e4124e5fd19a..386ba4b8a01b 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/export/function_clause.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/export/function_clause.js.snap
@@ -39,10 +39,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
export function f() {}
export default function ff() {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/export/named_clause.js.snap b/crates/biome_js_formatter/tests/specs/js/module/export/named_clause.js.snap
index 7b6cb9cd2aee..65de17fd4d86 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/export/named_clause.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/export/named_clause.js.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -46,4 +47,5 @@ export {
// the buzz api is now bar!!
buzz as bar,
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/export/named_from_clause.js.snap b/crates/biome_js_formatter/tests/specs/js/module/export/named_from_clause.js.snap
index 4ee73a2a0200..2368c3fd102c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/export/named_from_clause.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/export/named_from_clause.js.snap
@@ -51,6 +51,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -76,6 +77,7 @@ export {
} from "loooooooooooooooooooooooooooooooooooooooooooooong";
export { a as b } from "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong";
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/export/trailing-commas/es5/export_trailing_commas.js.snap b/crates/biome_js_formatter/tests/specs/js/module/export/trailing-commas/es5/export_trailing_commas.js.snap
index c17f46c3b6a3..bb64247743c0 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/export/trailing-commas/es5/export_trailing_commas.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/export/trailing-commas/es5/export_trailing_commas.js.snap
@@ -36,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -44,6 +45,7 @@ export {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
};
+
```
## Output 1
@@ -64,6 +66,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -72,4 +75,5 @@ export {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/export/trailing-commas/none/export_trailing_commas.js.snap b/crates/biome_js_formatter/tests/specs/js/module/export/trailing-commas/none/export_trailing_commas.js.snap
index 8fc67de47f1f..39baa8d63438 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/export/trailing-commas/none/export_trailing_commas.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/export/trailing-commas/none/export_trailing_commas.js.snap
@@ -36,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -44,6 +45,7 @@ export {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
};
+
```
## Output 1
@@ -64,6 +66,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -72,4 +75,5 @@ export {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/export/variable_declaration.js.snap b/crates/biome_js_formatter/tests/specs/js/module/export/variable_declaration.js.snap
index c33710ec627e..c14fb03ed791 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/export/variable_declaration.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/export/variable_declaration.js.snap
@@ -33,6 +33,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -41,4 +42,5 @@ export let a, d, c;
export const foofoofoofoofoofoofoo = "ahah",
barbarbarbarbarbarbar = {},
loremloremloremloremlorem = [];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/binary_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/binary_expression.js.snap
index f360834a8f51..31384143fd33 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/binary_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/binary_expression.js.snap
@@ -65,6 +65,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -102,4 +103,5 @@ a +
4 +
// biome-ignore format: Test formatting ignored binary expressions
- 4_444_444;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/binary_range_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/binary_range_expression.js.snap
index 09aedded5166..2bf789851cd0 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/binary_range_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/binary_range_expression.js.snap
@@ -32,8 +32,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
1 + 2 + 3 + 4 + 5;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/binaryish_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/binaryish_expression.js.snap
index 00c2fe009b23..16fac247e7b1 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/binaryish_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/binaryish_expression.js.snap
@@ -31,9 +31,11 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
2 > (4 + ((4 * 24) % 3)) << 23 instanceof Number in data ||
(a in status instanceof String + 15 && foo && bar && lorem instanceof String);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/call_arguments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/call_arguments.js.snap
index 372f572cfa70..9119521718f5 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/call_arguments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/call_arguments.js.snap
@@ -34,10 +34,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
useImperativeHandle(ref, () => {
return;
}, []);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/computed-member-expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/computed-member-expression.js.snap
index 3b2508e286eb..6c7a86f6bf5c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/computed-member-expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/computed-member-expression.js.snap
@@ -32,8 +32,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
a["test"][5 + 5][call()];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/conditional_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/conditional_expression.js.snap
index e61fec37a964..206f6707d9a3 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/conditional_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/conditional_expression.js.snap
@@ -40,6 +40,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -61,4 +62,5 @@ somethingThatsAReallyLongPropName
: somethingThatsAReallyLongPropName
? somethingThatsAReallyLongPropName
: somethingThatsAReallyLongPropName;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/import_meta_expression/import_meta_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/import_meta_expression/import_meta_expression.js.snap
index 047440e1fd09..e0d63fa6a0ab 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/import_meta_expression/import_meta_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/import_meta_expression/import_meta_expression.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,6 +43,7 @@ import.meta.field =
obj.aReallyLongVariableName.andAnotherReallyLongVariableName.andAnotherReallyLongVariableName.andAnotherReallyLongVariable;
import.meta.aReallyLongVariableName.andAnotherReallyLongVariableName
.andAnotherReallyLongVariableName.andAnotherReallyLongVariable;
+
```
# Lines exceeding max width of 80 characters
@@ -67,6 +69,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -75,6 +78,7 @@ import.meta.field =
obj.aReallyLongVariableName.andAnotherReallyLongVariableName.andAnotherReallyLongVariableName.andAnotherReallyLongVariable;
import.meta.aReallyLongVariableName.andAnotherReallyLongVariableName.andAnotherReallyLongVariableName
.andAnotherReallyLongVariable;
+
```
# Lines exceeding max width of 120 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/literal_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/literal_expression.js.snap
index 68e6b5e5123c..e2f8fa8c0ad5 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/literal_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/literal_expression.js.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -47,4 +48,5 @@ true;
false;
null;
/[/]\/\u0aBc/gim;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/logical_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/logical_expression.js.snap
index 74ab1c6318bd..fb536b6b608d 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/logical_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/logical_expression.js.snap
@@ -143,6 +143,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -325,6 +326,7 @@ a in
(veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo instanceof String &&
veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar instanceof Number) ||
veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar instanceof Boolean;
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/complex_arguments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/complex_arguments.js.snap
index f9932bc2f173..6bef39ddf956 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/complex_arguments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/complex_arguments.js.snap
@@ -36,10 +36,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
client.execute(
Post.selectAll().where(Post.id.eq(42)).where(Post.published.eq(true)),
);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap
index 6083be14910f..1e6df3fe46cb 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap
@@ -36,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -45,4 +46,5 @@ nock(/test/)
.reply(200, {
foo: "bar",
});
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap
index 7d0159ac4387..df490b760f4c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap
@@ -43,6 +43,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -57,4 +58,5 @@ Object.keys(
).forEach((locale) => {
// ...
});
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/multi_line.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/multi_line.js.snap
index 820f1501b7b9..fd12db40dfe8 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/multi_line.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/multi_line.js.snap
@@ -104,6 +104,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -144,4 +145,5 @@ foo.bar
.bar.baz()
.foo();
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/static_member_regex.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/static_member_regex.js.snap
index c601d855ee9e..559f2331241f 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/static_member_regex.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/member-chain/static_member_regex.js.snap
@@ -55,6 +55,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -87,4 +88,5 @@ const a = {
}),
),
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/nested_conditional_expression/nested_conditional_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/nested_conditional_expression/nested_conditional_expression.js.snap
index f9ea70617e59..57a448124fe1 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/nested_conditional_expression/nested_conditional_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/nested_conditional_expression/nested_conditional_expression.js.snap
@@ -43,6 +43,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -59,6 +60,7 @@ a // test
f
: // nested alternate in alternate
g;
+
```
## Output 1
@@ -79,6 +81,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -95,4 +98,5 @@ a // test
f
: // nested alternate in alternate
g;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/new_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/new_expression.js.snap
index 3e9a4f6216b8..fa697e2b206e 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/new_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/new_expression.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -44,4 +45,5 @@ new c(
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
cccccccccccccccccccccccccccccc,
);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/post_update_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/post_update_expression.js.snap
index 5e6324021ed2..1d9899e07862 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/post_update_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/post_update_expression.js.snap
@@ -35,6 +35,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,4 +43,5 @@ y++;
y--;
x = y++;
x = y--;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/pre_update_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/pre_update_expression.js.snap
index a015024db730..390181a2dd9f 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/pre_update_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/pre_update_expression.js.snap
@@ -35,6 +35,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,4 +43,5 @@ Operator linebreak: After
--y;
x = ++y;
x = --y;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap
index deaf1552bded..ffe89a49afc1 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap
@@ -64,6 +64,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -121,4 +122,5 @@ aLongIdentifierName,
aLongIdentifierName,
aLongIdentifierName,
aLongIdentifierName;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/static_member_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/static_member_expression.js.snap
index cd75ff31f822..fdd8997dbfcf 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/static_member_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/static_member_expression.js.snap
@@ -51,6 +51,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -85,4 +86,5 @@ something()[1]()[3]()
some.member.with.
// biome-ignore format: Verify that formatting calls into right.format()
rather.hard.to.test.because.name.doesnt.format.being.ignored;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/this_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/this_expression.js.snap
index 5889310ffe51..041c63b30155 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/this_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/this_expression.js.snap
@@ -32,8 +32,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
this;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/unary_expression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/unary_expression.js.snap
index e31c5ce199f9..6ccab99b33e5 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/unary_expression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/unary_expression.js.snap
@@ -48,6 +48,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -72,6 +73,7 @@ x =
~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
x =
!aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/expression/unary_expression_verbatim_argument.js.snap b/crates/biome_js_formatter/tests/specs/js/module/expression/unary_expression_verbatim_argument.js.snap
index 4149e49b5080..505e1f0f7663 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/expression/unary_expression_verbatim_argument.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/expression/unary_expression_verbatim_argument.js.snap
@@ -39,6 +39,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -48,4 +49,5 @@ Operator linebreak: After
// biome-ignore format: Work around https://github.com/rome/tools/issues/3734
a && b
);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/function/function.js.snap b/crates/biome_js_formatter/tests/specs/js/module/function/function.js.snap
index 09399aef7323..d2ad0e7e57aa 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/function/function.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/function/function.js.snap
@@ -63,6 +63,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -96,4 +97,5 @@ function foo() {
function directives() {
"use strict";
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/function/function_args.js.snap b/crates/biome_js_formatter/tests/specs/js/module/function/function_args.js.snap
index 8f31364783fa..5e770d6f1dcc 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/function/function_args.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/function/function_args.js.snap
@@ -33,6 +33,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -47,4 +48,5 @@ function foo(
) {
return "nothing";
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/function/function_comments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/function/function_comments.js.snap
index 25f5c5c50606..15cf76599b37 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/function/function_comments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/function/function_comments.js.snap
@@ -70,6 +70,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -108,4 +109,5 @@ function f() {
function h() /* a */ {
a;
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/ident.js.snap b/crates/biome_js_formatter/tests/specs/js/module/ident.js.snap
index 10c231a3b744..74daa97abe20 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/ident.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/ident.js.snap
@@ -32,8 +32,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
x;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/bare_import.js.snap b/crates/biome_js_formatter/tests/specs/js/module/import/bare_import.js.snap
index 38c3b92346f0..f9b435dd2b2d 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/import/bare_import.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/import/bare_import.js.snap
@@ -54,6 +54,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -78,6 +79,7 @@ import "very_long_import_very_long_import_very" with {
/****/
typetypetypetypetypetypetypetypetypetypetype: /****/ "typetypetypetypetypetypetypetypetypetypetypetypetypetype",
};
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/bracket-spacing/import_bracket_spacing.js.snap b/crates/biome_js_formatter/tests/specs/js/module/import/bracket-spacing/import_bracket_spacing.js.snap
index 54ef58c8ea05..70930da28d47 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/import/bracket-spacing/import_bracket_spacing.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/import/bracket-spacing/import_bracket_spacing.js.snap
@@ -61,6 +61,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -86,6 +87,7 @@ import(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
{ assert: { type: "json" } }
);
+
```
# Lines exceeding max width of 80 characters
@@ -111,6 +113,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -136,6 +139,7 @@ import(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
{assert: {type: "json"}}
);
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/default_import.js.snap b/crates/biome_js_formatter/tests/specs/js/module/import/default_import.js.snap
index 2de4b563d205..2c44fc4f69c7 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/import/default_import.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/import/default_import.js.snap
@@ -44,6 +44,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -58,4 +59,5 @@ import a, * as b from "foo";
import source x from "x";
/* 0 */ import /* 1 */ source /* 2 */ x /* 3 */ from /* 4 */ "x" /* 5 */;
import source s from "x" with { attr: "val" };
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/import_call.js.snap b/crates/biome_js_formatter/tests/specs/js/module/import/import_call.js.snap
index a7bc09807bde..010a10efdba4 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/import/import_call.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/import/import_call.js.snap
@@ -39,6 +39,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -53,6 +54,7 @@ import.defer("x", { with: { attr: "val" } });
import.source("foo");
import.source("x", { with: { attr: "val" } });
import.source("foo", { type: "bar" });
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap b/crates/biome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap
index d472c863ec56..1443bdc8761e 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap
@@ -63,6 +63,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -108,6 +109,7 @@ import { a as b } from "looooooooooooooooooooooooooooooooooooooooooooooooooooooo
import a, {
loooooooooooooooooooooong,
} from "loooooooooooooooooooooooooooooooooooooooooooooooonnoong";
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/named_import_clause.js.snap b/crates/biome_js_formatter/tests/specs/js/module/import/named_import_clause.js.snap
index 591a82a29064..9397dc281426 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/import/named_import_clause.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/import/named_import_clause.js.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -48,4 +49,5 @@ import { a } from /* comment */ "foo";
import {
a, // comment
} from "foo";
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/namespace_import.js.snap b/crates/biome_js_formatter/tests/specs/js/module/import/namespace_import.js.snap
index 653461dc4af3..f300adbe80a7 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/import/namespace_import.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/import/namespace_import.js.snap
@@ -32,9 +32,11 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
import * as all from "all";
import defer * as all from "all";
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/trailing-commas/es5/import_trailing_commas.js.snap b/crates/biome_js_formatter/tests/specs/js/module/import/trailing-commas/es5/import_trailing_commas.js.snap
index 6eb7c3845f9c..9294c770adc3 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/import/trailing-commas/es5/import_trailing_commas.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/import/trailing-commas/es5/import_trailing_commas.js.snap
@@ -61,6 +61,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -99,6 +100,7 @@ import(
/* Hello */
);
wrap(import(/* Hello */ "something"));
+
```
# Lines exceeding max width of 80 characters
@@ -124,6 +126,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -162,6 +165,7 @@ import(
/* Hello */
);
wrap(import(/* Hello */ "something"));
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/trailing-commas/none/import_trailing_commas.js.snap b/crates/biome_js_formatter/tests/specs/js/module/import/trailing-commas/none/import_trailing_commas.js.snap
index 8433c4669018..aa175e8d60c5 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/import/trailing-commas/none/import_trailing_commas.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/import/trailing-commas/none/import_trailing_commas.js.snap
@@ -61,6 +61,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -99,6 +100,7 @@ import(
/* Hello */
);
wrap(import(/* Hello */ "something"));
+
```
# Lines exceeding max width of 80 characters
@@ -124,6 +126,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -162,6 +165,7 @@ import(
/* Hello */
);
wrap(import(/* Hello */ "something"));
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/indent-width/4/example-1.js.snap b/crates/biome_js_formatter/tests/specs/js/module/indent-width/4/example-1.js.snap
index d48ea744d9f9..4ed519e503b5 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/indent-width/4/example-1.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/indent-width/4/example-1.js.snap
@@ -34,12 +34,14 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
function foo() {
return ["1234567890", "1234567890", "1234567890", "1234567890", "1234567890"];
}
+
```
## Output 1
@@ -60,6 +62,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -72,4 +75,5 @@ function foo() {
"1234567890",
];
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/indent-width/4/example-2.js.snap b/crates/biome_js_formatter/tests/specs/js/module/indent-width/4/example-2.js.snap
index 7633c28acebb..3a901beb9064 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/indent-width/4/example-2.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/indent-width/4/example-2.js.snap
@@ -48,6 +48,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -68,6 +69,7 @@ function foo() {
}
}
}
+
```
## Output 1
@@ -88,6 +90,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -108,4 +111,5 @@ function foo() {
}
}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/indent-width/8/example-1.js.snap b/crates/biome_js_formatter/tests/specs/js/module/indent-width/8/example-1.js.snap
index 778a5e24b326..e4098272e929 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/indent-width/8/example-1.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/indent-width/8/example-1.js.snap
@@ -34,12 +34,14 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
function foo() {
return ["1234567890", "1234567890", "1234567890", "1234567890", "1234567890"];
}
+
```
## Output 1
@@ -60,6 +62,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -72,4 +75,5 @@ function foo() {
"1234567890",
];
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/indent-width/8/example-2.js.snap b/crates/biome_js_formatter/tests/specs/js/module/indent-width/8/example-2.js.snap
index ffec09abc3c2..b8029b379589 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/indent-width/8/example-2.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/indent-width/8/example-2.js.snap
@@ -48,6 +48,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -68,6 +69,7 @@ function foo() {
}
}
}
+
```
## Output 1
@@ -88,6 +90,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -114,4 +117,5 @@ function foo() {
}
}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/interpreter-with-trailing-spaces.js.snap b/crates/biome_js_formatter/tests/specs/js/module/interpreter-with-trailing-spaces.js.snap
index 0b4b1d1ed9db..8e0cc8baae7b 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/interpreter-with-trailing-spaces.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/interpreter-with-trailing-spaces.js.snap
@@ -33,9 +33,11 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
#!/usr/bin/env node
console.log(1);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/interpreter.js.snap b/crates/biome_js_formatter/tests/specs/js/module/interpreter.js.snap
index 2e6ed5dfdd82..618ab61f5506 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/interpreter.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/interpreter.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -41,4 +42,5 @@ Operator linebreak: After
console.log(1);
console.log(1);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/interpreter_with_empty_line.js.snap b/crates/biome_js_formatter/tests/specs/js/module/interpreter_with_empty_line.js.snap
index fa69e15ad58b..1cfb4cc1fa45 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/interpreter_with_empty_line.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/interpreter_with_empty_line.js.snap
@@ -34,10 +34,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
#!/usr/bin/env node
console.log(1);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/invalid/block_stmt_err.js.snap b/crates/biome_js_formatter/tests/specs/js/module/invalid/block_stmt_err.js.snap
index 85444f62a348..19b3a058442d 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/invalid/block_stmt_err.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/invalid/block_stmt_err.js.snap
@@ -41,6 +41,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -54,4 +55,5 @@ Operator linebreak: After
}
let recovered = "no";
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/invalid/if_stmt_err.js.snap b/crates/biome_js_formatter/tests/specs/js/module/invalid/if_stmt_err.js.snap
index 91d361fbef84..43b1971b87b2 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/invalid/if_stmt_err.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/invalid/if_stmt_err.js.snap
@@ -47,6 +47,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -62,4 +63,5 @@ if (true) {
if (false) {
let x = 99;
} else {
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/line-ending/auto/line_ending.js.snap b/crates/biome_js_formatter/tests/specs/js/module/line-ending/auto/line_ending.js.snap
index c3bc6f695f9a..b37affe9bfea 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/line-ending/auto/line_ending.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/line-ending/auto/line_ending.js.snap
@@ -1,6 +1,5 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
-assertion_line: 211
info: js/module/line-ending/auto/line_ending.js
---
# Input
@@ -49,6 +48,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -69,6 +69,7 @@ export const env = createEnv({
NODE_ENV: { type: "string" },
});
+
```
## Output 1
@@ -89,6 +90,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -109,4 +111,5 @@ export const env = createEnv({
NODE_ENV: { type: "string" },
});
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/line-ending/cr/line_ending.js.snap b/crates/biome_js_formatter/tests/specs/js/module/line-ending/cr/line_ending.js.snap
index f0d48bbb1c2c..0a752da2b0f8 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/line-ending/cr/line_ending.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/line-ending/cr/line_ending.js.snap
@@ -48,6 +48,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -68,6 +69,7 @@ export const env = createEnv({
NODE_ENV: { type: "string" },
});
+
```
## Output 1
@@ -88,6 +90,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -108,4 +111,5 @@ export const env = createEnv({
NODE_ENV: { type: "string" },
});
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/line-ending/crlf/line_ending.js.snap b/crates/biome_js_formatter/tests/specs/js/module/line-ending/crlf/line_ending.js.snap
index 766079c573f8..30264e781d27 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/line-ending/crlf/line_ending.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/line-ending/crlf/line_ending.js.snap
@@ -48,6 +48,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -68,6 +69,7 @@ export const env = createEnv({
NODE_ENV: { type: "string" },
});
+
```
## Output 1
@@ -88,6 +90,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -108,4 +111,5 @@ export const env = createEnv({
NODE_ENV: { type: "string" },
});
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/newlines.js.snap b/crates/biome_js_formatter/tests/specs/js/module/newlines.js.snap
index ca462ab02b41..27cdc165ad2b 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/newlines.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/newlines.js.snap
@@ -109,6 +109,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -171,4 +172,5 @@ const object = {
key4: 4,
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/no-semi/class.js.snap b/crates/biome_js_formatter/tests/specs/js/module/no-semi/class.js.snap
index eeca832e4412..78f60839ac9c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/no-semi/class.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/no-semi/class.js.snap
@@ -149,6 +149,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -268,6 +269,7 @@ class G3 {
class G4 {
[x] = 1;
}
+
```
## Output 1
@@ -288,6 +290,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -407,4 +410,5 @@ class G3 {
class G4 {
[x] = 1
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue2006.js.snap b/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue2006.js.snap
index cba8dafc8bcf..10ea0e1dc95d 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue2006.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue2006.js.snap
@@ -39,6 +39,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -50,6 +51,7 @@ switch (n) {
var c = a.e;
(i.a += Ga(c.e)), F(i, c.i, 0);
+
```
## Output 1
@@ -70,6 +72,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -81,4 +84,5 @@ switch (n) {
var c = a.e
;(i.a += Ga(c.e)), F(i, c.i, 0)
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue6029.js.snap b/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue6029.js.snap
index 6050caff7da3..3411ea71003c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue6029.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue6029.js.snap
@@ -34,12 +34,14 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
const foo = 3;
[1, 2, 3].map((x) => x * 2);
+
```
## Output 1
@@ -60,10 +62,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
const foo = 3
;[1, 2, 3].map((x) => x * 2)
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue6375.js.snap b/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue6375.js.snap
index f60d587b6a35..1e9d34e875e6 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue6375.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/no-semi/issue6375.js.snap
@@ -38,6 +38,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -48,6 +49,7 @@ const newRequest = {};
* SAFETY: monkey patching and getting around the provided type definitions.
*/
(Transport.prototype as any).request = newRequest;
+
```
## Output 1
@@ -68,6 +70,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -78,4 +81,5 @@ const newRequest = {}
* SAFETY: monkey patching and getting around the provided type definitions.
*/
;(Transport.prototype as any).request = newRequest
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/no-semi/no-semi.js.snap b/crates/biome_js_formatter/tests/specs/js/module/no-semi/no-semi.js.snap
index 03b0658dcde9..4f38de96cf49 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/no-semi/no-semi.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/no-semi/no-semi.js.snap
@@ -111,6 +111,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -205,6 +206,7 @@ while (false) (function () {})();
aReallyLongLine012345678901234567890123456789012345678901234567890123456789 *
(b + c);
+
```
## Output 1
@@ -225,6 +227,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -319,4 +322,5 @@ while (false) (function () {})()
aReallyLongLine012345678901234567890123456789012345678901234567890123456789 *
(b + c)
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/no-semi/private-field.js.snap b/crates/biome_js_formatter/tests/specs/js/module/no-semi/private-field.js.snap
index 3e1864461a8f..d7eb9222bbbc 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/no-semi/private-field.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/no-semi/private-field.js.snap
@@ -35,6 +35,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,6 +43,7 @@ class C {
#field = "value";
["method"]() {}
}
+
```
## Output 1
@@ -62,6 +64,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -69,4 +72,5 @@ class C {
#field = "value";
["method"]() {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/no-semi/semicolons-asi.js.snap b/crates/biome_js_formatter/tests/specs/js/module/no-semi/semicolons-asi.js.snap
index 11f9573309cb..e56d91db5f79 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/no-semi/semicolons-asi.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/no-semi/semicolons-asi.js.snap
@@ -32,10 +32,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
[1, 2];
+
```
## Output 1
@@ -56,8 +58,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
;[1, 2]
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/no-semi/semicolons_range.js.snap b/crates/biome_js_formatter/tests/specs/js/module/no-semi/semicolons_range.js.snap
index 0149d00e6529..d9f224ce4c66 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/no-semi/semicolons_range.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/no-semi/semicolons_range.js.snap
@@ -34,12 +34,14 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
statement_1()
statement_2();
statement_3()
+
```
## Output 1
@@ -60,10 +62,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
statement_1()
statement_2()
statement_3()
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/number/number.js.snap b/crates/biome_js_formatter/tests/specs/js/module/number/number.js.snap
index 900d73e3de22..c7e32326bc66 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/number/number.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/number/number.js.snap
@@ -33,9 +33,11 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
1.23e4;
1000e3; // FIXME handle number with scientific notation #1294
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/number/number_with_space.js.snap b/crates/biome_js_formatter/tests/specs/js/module/number/number_with_space.js.snap
index e0be4cac19b1..f1cdd24caa4c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/number/number_with_space.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/number/number_with_space.js.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -44,4 +45,5 @@ Operator linebreak: After
/****/ (123).toString;
(123) /**/.toString;
(123).toString;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/bracket-spacing/object_bracket_spacing.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/bracket-spacing/object_bracket_spacing.js.snap
index 7fe3d545cf38..e74faaeea08c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/bracket-spacing/object_bracket_spacing.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/bracket-spacing/object_bracket_spacing.js.snap
@@ -53,6 +53,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -74,6 +75,7 @@ const y = {
({ a, b, c } = { a: "apple", b: "banana", c: "coconut" });
({ a, b, c } = { a: "apple", b: "banana", c: "coconut" });
+
```
## Output 1
@@ -94,6 +96,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -115,4 +118,5 @@ const y = {
({a, b, c} = {a: "apple", b: "banana", c: "coconut"});
({a, b, c} = {a: "apple", b: "banana", c: "coconut"});
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/computed_member.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/computed_member.js.snap
index e2198e37013d..44d417627a82 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/computed_member.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/computed_member.js.snap
@@ -50,6 +50,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -79,4 +80,5 @@ x.very.long.chain.of.static.members.that.goes.on.for.ever.I.mean.it.for.ever[
x[b["test"]];
a["test"];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/expand/expand-never.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/expand/expand-never.js.snap
index fc63ff9d0f39..13f9c8cb8c6d 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/expand/expand-never.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/expand/expand-never.js.snap
@@ -48,6 +48,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -69,6 +70,7 @@ const d = {
};
const e = { name1: "value1", name2: "value2" };
+
```
## Output 1
@@ -89,6 +91,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Never
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -101,4 +104,5 @@ const c = { name1: "value1", name2: "value2" };
const d = { name1: "value1", name2: "value2" };
const e = { name1: "value1", name2: "value2" };
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap
index 1a9172deadf2..2c909d34d5f2 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap
@@ -38,6 +38,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -48,4 +49,5 @@ let b = {
set foo(a) {}
set bar(a, ) {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/numeric-property.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/numeric-property.js.snap
index bf12a5285e3e..4b50d8afa906 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/numeric-property.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/numeric-property.js.snap
@@ -68,6 +68,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -109,4 +110,5 @@ const x = {
"1n": null,
"0xan": null,
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/object.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/object.js.snap
index 2f09958fe8fb..2c6584061aef 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/object.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/object.js.snap
@@ -66,6 +66,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -101,4 +102,5 @@ const y = {
// https://github.com/biomejs/biome/issues/5682
const { foo, bar = [], baz: { disabled } = { disabled: false } } = props;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/object_comments.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/object_comments.js.snap
index a8c95accc93a..7cc38b715738 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/object_comments.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/object_comments.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,4 +43,5 @@ let a = {
type: "bar",
// trailing comment
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/octal_literals_key.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/octal_literals_key.js.snap
index 7fc99bdd9e51..3c0af647ca12 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/octal_literals_key.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/octal_literals_key.js.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -46,4 +47,5 @@ const x = {
0: "zero",
"010": "oh no",
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/property_key.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/property_key.js.snap
index ea52568a6f5f..7fdc4014644d 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/property_key.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/property_key.js.snap
@@ -42,6 +42,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -56,4 +57,5 @@ const foo = {
"実用文・会話文": "長文読解",
"実用文・会話文": "長文読解",
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/property_object_member.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/property_object_member.js.snap
index dcd8a451c2d9..82a74b882206 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/property_object_member.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/property_object_member.js.snap
@@ -119,6 +119,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -277,6 +278,7 @@ const fluidObject = {
skipNext: true,
},
};
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/trailing-commas/es5/object_trailing_commas.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/trailing-commas/es5/object_trailing_commas.js.snap
index 6a126b28d8a7..c1041db46911 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/trailing-commas/es5/object_trailing_commas.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/trailing-commas/es5/object_trailing_commas.js.snap
@@ -40,6 +40,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -54,6 +55,7 @@ const {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
} = o;
+
```
## Output 1
@@ -74,6 +76,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -88,4 +91,5 @@ const {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
} = o;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/object/trailing-commas/none/object_trailing_commas.js.snap b/crates/biome_js_formatter/tests/specs/js/module/object/trailing-commas/none/object_trailing_commas.js.snap
index 886cc7274921..ef05281db7c9 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/object/trailing-commas/none/object_trailing_commas.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/object/trailing-commas/none/object_trailing_commas.js.snap
@@ -40,6 +40,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -54,6 +55,7 @@ const {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
} = o;
+
```
## Output 1
@@ -74,6 +76,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -88,4 +91,5 @@ const {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd
} = o;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/operator-linebreak/before/operator_linebreak.js.snap b/crates/biome_js_formatter/tests/specs/js/module/operator-linebreak/before/operator_linebreak.js.snap
index 5625bf8c7703..9ba035ea3bd4 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/operator-linebreak/before/operator_linebreak.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/operator-linebreak/before/operator_linebreak.js.snap
@@ -1,6 +1,5 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
-assertion_line: 211
info: js/module/operator-linebreak/before/operator_linebreak.js
---
# Input
@@ -37,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -50,6 +50,7 @@ if (
) {
console.log("DONE");
}
+
```
## Output 1
@@ -70,6 +71,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: Before
+Trailing newline: true
-----
```js
@@ -83,4 +85,5 @@ if (
) {
console.log("DONE");
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/parentheses/parentheses.js.snap b/crates/biome_js_formatter/tests/specs/js/module/parentheses/parentheses.js.snap
index 8d9d9fa2ea89..eb6960d015bd 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/parentheses/parentheses.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/parentheses/parentheses.js.snap
@@ -54,6 +54,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -81,6 +82,7 @@ async function* f() {
const a = () => ({})?.() && a;
(list || list2)?.[list || list2];
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/parentheses/range_parentheses_binary.js.snap b/crates/biome_js_formatter/tests/specs/js/module/parentheses/range_parentheses_binary.js.snap
index 235bfb418a22..631350fa7046 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/parentheses/range_parentheses_binary.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/parentheses/range_parentheses_binary.js.snap
@@ -32,10 +32,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
import React from 'react'; function test() { const AppShelled = () => 1 + 2 } function one() {return 1}
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol.js.snap b/crates/biome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol.js.snap
index 6bd172e7b73d..b6634706f61d 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol.js.snap
@@ -41,6 +41,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -55,4 +56,5 @@ const a = () => {
console.log("🚀".length);
("Jan 1, 2018 – Jan 1, 2019");
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol_1.js.snap b/crates/biome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol_1.js.snap
index d91463cb2c13..32f3d9171347 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol_1.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol_1.js.snap
@@ -39,6 +39,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -52,4 +53,5 @@ const a = () => {
};
console.log("🚀".length);
("Jan 1, 2018 – Jan 1, 2019");
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/script.js.snap b/crates/biome_js_formatter/tests/specs/js/module/script.js.snap
index 5560644c15be..5ae8b226d40c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/script.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/script.js.snap
@@ -35,6 +35,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,4 +43,5 @@ Operator linebreak: After
"use strict";
"use asm";
var express = require("express");
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/block_statement.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/block_statement.js.snap
index 13aef4244b4f..2e177e4c5637 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/block_statement.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/block_statement.js.snap
@@ -40,6 +40,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -50,4 +51,5 @@ if (true) {
// biome-ignore format: Tests that ignored empty statements don't get removed
;
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/continue_stmt.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/continue_stmt.js.snap
index 838c702aec51..69228b174311 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/continue_stmt.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/continue_stmt.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,4 +43,5 @@ for (const f of fs) {
continue; //comment
else continue; // comment
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/do_while.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/do_while.js.snap
index 57d205a8d7bc..fba44173605b 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/do_while.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/do_while.js.snap
@@ -45,6 +45,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -59,4 +60,5 @@ do {
do;
while (true);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/empty_blocks.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/empty_blocks.js.snap
index e92ff02b8b45..dce43d5c1d81 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/empty_blocks.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/empty_blocks.js.snap
@@ -60,6 +60,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -99,4 +100,5 @@ function test() {}
for (;;) {}
while (true) {}
do {} while (true);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/for_in.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/for_in.js.snap
index 0beb4b1e4ae5..3a314dc2b9d4 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/for_in.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/for_in.js.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -49,6 +50,7 @@ for (aVeryLongVariableNameToEnforceLineBreaksaVeryLongVariableNameToEnforceLineB
for (a in b) {
// trailing
}
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/for_loop.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/for_loop.js.snap
index 95107ed7980f..229f018dba5a 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/for_loop.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/for_loop.js.snap
@@ -48,6 +48,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -71,4 +72,5 @@ for (
aVeryLongVariableNameToEnforceLineBreaks;
aVeryLongVariableNameToEnforceLineBreaks
) {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/for_of.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/for_of.js.snap
index 4adc67841a33..ebb718801c64 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/for_of.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/for_of.js.snap
@@ -39,6 +39,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -53,6 +54,7 @@ for (const aVeryLongVariableNameToEnforceLineBreaksaVeryLongVariableNameToEnforc
for await (const a of b) {
}
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/if_chain.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/if_chain.js.snap
index 330d3f98d17c..7d09146ff83d 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/if_chain.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/if_chain.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -44,4 +45,5 @@ else 3;
if (very_long_condition_1) very_long_statement_1();
else if (very_long_condition_2) very_long_statement_2();
else very_long_statement_3();
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/if_else.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/if_else.js.snap
index d9cf01efece3..d2984c8c9430 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/if_else.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/if_else.js.snap
@@ -100,6 +100,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -166,4 +167,5 @@ if (true) {
true && false
) {
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/return.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/return.js.snap
index ede37c185872..8d9f809d1c6d 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/return.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/return.js.snap
@@ -56,6 +56,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -85,4 +86,5 @@ function f5() {
*/ "1"
);
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/return_verbatim_argument.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/return_verbatim_argument.js.snap
index d60a3cf7b5e8..08fd97730ba4 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/return_verbatim_argument.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/return_verbatim_argument.js.snap
@@ -56,6 +56,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -84,6 +85,7 @@ function supported3() {
thatBreaksOverMultipleLines
);
}
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/statement.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/statement.js.snap
index 9d51c75fb1cc..149fd1f8c59f 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/statement.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/statement.js.snap
@@ -33,8 +33,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
debugger;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/switch.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/switch.js.snap
index 77a3129febab..b8154fe2f9f8 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/switch.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/switch.js.snap
@@ -82,6 +82,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -137,4 +138,5 @@ switch (key) {
}
break;
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/switch_comment.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/switch_comment.js.snap
index 6aa5ae284d40..df6e69a785e9 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/switch_comment.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/switch_comment.js.snap
@@ -49,6 +49,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -72,4 +73,5 @@ switch (x) {
a(); // ab
break;
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/throw.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/throw.js.snap
index f8a9f212725c..a8614d2fb811 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/throw.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/throw.js.snap
@@ -34,10 +34,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
throw "Something";
throw false;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/try_catch_finally.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/try_catch_finally.js.snap
index efb2dd35c3cd..63179649ee4e 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/try_catch_finally.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/try_catch_finally.js.snap
@@ -57,6 +57,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -85,4 +86,5 @@ try {
} finally {
var foo = 4;
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/statement/while_loop.js.snap b/crates/biome_js_formatter/tests/specs/js/module/statement/while_loop.js.snap
index 94650c118f8c..ec04d6c2f10c 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/statement/while_loop.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/statement/while_loop.js.snap
@@ -57,6 +57,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -84,4 +85,5 @@ while (true) {
tour: while (true) {
break tour;
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/directives.js.snap b/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/directives.js.snap
index e4b6d9ad2e84..ee8ab879b95b 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/directives.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/directives.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -41,6 +42,7 @@ Operator linebreak: After
"use preferred quote";
"keep quotes and escapes \" ";
'keep quotes and escapes \' ';
+
```
## Output 1
@@ -61,6 +63,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -68,4 +71,5 @@ Operator linebreak: After
"use preferred quote";
"keep quotes and escapes \" ";
'keep quotes and escapes \' ';
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/parentheses_token.js.snap b/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/parentheses_token.js.snap
index 3f9702c82a29..59a4113158cb 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/parentheses_token.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/parentheses_token.js.snap
@@ -32,10 +32,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
("Jan 1, 2018 – Jan 1, 2019")
+
```
## Output 1
@@ -56,8 +58,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
("Jan 1, 2018 – Jan 1, 2019")
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/properties_quotes.js.snap b/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/properties_quotes.js.snap
index aa929330a7d8..d038efc7c3bd 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/properties_quotes.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/properties_quotes.js.snap
@@ -74,6 +74,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -121,6 +122,7 @@ const x = {
"¾¾¾¾": "test1",
"①": "test2",
};
+
```
## Output 1
@@ -141,6 +143,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -188,4 +191,5 @@ const x = {
"¾¾¾¾": "test1",
"①": "test2",
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/string.js.snap b/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/string.js.snap
index fbccc38cd4be..5eb6a229b2cd 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/string.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/string/quotePreserve/string.js.snap
@@ -89,6 +89,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -151,6 +152,7 @@ export * as something_bad_will_happen from "something_bad_might_not_happen" with
// you should remove the escape
("content \'\' ");
+
```
# Lines exceeding max width of 80 characters
@@ -176,6 +178,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -238,6 +241,7 @@ export * as something_bad_will_happen from "something_bad_might_not_happen" with
// you should remove the escape
("content \'\' ");
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/directives.js.snap b/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/directives.js.snap
index 15811bab3c98..a4759af1c907 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/directives.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/directives.js.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -41,6 +42,7 @@ Operator linebreak: After
"use preferred quote";
"keep quotes and escapes \" ";
'keep quotes and escapes \' ';
+
```
## Output 1
@@ -61,6 +63,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -68,4 +71,5 @@ Operator linebreak: After
'use preferred quote';
"keep quotes and escapes \" ";
'keep quotes and escapes \' ';
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/parentheses_token.js.snap b/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/parentheses_token.js.snap
index 2ea06ed80573..5296f8d7d4e5 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/parentheses_token.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/parentheses_token.js.snap
@@ -32,10 +32,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
("Jan 1, 2018 – Jan 1, 2019")
+
```
## Output 1
@@ -56,8 +58,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
('Jan 1, 2018 – Jan 1, 2019')
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/properties_quotes.js.snap b/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/properties_quotes.js.snap
index ef7e68403fa2..af9e233af101 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/properties_quotes.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/properties_quotes.js.snap
@@ -74,6 +74,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -121,6 +122,7 @@ const x = {
"¾¾¾¾": "test1",
"①": "test2",
};
+
```
## Output 1
@@ -141,6 +143,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -188,4 +191,5 @@ const x = {
'¾¾¾¾': 'test1',
'①': 'test2',
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/string.js.snap b/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/string.js.snap
index bb8f4deeaada..607536c522bd 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/string.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/string/quoteSingle/string.js.snap
@@ -89,6 +89,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -151,6 +152,7 @@ export * as something_bad_will_happen from "something_bad_might_not_happen" with
// you should remove the escape
("content \'\' ");
+
```
# Lines exceeding max width of 80 characters
@@ -176,6 +178,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -238,6 +241,7 @@ export * as something_bad_will_happen from 'something_bad_might_not_happen' with
// you should remove the escape
("content \'\' ");
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/suppression.js.snap b/crates/biome_js_formatter/tests/specs/js/module/suppression.js.snap
index b8fa71b47118..ef12a380465a 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/suppression.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/suppression.js.snap
@@ -60,6 +60,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -92,4 +93,5 @@ const expr2 = {
let a =
// biome-ignore format: test
function () {};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/template/template.js.snap b/crates/biome_js_formatter/tests/specs/js/module/template/template.js.snap
index ac7a563dab5e..adfd8146f210 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/template/template.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/template/template.js.snap
@@ -102,6 +102,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -189,6 +190,7 @@ const issus_3766 = `Lectures: ${doneCount}/${totalCount} | Mins: ${(
).toFixed(2)}/${(totalSecs / 60).toFixed(2)}| Hours: ${(
doneSecs / 3600
).toFixed(2)}/${(totalSecs / 3600).toFixed(2)}`;
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/js/module/trailing_newline/disabled/options.json b/crates/biome_js_formatter/tests/specs/js/module/trailing_newline/disabled/options.json
new file mode 100644
index 000000000000..2fa438de9df8
--- /dev/null
+++ b/crates/biome_js_formatter/tests/specs/js/module/trailing_newline/disabled/options.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "../../../../../../../../packages/@biomejs/biome/configuration_schema.json",
+ "javascript": {
+ "formatter": {
+ "trailingNewline": false
+ }
+ }
+}
diff --git a/crates/biome_js_formatter/tests/specs/js/module/trailing_newline/disabled/simple.js b/crates/biome_js_formatter/tests/specs/js/module/trailing_newline/disabled/simple.js
new file mode 100644
index 000000000000..9e55dd91d22e
--- /dev/null
+++ b/crates/biome_js_formatter/tests/specs/js/module/trailing_newline/disabled/simple.js
@@ -0,0 +1,2 @@
+const a = 1;
+const b = 2;
diff --git a/crates/biome_js_formatter/tests/specs/js/module/trailing_newline/disabled/simple.js.snap b/crates/biome_js_formatter/tests/specs/js/module/trailing_newline/disabled/simple.js.snap
new file mode 100644
index 000000000000..f15dba4aa3e0
--- /dev/null
+++ b/crates/biome_js_formatter/tests/specs/js/module/trailing_newline/disabled/simple.js.snap
@@ -0,0 +1,69 @@
+---
+source: crates/biome_formatter_test/src/snapshot_builder.rs
+info: js/module/trailing_newline/disabled/simple.js
+---
+# Input
+
+```js
+const a = 1;
+const b = 2;
+
+```
+
+
+=============================
+
+# 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
+Expand lists: Auto
+Operator linebreak: After
+Trailing newline: true
+-----
+
+```js
+const a = 1;
+const b = 2;
+
+```
+
+## 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
+Expand lists: Auto
+Operator linebreak: After
+Trailing newline: false
+-----
+
+```js
+const a = 1;
+const b = 2;
+```
diff --git a/crates/biome_js_formatter/tests/specs/js/module/with.js.snap b/crates/biome_js_formatter/tests/specs/js/module/with.js.snap
index e208f2397059..a305fa596287 100644
--- a/crates/biome_js_formatter/tests/specs/js/module/with.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/module/with.js.snap
@@ -36,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -44,4 +45,5 @@ with ( b)
{
5
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/script/script.js.snap b/crates/biome_js_formatter/tests/specs/js/script/script.js.snap
index 1c387f9a645e..3ce9a9b47833 100644
--- a/crates/biome_js_formatter/tests/specs/js/script/script.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/script/script.js.snap
@@ -35,6 +35,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,4 +43,5 @@ Operator linebreak: After
"use strict";
"use asm";
var express = require("express");
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/script/script_with_bom.js.snap b/crates/biome_js_formatter/tests/specs/js/script/script_with_bom.js.snap
index f12289ba6010..9d6c22679e57 100644
--- a/crates/biome_js_formatter/tests/specs/js/script/script_with_bom.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/script/script_with_bom.js.snap
@@ -35,6 +35,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -42,4 +43,5 @@ Operator linebreak: After
"use strict";
"use asm";
var express = require("express");
+
```
diff --git a/crates/biome_js_formatter/tests/specs/js/script/with.js.snap b/crates/biome_js_formatter/tests/specs/js/script/with.js.snap
index 5ea5b3b7ef98..3b9fd6059561 100644
--- a/crates/biome_js_formatter/tests/specs/js/script/with.js.snap
+++ b/crates/biome_js_formatter/tests/specs/js/script/with.js.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```js
@@ -46,4 +47,5 @@ with (b) {
with ({}) {
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/arrow_function.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/arrow_function.jsx.snap
index 216148c647bb..473c85207768 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/arrow_function.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/arrow_function.jsx.snap
@@ -71,6 +71,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -114,4 +115,5 @@ function ArrowCurryWithDestructuringParameters() {
return ({ C }) =>
(props) => ;
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/attribute_escape.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/attribute_escape.jsx.snap
index 34df5cf20b7f..a4367a8d45f2 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/attribute_escape.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/attribute_escape.jsx.snap
@@ -46,6 +46,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -64,4 +65,5 @@ const a = () => {
>
);
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/attribute_position/attribute_position.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/attribute_position/attribute_position.jsx.snap
index e3870c8a450a..864fb7e4c8e8 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/attribute_position/attribute_position.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/attribute_position/attribute_position.jsx.snap
@@ -58,6 +58,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -99,6 +100,7 @@ const Component = () => (
/>
);
+
```
## Output 1
@@ -119,6 +121,7 @@ Bracket same line: false
Attribute Position: Multiline
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -167,4 +170,5 @@ const Component = () => (
/>
);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/attributes.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/attributes.jsx.snap
index b1c5da53fc33..f5b6ef334c64 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/attributes.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/attributes.jsx.snap
@@ -107,6 +107,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -198,6 +199,7 @@ const a = (
)
}
/>;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/bracket_same_line/bracket_same_line.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/bracket_same_line/bracket_same_line.jsx.snap
index 8ecf1200c8c5..3e3ff36b6e93 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/bracket_same_line/bracket_same_line.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/bracket_same_line/bracket_same_line.jsx.snap
@@ -74,6 +74,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -120,6 +121,7 @@ const a = ;
;
;
+
```
## Output 1
@@ -140,6 +142,7 @@ Bracket same line: true
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -184,4 +187,5 @@ const a = ;
;
;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/comments.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/comments.jsx.snap
index fe1bfa0b2728..dd4b6f868ce0 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/comments.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/comments.jsx.snap
@@ -39,6 +39,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -53,4 +54,5 @@ a>;
;
{/* comment */ ...a}
;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/conditional.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/conditional.jsx.snap
index 924d946a8bf3..d687f7e3112c 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/conditional.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/conditional.jsx.snap
@@ -80,6 +80,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -136,4 +137,5 @@ Operator linebreak: After
)
) : null;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/element.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/element.jsx.snap
index 2d55bdc235fe..00fef2aefba4 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/element.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/element.jsx.snap
@@ -361,6 +361,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -759,6 +760,7 @@ function Component() {
);
}
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/jsx/fragment.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/fragment.jsx.snap
index 0c360e99ade1..51e5b3147cc9 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/fragment.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/fragment.jsx.snap
@@ -33,10 +33,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
<>>
<>
>
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/multiline_jsx_string/multiline_jsx_string.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/multiline_jsx_string/multiline_jsx_string.jsx.snap
index 24e898a7dbd0..f111785bd96b 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/multiline_jsx_string/multiline_jsx_string.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/multiline_jsx_string/multiline_jsx_string.jsx.snap
@@ -33,6 +33,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -40,6 +41,7 @@ Operator linebreak: After
className="px-1 px-2
px-3"
/>;
+
```
## Output 1
@@ -60,6 +62,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -67,4 +70,5 @@ Operator linebreak: After
className="px-1 px-2
px-3"
/>;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/new-lines.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/new-lines.jsx.snap
index 1ec2d3a87473..9c9da0a6ef86 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/new-lines.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/new-lines.jsx.snap
@@ -81,6 +81,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -129,4 +130,5 @@ let myDiv3 = ReactTestUtils.renderIntoDocument(
,
);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/parentheses_range.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/parentheses_range.jsx.snap
index 6690172c5cf1..81bb0fac0a29 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/parentheses_range.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/parentheses_range.jsx.snap
@@ -32,10 +32,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
import React from 'react'; function test() { const AppShelled = () => } function lol() {return 1}
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_double_string_double/quote_style.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_double_string_double/quote_style.jsx.snap
index 2ef16c316f24..1a035a763d00 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_double_string_double/quote_style.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_double_string_double/quote_style.jsx.snap
@@ -39,12 +39,14 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
"123"
;
+
```
## Output 1
@@ -65,10 +67,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
"123"
;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_double_string_single/quote_style.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_double_string_single/quote_style.jsx.snap
index 58a38ede4557..aab461116fd9 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_double_string_single/quote_style.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_double_string_single/quote_style.jsx.snap
@@ -39,12 +39,14 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
"123"
;
+
```
## Output 1
@@ -65,10 +67,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
"123"
;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_single_string_double/quote_style.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_single_string_double/quote_style.jsx.snap
index 789838a7b8b8..71841e0fe119 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_single_string_double/quote_style.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_single_string_double/quote_style.jsx.snap
@@ -39,12 +39,14 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
"123"
;
+
```
## Output 1
@@ -65,10 +67,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
"123"
;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_single_string_single/quote_style.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_single_string_single/quote_style.jsx.snap
index 4d5fe34c4d9f..ffc543030e85 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_single_string_single/quote_style.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/quote_style/jsx_single_string_single/quote_style.jsx.snap
@@ -39,12 +39,14 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
"123"
;
+
```
## Output 1
@@ -65,10 +67,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
"123"
;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/self_closing.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/self_closing.jsx.snap
index cf4fa66c1680..8b8ba73d3c07 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/self_closing.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/self_closing.jsx.snap
@@ -52,6 +52,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -70,4 +71,5 @@ Operator linebreak: After
-
>;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/smoke.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/smoke.jsx.snap
index 6526f2e61b09..a6e1130a23ef 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/smoke.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/smoke.jsx.snap
@@ -31,8 +31,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
"foo";
+
```
diff --git a/crates/biome_js_formatter/tests/specs/jsx/text_children.jsx.snap b/crates/biome_js_formatter/tests/specs/jsx/text_children.jsx.snap
index d4ad56d3e04b..05e05faa20c1 100644
--- a/crates/biome_js_formatter/tests/specs/jsx/text_children.jsx.snap
+++ b/crates/biome_js_formatter/tests/specs/jsx/text_children.jsx.snap
@@ -132,6 +132,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```jsx
@@ -241,4 +242,5 @@ Operator linebreak: After
second
third
>;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/array/expand/expand-always.ts.snap b/crates/biome_js_formatter/tests/specs/ts/array/expand/expand-always.ts.snap
index 57ef227b6739..523e04466d51 100644
--- a/crates/biome_js_formatter/tests/specs/ts/array/expand/expand-always.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/array/expand/expand-always.ts.snap
@@ -66,6 +66,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -88,6 +89,7 @@ const d: D = ["value1", "value2"];
type E = ["value1", "value2"];
const e: E = ["value1", "value2"];
+
```
## Output 1
@@ -108,6 +110,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Always
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -160,4 +163,5 @@ const e: E = [
"value1",
"value2",
];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/arrow/arrow_parentheses.ts.snap b/crates/biome_js_formatter/tests/specs/ts/arrow/arrow_parentheses.ts.snap
index bb0f11683a4e..1b4c60bc9e55 100644
--- a/crates/biome_js_formatter/tests/specs/ts/arrow/arrow_parentheses.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/arrow/arrow_parentheses.ts.snap
@@ -44,6 +44,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -60,6 +61,7 @@ Operator linebreak: After
([action]) => {};
(...action) => {};
(action = 1) => {};
+
```
## Output 1
@@ -80,6 +82,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -96,4 +99,5 @@ action => {};
([action]) => {};
(...action) => {};
(action = 1) => {};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/arrow/long_arrow_parentheses_with_line_break.ts.snap b/crates/biome_js_formatter/tests/specs/ts/arrow/long_arrow_parentheses_with_line_break.ts.snap
index 152a5e87bcd3..aad72ef21dee 100644
--- a/crates/biome_js_formatter/tests/specs/ts/arrow/long_arrow_parentheses_with_line_break.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/arrow/long_arrow_parentheses_with_line_break.ts.snap
@@ -46,6 +46,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -64,6 +65,7 @@ function outerFunctionToForceIndent() {
return `${id}test`;
};
}
+
```
## Output 1
@@ -84,6 +86,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -100,4 +103,5 @@ function outerFunctionToForceIndent() {
return `${id}test`;
};
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/arrow/parameter_default_binding_line_break.ts.snap b/crates/biome_js_formatter/tests/specs/ts/arrow/parameter_default_binding_line_break.ts.snap
index a7e7e339d13e..4272e5233bc5 100644
--- a/crates/biome_js_formatter/tests/specs/ts/arrow/parameter_default_binding_line_break.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/arrow/parameter_default_binding_line_break.ts.snap
@@ -51,6 +51,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -68,6 +69,7 @@ class T {
getName: (timestamp: number) => number = (timestamp) => timestamp * 1000,
) {}
}
+
```
## Output 1
@@ -88,6 +90,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -105,4 +108,5 @@ class T {
getName: (timestamp: number) => number = timestamp => timestamp * 1000,
) {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/arrow_chain.ts.snap b/crates/biome_js_formatter/tests/specs/ts/arrow_chain.ts.snap
index 39f14d93e6b2..3453c8ae8b1b 100644
--- a/crates/biome_js_formatter/tests/specs/ts/arrow_chain.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/arrow_chain.ts.snap
@@ -42,6 +42,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -72,4 +73,5 @@ const x =
const x = (a) => (b) => (
aLongSequenceExpression, thatContinuesFurtherOnUntilItBreaks, expands
);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/assignment/as_assignment.ts.snap b/crates/biome_js_formatter/tests/specs/ts/assignment/as_assignment.ts.snap
index 4f99ac497446..8a29e21a7c45 100644
--- a/crates/biome_js_formatter/tests/specs/ts/assignment/as_assignment.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/assignment/as_assignment.ts.snap
@@ -36,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -45,4 +46,5 @@ let binding;
(binding.very.long.chain.of.static.members as VeryLongTypeName) =
veryLongExpression();
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/assignment/assignment.ts.snap b/crates/biome_js_formatter/tests/specs/ts/assignment/assignment.ts.snap
index 14575f9e919b..e3d1d4098ef7 100644
--- a/crates/biome_js_formatter/tests/specs/ts/assignment/assignment.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/assignment/assignment.ts.snap
@@ -44,6 +44,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -61,4 +62,5 @@ loooooooooooooooooooooooooong7 =
const gitBaseExtension =
extensions.getExtension("vscode.git-base")!.exports;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/assignment/assignment_comments.ts.snap b/crates/biome_js_formatter/tests/specs/ts/assignment/assignment_comments.ts.snap
index 44d5fbca2bf6..2046cade9d1b 100644
--- a/crates/biome_js_formatter/tests/specs/ts/assignment/assignment_comments.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/assignment/assignment_comments.ts.snap
@@ -52,6 +52,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -71,4 +72,5 @@ const e: string =
// 1
// 2
{ object: 5 };
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/assignment/property_assignment_comments.ts.snap b/crates/biome_js_formatter/tests/specs/ts/assignment/property_assignment_comments.ts.snap
index 313450854e21..f93ab24a3359 100644
--- a/crates/biome_js_formatter/tests/specs/ts/assignment/property_assignment_comments.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/assignment/property_assignment_comments.ts.snap
@@ -64,6 +64,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -93,4 +94,5 @@ class Test {
prop10: any = // 1 // 2
{ object: 3 };
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/assignment/type_assertion_assignment.ts.snap b/crates/biome_js_formatter/tests/specs/ts/assignment/type_assertion_assignment.ts.snap
index f09eeb438eca..df0551a1a8c3 100644
--- a/crates/biome_js_formatter/tests/specs/ts/assignment/type_assertion_assignment.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/assignment/type_assertion_assignment.ts.snap
@@ -45,6 +45,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -58,4 +59,5 @@ let x;
for (x of []) {
}
({ x: x } = { x: "test" });
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/binding/definite_variable.ts.snap b/crates/biome_js_formatter/tests/specs/ts/binding/definite_variable.ts.snap
index 7d2dd4c1ea18..a9b5ba0f5da1 100644
--- a/crates/biome_js_formatter/tests/specs/ts/binding/definite_variable.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/binding/definite_variable.ts.snap
@@ -32,8 +32,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
let definiteVariable!: TypeName;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/call_expression.ts.snap b/crates/biome_js_formatter/tests/specs/ts/call_expression.ts.snap
index 661a8c1a94ff..0a71ef4be757 100644
--- a/crates/biome_js_formatter/tests/specs/ts/call_expression.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/call_expression.ts.snap
@@ -64,6 +64,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -99,4 +100,5 @@ users.map((user: User): User => {
users.map((user: User): User => {
// comment
});
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/class/accessor.ts.snap b/crates/biome_js_formatter/tests/specs/ts/class/accessor.ts.snap
index fdb9c680fcf7..95ed3aa85234 100644
--- a/crates/biome_js_formatter/tests/specs/ts/class/accessor.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/class/accessor.ts.snap
@@ -33,10 +33,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
export abstract class C {
protected abstract accessor prop: number;
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/class/assignment_layout.ts.snap b/crates/biome_js_formatter/tests/specs/ts/class/assignment_layout.ts.snap
index 262f8d9e6c87..3c7f51668bc9 100644
--- a/crates/biome_js_formatter/tests/specs/ts/class/assignment_layout.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/class/assignment_layout.ts.snap
@@ -38,6 +38,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -48,4 +49,5 @@ class SourceRemoveUnused extends SourceAction {
public static readonly id =
"javascript-walkthrough.commands.nodeInstallationFound";
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/class/constructor_parameter.ts.snap b/crates/biome_js_formatter/tests/specs/ts/class/constructor_parameter.ts.snap
index 2830f3232a21..18d84dce60db 100644
--- a/crates/biome_js_formatter/tests/specs/ts/class/constructor_parameter.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/class/constructor_parameter.ts.snap
@@ -75,6 +75,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -115,4 +116,5 @@ class MyClass {
a: string,
) {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap b/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap
index 61bba4aa7f80..506862cd825e 100644
--- a/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap
@@ -33,6 +33,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -40,4 +41,5 @@ class ClassName implements Interface {}
class LongClassName
implements Interface1, Interface2, Interface3, Interface4, Interface5 {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/class/readonly_ambient_property.ts.snap b/crates/biome_js_formatter/tests/specs/ts/class/readonly_ambient_property.ts.snap
index 07c03b4b9fa3..175ec9e36e00 100644
--- a/crates/biome_js_formatter/tests/specs/ts/class/readonly_ambient_property.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/class/readonly_ambient_property.ts.snap
@@ -41,6 +41,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -50,4 +51,5 @@ declare class A {
export class B {
declare readonly prop = "value__value__value__value__value__value__value";
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/class/trailing_commas/es5/class_trailing_commas.ts.snap b/crates/biome_js_formatter/tests/specs/ts/class/trailing_commas/es5/class_trailing_commas.ts.snap
index 390819a50271..2a83312e07ca 100644
--- a/crates/biome_js_formatter/tests/specs/ts/class/trailing_commas/es5/class_trailing_commas.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/class/trailing_commas/es5/class_trailing_commas.ts.snap
@@ -42,6 +42,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -70,6 +71,7 @@ class C<
dsadsadasdasdasdasdasdasdasd,
) {}
}
+
```
## Output 1
@@ -90,6 +92,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -118,4 +121,5 @@ class C<
dsadsadasdasdasdasdasdasdasd
) {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/class/trailing_commas/none/class_trailing_commas.ts.snap b/crates/biome_js_formatter/tests/specs/ts/class/trailing_commas/none/class_trailing_commas.ts.snap
index f7a28b3add8d..83b5dec5335c 100644
--- a/crates/biome_js_formatter/tests/specs/ts/class/trailing_commas/none/class_trailing_commas.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/class/trailing_commas/none/class_trailing_commas.ts.snap
@@ -42,6 +42,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -70,6 +71,7 @@ class C<
dsadsadasdasdasdasdasdasdasd,
) {}
}
+
```
## Output 1
@@ -90,6 +92,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -118,4 +121,5 @@ class C<
dsadsadasdasdasdasdasdasdasd
) {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/declaration/class.ts.snap b/crates/biome_js_formatter/tests/specs/ts/declaration/class.ts.snap
index a4143e0174dc..1ac45c0adbc3 100644
--- a/crates/biome_js_formatter/tests/specs/ts/declaration/class.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/declaration/class.ts.snap
@@ -90,6 +90,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -154,4 +155,5 @@ abstract class Test1 {
protected abstract readonly g: string;
protected abstract readonly h: string;
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/declaration/declare_function.ts.snap b/crates/biome_js_formatter/tests/specs/ts/declaration/declare_function.ts.snap
index e4468bf61833..c6bf77fdf7c5 100644
--- a/crates/biome_js_formatter/tests/specs/ts/declaration/declare_function.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/declaration/declare_function.ts.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -44,4 +45,5 @@ declare function looooooooooooooooooooooooooooong_naaaaaame<
SecondType,
ThirdType,
>(loreum: string, ipsum: number, chilly: symbol, powder: number): string;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/declaration/global_declaration.ts.snap b/crates/biome_js_formatter/tests/specs/ts/declaration/global_declaration.ts.snap
index 15158be350f9..b037a35e7a4f 100644
--- a/crates/biome_js_formatter/tests/specs/ts/declaration/global_declaration.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/declaration/global_declaration.ts.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -45,4 +46,5 @@ declare module "./test" {
let VERSION: string;
}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/declaration/interface.ts.snap b/crates/biome_js_formatter/tests/specs/ts/declaration/interface.ts.snap
index f90f29b8a0b9..d8821880dd7e 100644
--- a/crates/biome_js_formatter/tests/specs/ts/declaration/interface.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/declaration/interface.ts.snap
@@ -78,6 +78,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -138,4 +139,5 @@ x.y(() => {
});
interface A<> {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/declaration/variable_declaration.ts.snap b/crates/biome_js_formatter/tests/specs/ts/declaration/variable_declaration.ts.snap
index 69b331101c2c..3a376fd0e3b6 100644
--- a/crates/biome_js_formatter/tests/specs/ts/declaration/variable_declaration.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/declaration/variable_declaration.ts.snap
@@ -118,6 +118,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -244,6 +245,7 @@ let looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
this().ewqeqewqweqweqweqweqweqweqw;
let loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong3 =
this()[dsadsadsadsadsadsadsa]<{}>().ewqoewqoeiowqieopwqie;
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/ts/declare.ts.snap b/crates/biome_js_formatter/tests/specs/ts/declare.ts.snap
index 730cfdb8afcf..ae8c3361f3ea 100644
--- a/crates/biome_js_formatter/tests/specs/ts/declare.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/declare.ts.snap
@@ -37,6 +37,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -44,4 +45,5 @@ declare module "remark-html";
declare module "other";
declare module "remark-html" {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/decoartors.ts.snap b/crates/biome_js_formatter/tests/specs/ts/decoartors.ts.snap
index 4011cb16cc85..c00d795fe0ca 100644
--- a/crates/biome_js_formatter/tests/specs/ts/decoartors.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/decoartors.ts.snap
@@ -289,6 +289,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -539,4 +540,5 @@ class Foo {
parameter,
) {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/decorators/class_members.ts.snap b/crates/biome_js_formatter/tests/specs/ts/decorators/class_members.ts.snap
index 33cd1ee1cec3..97a1b6391aa7 100644
--- a/crates/biome_js_formatter/tests/specs/ts/decorators/class_members.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/decorators/class_members.ts.snap
@@ -125,6 +125,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -233,4 +234,5 @@ class Foo {
/*middle*/ @dec /*after*/
public set setter(val) {}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/enum/trailing_commas_es5/enum_trailing_commas.ts.snap b/crates/biome_js_formatter/tests/specs/ts/enum/trailing_commas_es5/enum_trailing_commas.ts.snap
index 2f3bf187ba00..e2aa2f2e2de7 100644
--- a/crates/biome_js_formatter/tests/specs/ts/enum/trailing_commas_es5/enum_trailing_commas.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/enum/trailing_commas_es5/enum_trailing_commas.ts.snap
@@ -36,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -44,6 +45,7 @@ enum A {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
}
+
```
## Output 1
@@ -64,6 +66,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -72,4 +75,5 @@ enum A {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/enum/trailing_commas_none/enum_trailing_commas.ts.snap b/crates/biome_js_formatter/tests/specs/ts/enum/trailing_commas_none/enum_trailing_commas.ts.snap
index 081a0fa9ea62..6b95a8c885dd 100644
--- a/crates/biome_js_formatter/tests/specs/ts/enum/trailing_commas_none/enum_trailing_commas.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/enum/trailing_commas_none/enum_trailing_commas.ts.snap
@@ -36,6 +36,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -44,6 +45,7 @@ enum A {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
}
+
```
## Output 1
@@ -64,6 +66,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -72,4 +75,5 @@ enum A {
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/expression/as_expression.ts.snap b/crates/biome_js_formatter/tests/specs/ts/expression/as_expression.ts.snap
index f9f07ccf4b6d..2240fbd37bb3 100644
--- a/crates/biome_js_formatter/tests/specs/ts/expression/as_expression.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/expression/as_expression.ts.snap
@@ -34,9 +34,11 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
let a: any;
let b = a as string;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/expression/bracket-spacing/expression_bracket_spacing.ts.snap b/crates/biome_js_formatter/tests/specs/ts/expression/bracket-spacing/expression_bracket_spacing.ts.snap
index 258c0c1ad53f..2119ea142ac6 100644
--- a/crates/biome_js_formatter/tests/specs/ts/expression/bracket-spacing/expression_bracket_spacing.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/expression/bracket-spacing/expression_bracket_spacing.ts.snap
@@ -98,6 +98,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -197,6 +198,7 @@ type GenericTypeExpression =
baz: number;
zzz: boolean;
}>;
+
```
## Output 1
@@ -217,6 +219,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -316,4 +319,5 @@ type GenericTypeExpression =
baz: number;
zzz: boolean;
}>;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/expression/non_null_expression.ts.snap b/crates/biome_js_formatter/tests/specs/ts/expression/non_null_expression.ts.snap
index e7ac30a93bd4..04d0829f0b8c 100644
--- a/crates/biome_js_formatter/tests/specs/ts/expression/non_null_expression.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/expression/non_null_expression.ts.snap
@@ -32,9 +32,11 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
let a: any;
let b = a!;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/expression/type_assertion_expression.ts.snap b/crates/biome_js_formatter/tests/specs/ts/expression/type_assertion_expression.ts.snap
index 16dcbf1dffb2..7b54623a8d20 100644
--- a/crates/biome_js_formatter/tests/specs/ts/expression/type_assertion_expression.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/expression/type_assertion_expression.ts.snap
@@ -37,10 +37,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
let x = "hello";
let y = x;
var d = { name: "foo", message: "bar" };
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/expression/type_expression.ts.snap b/crates/biome_js_formatter/tests/specs/ts/expression/type_expression.ts.snap
index ddb0183c3de9..d07c4dfa2f2e 100644
--- a/crates/biome_js_formatter/tests/specs/ts/expression/type_expression.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/expression/type_expression.ts.snap
@@ -137,6 +137,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -252,4 +253,5 @@ function test2(a: string): asserts a is string {}
type Type01 = 0 extends (1 extends 2 ? 3 : 4) ? 5 : 6;
type A<> = {};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/expression/type_member.ts.snap b/crates/biome_js_formatter/tests/specs/ts/expression/type_member.ts.snap
index d480cbe85f1d..76a3df5e5db7 100644
--- a/crates/biome_js_formatter/tests/specs/ts/expression/type_member.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/expression/type_member.ts.snap
@@ -80,6 +80,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -183,4 +184,5 @@ type J = {
type K = { set something(something_with_long_name: string) };
type L = { set something(something_with_long_name: string,) };
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/function/parameters/line_width_100/function_parameters.ts.snap b/crates/biome_js_formatter/tests/specs/ts/function/parameters/line_width_100/function_parameters.ts.snap
index 89e9f9cfcae6..707c2e5e58da 100644
--- a/crates/biome_js_formatter/tests/specs/ts/function/parameters/line_width_100/function_parameters.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/function/parameters/line_width_100/function_parameters.ts.snap
@@ -64,6 +64,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -102,6 +103,7 @@ export const queryAuditLog = async ({
src,
type,
}: Filter): Promise => {};
+
```
## Output 1
@@ -122,6 +124,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -157,4 +160,5 @@ export const queryAuditLog = async ({
src,
type,
}: Filter): Promise => {};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/function/parameters/line_width_120/function_parameters.ts.snap b/crates/biome_js_formatter/tests/specs/ts/function/parameters/line_width_120/function_parameters.ts.snap
index f1075af283eb..445889b88389 100644
--- a/crates/biome_js_formatter/tests/specs/ts/function/parameters/line_width_120/function_parameters.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/function/parameters/line_width_120/function_parameters.ts.snap
@@ -64,6 +64,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -102,6 +103,7 @@ export const queryAuditLog = async ({
src,
type,
}: Filter): Promise => {};
+
```
## Output 1
@@ -122,6 +124,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -151,4 +154,5 @@ export const findByDatefindByDatefindByDatefindByDate = (_, { date }, { req }) =
findByDatefindByDatefindByDatefindByDate;
export const queryAuditLog = async ({ startDate, endDate, jobId, src, type }: Filter): Promise => {};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/function/trailing_commas/es5/function_trailing_commas.ts.snap b/crates/biome_js_formatter/tests/specs/ts/function/trailing_commas/es5/function_trailing_commas.ts.snap
index 36d642279171..b54399ebbd57 100644
--- a/crates/biome_js_formatter/tests/specs/ts/function/trailing_commas/es5/function_trailing_commas.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/function/trailing_commas/es5/function_trailing_commas.ts.snap
@@ -68,6 +68,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -110,6 +111,7 @@ connect(
mapDispatchToPropsmapDispatchToProps,
mergePropsmergeProps,
)(Component);
+
```
## Output 1
@@ -130,6 +132,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -172,4 +175,5 @@ connect(
mapDispatchToPropsmapDispatchToProps,
mergePropsmergeProps
)(Component);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/function/trailing_commas/none/function_trailing_commas.ts.snap b/crates/biome_js_formatter/tests/specs/ts/function/trailing_commas/none/function_trailing_commas.ts.snap
index d35fe55fbd3a..f9ad3248886e 100644
--- a/crates/biome_js_formatter/tests/specs/ts/function/trailing_commas/none/function_trailing_commas.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/function/trailing_commas/none/function_trailing_commas.ts.snap
@@ -68,6 +68,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -110,6 +111,7 @@ connect(
mapDispatchToPropsmapDispatchToProps,
mergePropsmergeProps,
)(Component);
+
```
## Output 1
@@ -130,6 +132,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -172,4 +175,5 @@ connect(
mapDispatchToPropsmapDispatchToProps,
mergePropsmergeProps
)(Component);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/issue1511.ts.snap b/crates/biome_js_formatter/tests/specs/ts/issue1511.ts.snap
index 1424f50a3602..22df05512346 100644
--- a/crates/biome_js_formatter/tests/specs/ts/issue1511.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/issue1511.ts.snap
@@ -34,10 +34,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
call(a, function (b: () => t1 | t2) {});
call(a, (b: () => t1 | t2) => {});
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/module/export_clause.ts.snap b/crates/biome_js_formatter/tests/specs/ts/module/export_clause.ts.snap
index 314ae30bafe7..29d56a8a6d43 100644
--- a/crates/biome_js_formatter/tests/specs/ts/module/export_clause.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/module/export_clause.ts.snap
@@ -55,6 +55,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -82,4 +83,5 @@ export type * from "types";
export type * as types from "types";
export { type default as G } from "./types.ts";
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/module/external_module_reference.ts.snap b/crates/biome_js_formatter/tests/specs/ts/module/external_module_reference.ts.snap
index 560581f83d85..1d862ed527e2 100644
--- a/crates/biome_js_formatter/tests/specs/ts/module/external_module_reference.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/module/external_module_reference.ts.snap
@@ -34,10 +34,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
import name = require("module_source");
import name2 = require("other_source");
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/module/import_type/import_types.ts.snap b/crates/biome_js_formatter/tests/specs/ts/module/import_type/import_types.ts.snap
index 4a43b1a5ffb4..c674cdd97b2e 100644
--- a/crates/biome_js_formatter/tests/specs/ts/module/import_type/import_types.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/module/import_type/import_types.ts.snap
@@ -53,6 +53,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -71,6 +72,7 @@ import type { foo as baz, aaa } from "foo";
import { foo, type Foo } from "foo";
import { type Bar } from "bar";
import { bar, type Bar as Baz } from "baz";
+
```
## Output 1
@@ -91,6 +93,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -109,4 +112,5 @@ import type {foo as baz, aaa} from "foo";
import {foo, type Foo} from "foo";
import {type Bar} from "bar";
import {bar, type Bar as Baz} from "baz";
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/module/module_declaration.ts.snap b/crates/biome_js_formatter/tests/specs/ts/module/module_declaration.ts.snap
index fe3cab747b85..095de9ab0294 100644
--- a/crates/biome_js_formatter/tests/specs/ts/module/module_declaration.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/module/module_declaration.ts.snap
@@ -35,10 +35,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
module singleName {}
module qualified.name {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/module/qualified_module_name.ts.snap b/crates/biome_js_formatter/tests/specs/ts/module/qualified_module_name.ts.snap
index 60505454b1d2..6d7138530fe4 100644
--- a/crates/biome_js_formatter/tests/specs/ts/module/qualified_module_name.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/module/qualified_module_name.ts.snap
@@ -32,8 +32,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
module a.b.c {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/no-semi/class.ts.snap b/crates/biome_js_formatter/tests/specs/ts/no-semi/class.ts.snap
index 7efc0721f03d..be1174c0da3b 100644
--- a/crates/biome_js_formatter/tests/specs/ts/no-semi/class.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/no-semi/class.ts.snap
@@ -83,6 +83,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -138,6 +139,7 @@ declare module test {
[computed];
}
}
+
```
## Output 1
@@ -158,6 +160,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -213,4 +216,5 @@ declare module test {
[computed]
}
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/no-semi/non-null.ts.snap b/crates/biome_js_formatter/tests/specs/ts/no-semi/non-null.ts.snap
index 0418e2828154..b4ffe06064ad 100644
--- a/crates/biome_js_formatter/tests/specs/ts/no-semi/non-null.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/no-semi/non-null.ts.snap
@@ -34,12 +34,14 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
// the 2nd line needs ASI protection
const el = ReactDOM.findDOMNode(ref);
(el as HTMLElement)!.style.cursor = "pointer";
+
```
## Output 1
@@ -60,10 +62,12 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
// the 2nd line needs ASI protection
const el = ReactDOM.findDOMNode(ref)
;(el as HTMLElement)!.style.cursor = "pointer"
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/no-semi/statements.ts.snap b/crates/biome_js_formatter/tests/specs/ts/no-semi/statements.ts.snap
index f5ae3cfe0687..9beac9fbaeec 100644
--- a/crates/biome_js_formatter/tests/specs/ts/no-semi/statements.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/no-semi/statements.ts.snap
@@ -45,6 +45,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -61,6 +62,7 @@ declare function test(): string;
export declare function abcd(): string;
declare let a;
+
```
## Output 1
@@ -81,6 +83,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -97,4 +100,5 @@ declare function test(): string
export declare function abcd(): string
declare let a
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/no-semi/types.ts.snap b/crates/biome_js_formatter/tests/specs/ts/no-semi/types.ts.snap
index f4387b5b3123..0fae615b7f7a 100644
--- a/crates/biome_js_formatter/tests/specs/ts/no-semi/types.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/no-semi/types.ts.snap
@@ -44,6 +44,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -64,6 +65,7 @@ interface C {
type OptionsFlags = {
[Property in keyof Type]: boolean;
};
+
```
## Output 1
@@ -84,6 +86,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -104,4 +107,5 @@ interface C {
type OptionsFlags = {
[Property in keyof Type]: boolean
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/object/expand/expand-never.ts.snap b/crates/biome_js_formatter/tests/specs/ts/object/expand/expand-never.ts.snap
index da978703eeef..911a220110d9 100644
--- a/crates/biome_js_formatter/tests/specs/ts/object/expand/expand-never.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/object/expand/expand-never.ts.snap
@@ -66,6 +66,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -106,6 +107,7 @@ const d: D = {
type E = { name1: "value1"; name2: "value2" };
const e: E = { name1: "value1", name2: "value2" };
+
```
## Output 1
@@ -126,6 +128,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Never
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -148,4 +151,5 @@ const d: D = { name1: "value1", name2: "value2" };
type E = { name1: "value1"; name2: "value2" };
const e: E = { name1: "value1", name2: "value2" };
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/object/objects.ts.snap b/crates/biome_js_formatter/tests/specs/ts/object/objects.ts.snap
index e3033172d969..60f9ad64b105 100644
--- a/crates/biome_js_formatter/tests/specs/ts/object/objects.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/object/objects.ts.snap
@@ -82,6 +82,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -120,4 +121,5 @@ function fn4(
// the object type of `baz` should be collapsed
function fn5(bar: string, baz: { qux: string }): void {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/object/trailing_commas_es5/object_trailing_commas.ts.snap b/crates/biome_js_formatter/tests/specs/ts/object/trailing_commas_es5/object_trailing_commas.ts.snap
index 0eac5584b0a2..8fd28ae9d437 100644
--- a/crates/biome_js_formatter/tests/specs/ts/object/trailing_commas_es5/object_trailing_commas.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/object/trailing_commas_es5/object_trailing_commas.ts.snap
@@ -53,6 +53,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -77,6 +78,7 @@ const obj = {
dsadsadasdasdasdasdasdasdasd,
) {},
};
+
```
## Output 1
@@ -97,6 +99,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -121,4 +124,5 @@ const obj = {
dsadsadasdasdasdasdasdasdasd
) {},
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/object/trailing_commas_none/object_trailing_commas.ts.snap b/crates/biome_js_formatter/tests/specs/ts/object/trailing_commas_none/object_trailing_commas.ts.snap
index 5d73a1bf671f..bfbf06c20be3 100644
--- a/crates/biome_js_formatter/tests/specs/ts/object/trailing_commas_none/object_trailing_commas.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/object/trailing_commas_none/object_trailing_commas.ts.snap
@@ -53,6 +53,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -77,6 +78,7 @@ const obj = {
dsadsadasdasdasdasdasdasdasd,
) {},
};
+
```
## Output 1
@@ -97,6 +99,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -121,4 +124,5 @@ const obj = {
dsadsadasdasdasdasdasdasdasd
) {}
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/parameters/issue-1356/parameter_type_annotation_semicolon.ts.snap b/crates/biome_js_formatter/tests/specs/ts/parameters/issue-1356/parameter_type_annotation_semicolon.ts.snap
index 7343b0810799..ca2c9e094d01 100644
--- a/crates/biome_js_formatter/tests/specs/ts/parameters/issue-1356/parameter_type_annotation_semicolon.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/parameters/issue-1356/parameter_type_annotation_semicolon.ts.snap
@@ -40,6 +40,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -53,6 +54,7 @@ Operator linebreak: After
foo((args: { a: string; b: string }) => {
return a;
});
+
```
## Output 1
@@ -73,6 +75,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -88,6 +91,7 @@ foo(
return a
},
)
+
```
# Lines exceeding max width of 40 characters
diff --git a/crates/biome_js_formatter/tests/specs/ts/parameters/parameters.ts.snap b/crates/biome_js_formatter/tests/specs/ts/parameters/parameters.ts.snap
index 542c7136911f..7760881cc596 100644
--- a/crates/biome_js_formatter/tests/specs/ts/parameters/parameters.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/parameters/parameters.ts.snap
@@ -33,8 +33,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
function a(this: string) {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/parenthesis.ts.snap b/crates/biome_js_formatter/tests/specs/ts/parenthesis.ts.snap
index d10f59b6684b..9d7715a25741 100644
--- a/crates/biome_js_formatter/tests/specs/ts/parenthesis.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/parenthesis.ts.snap
@@ -40,6 +40,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -53,4 +54,5 @@ type T2 = (typeof obj)[number];
type T3 = keyof (typeof obj)[number];
type T4 = keyof (typeof obj)[number];
type T5 = (keyof typeof obj)["toString"];
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/simple_arguments.ts.snap b/crates/biome_js_formatter/tests/specs/ts/simple_arguments.ts.snap
index ec56805395cb..bf4ad2f84fc4 100644
--- a/crates/biome_js_formatter/tests/specs/ts/simple_arguments.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/simple_arguments.ts.snap
@@ -78,6 +78,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -120,4 +121,5 @@ foo(() => {
foo(() => {
foo;
}, bar as MyCustomType[]);
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/statement/empty_block.ts.snap b/crates/biome_js_formatter/tests/specs/ts/statement/empty_block.ts.snap
index 953de61da89b..b47d8416ba1a 100644
--- a/crates/biome_js_formatter/tests/specs/ts/statement/empty_block.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/statement/empty_block.ts.snap
@@ -32,9 +32,11 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
interface X {}
type X = {};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/statement/enum_statement.ts.snap b/crates/biome_js_formatter/tests/specs/ts/statement/enum_statement.ts.snap
index 6b4f4b3e5083..37d12c60b58f 100644
--- a/crates/biome_js_formatter/tests/specs/ts/statement/enum_statement.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/statement/enum_statement.ts.snap
@@ -43,6 +43,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -63,4 +64,5 @@ const enum C {
D,
F,
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/string/quotePreserve/parameter_quotes.ts.snap b/crates/biome_js_formatter/tests/specs/ts/string/quotePreserve/parameter_quotes.ts.snap
index 95d109a0f1d9..d82487b9316d 100644
--- a/crates/biome_js_formatter/tests/specs/ts/string/quotePreserve/parameter_quotes.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/string/quotePreserve/parameter_quotes.ts.snap
@@ -66,6 +66,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -104,6 +105,7 @@ const Y = {
"3n": false,
12334: false,
};
+
```
## Output 1
@@ -124,6 +126,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -162,4 +165,5 @@ const Y = {
"3n": false,
12334: false,
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/string/quoteSingle/parameter_quotes.ts.snap b/crates/biome_js_formatter/tests/specs/ts/string/quoteSingle/parameter_quotes.ts.snap
index a30a88061629..eccfdac9ba67 100644
--- a/crates/biome_js_formatter/tests/specs/ts/string/quoteSingle/parameter_quotes.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/string/quoteSingle/parameter_quotes.ts.snap
@@ -66,6 +66,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -104,6 +105,7 @@ const Y = {
"3n": false,
12334: false,
};
+
```
## Output 1
@@ -124,6 +126,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -162,4 +165,5 @@ const Y = {
'3n': false,
12334: false,
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/suppressions.ts.snap b/crates/biome_js_formatter/tests/specs/ts/suppressions.ts.snap
index 01ce821ac2b1..511ac72016af 100644
--- a/crates/biome_js_formatter/tests/specs/ts/suppressions.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/suppressions.ts.snap
@@ -38,6 +38,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -47,4 +48,5 @@ interface Suppressions {
b: void;
}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/conditional.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/conditional.ts.snap
index 07ddd4c68ccd..515a9604def1 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/conditional.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/conditional.ts.snap
@@ -1,6 +1,5 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
-assertion_line: 211
info: ts/type/conditional.ts
---
# Input
@@ -75,6 +74,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -153,4 +153,5 @@ type T10 =
? unknown
: unknown
: undefined;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/import_type.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/import_type.ts.snap
index 32d3d840f1f5..6b5feba312c7 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/import_type.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/import_type.ts.snap
@@ -39,6 +39,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -53,6 +54,7 @@ type ActionLogsQ =
type LongImportType =
typeof import("./long/long/long/long/long/long/long/long/path/long/long/long/long/path").default;
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/import_type_with_resolution_mode.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/import_type_with_resolution_mode.ts.snap
index 6de0df1590a6..bf7ae40e0f61 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/import_type_with_resolution_mode.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/import_type_with_resolution_mode.ts.snap
@@ -35,6 +35,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -45,4 +46,5 @@ export type TypeFromRequire = import("pkg", { with: {
export type TypeFromImport = import("pkg", { with: {
"resolution-mode": "import",
}}).TypeFromImport;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/injfer_in_intersection.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/injfer_in_intersection.ts.snap
index e93eae6efc53..f7b59b2f1d86 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/injfer_in_intersection.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/injfer_in_intersection.ts.snap
@@ -31,8 +31,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
type Type = [T] extends [(infer S extends string) & {}] ? S : T;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/injfer_in_union.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/injfer_in_union.ts.snap
index 037cb264bf60..096aea26149d 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/injfer_in_union.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/injfer_in_union.ts.snap
@@ -31,8 +31,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
type Type = [T] extends [(infer S extends string) | undefined] ? S : T;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/intersection_type.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/intersection_type.ts.snap
index ddeab0ad3a8d..6e90db6bf4aa 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/intersection_type.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/intersection_type.ts.snap
@@ -89,6 +89,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -203,4 +204,5 @@ type SoftBreakBetweenNotObjectTypeInChain = {} & SomeLongType & {
NotObjectLongLongLongLongLongLongType2 & {
somelonglonglongkey: SomeLongLongType;
} & { somelonglonglongkey: SomeLongLongType };
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/mapped_type.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/mapped_type.ts.snap
index f85073aa117b..b7ef6a0a9895 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/mapped_type.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/mapped_type.ts.snap
@@ -38,6 +38,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -49,6 +50,7 @@ export type OmitIndexSignature = {
? never
: KeyType]: ObjectType[KeyType];
};
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/qualified_name.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/qualified_name.ts.snap
index 6de1582e4df2..8373dbdba1c0 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/qualified_name.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/qualified_name.ts.snap
@@ -31,8 +31,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
type QualifiedType = A.B.C;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/template_type.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/template_type.ts.snap
index 078aaf6832d4..9485014fd669 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/template_type.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/template_type.ts.snap
@@ -34,6 +34,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -41,6 +42,7 @@ type TemplateType = `
text
${"lorem" | "ipsum" | "dolor" | "sit" | "amet" | "consectetur" | "adipiscing" | "elit" | "sed"}
`;
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/trailing-commas/es5/type_trailing_commas.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/trailing-commas/es5/type_trailing_commas.ts.snap
index 6bc175da108e..4b2e7090cb8c 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/trailing-commas/es5/type_trailing_commas.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/trailing-commas/es5/type_trailing_commas.ts.snap
@@ -43,6 +43,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -57,6 +58,7 @@ interface C<
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
> {}
+
```
## Output 1
@@ -77,6 +79,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -91,4 +94,5 @@ interface C<
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
> {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/trailing-commas/none/type_trailing_commas.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/trailing-commas/none/type_trailing_commas.ts.snap
index 63f8aacd7936..44d907aaf33b 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/trailing-commas/none/type_trailing_commas.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/trailing-commas/none/type_trailing_commas.ts.snap
@@ -43,6 +43,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -57,6 +58,7 @@ interface C<
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd,
> {}
+
```
## Output 1
@@ -77,6 +79,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -91,4 +94,5 @@ interface C<
dsadsadasdasdasdasdasdasdasd,
dsadsadasdasdasdasdasdasdasd
> {}
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/type/union_type.ts.snap b/crates/biome_js_formatter/tests/specs/ts/type/union_type.ts.snap
index 4ba04c21cdf5..4597aacf615a 100644
--- a/crates/biome_js_formatter/tests/specs/ts/type/union_type.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/type/union_type.ts.snap
@@ -280,6 +280,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -617,4 +618,5 @@ type Foo =
| A
// B
| B;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/ts/union/nested_union/nested_union.ts.snap b/crates/biome_js_formatter/tests/specs/ts/union/nested_union/nested_union.ts.snap
index 169c9a281392..4760c4af0ef8 100644
--- a/crates/biome_js_formatter/tests/specs/ts/union/nested_union/nested_union.ts.snap
+++ b/crates/biome_js_formatter/tests/specs/ts/union/nested_union/nested_union.ts.snap
@@ -43,6 +43,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -58,6 +59,7 @@ type Result =
value: string;
};
};
+
```
## Output 1
@@ -78,6 +80,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```ts
@@ -93,4 +96,5 @@ type Result =
value: string;
};
};
+
```
diff --git a/crates/biome_js_formatter/tests/specs/tsx/arrow/issue-2736.tsx.snap b/crates/biome_js_formatter/tests/specs/tsx/arrow/issue-2736.tsx.snap
index 41ce18f96667..2ee70173d3b0 100644
--- a/crates/biome_js_formatter/tests/specs/tsx/arrow/issue-2736.tsx.snap
+++ b/crates/biome_js_formatter/tests/specs/tsx/arrow/issue-2736.tsx.snap
@@ -50,6 +50,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```tsx
@@ -82,4 +83,5 @@ const ValueMenuDividf: ReactFFC<
const ValueMenuDividg: ReactFFC<
MedddddddddMenuDividerPropsMenuDividerPropszzz
> = (x) => 5;
+
```
diff --git a/crates/biome_js_formatter/tests/specs/tsx/smoke.tsx.snap b/crates/biome_js_formatter/tests/specs/tsx/smoke.tsx.snap
index e5b74a3d880a..b45bb6a296a7 100644
--- a/crates/biome_js_formatter/tests/specs/tsx/smoke.tsx.snap
+++ b/crates/biome_js_formatter/tests/specs/tsx/smoke.tsx.snap
@@ -31,8 +31,10 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```tsx
"foo";
+
```
diff --git a/crates/biome_js_formatter/tests/specs/tsx/type_param.tsx.snap b/crates/biome_js_formatter/tests/specs/tsx/type_param.tsx.snap
index 43642b66beac..5e1a443147e4 100644
--- a/crates/biome_js_formatter/tests/specs/tsx/type_param.tsx.snap
+++ b/crates/biome_js_formatter/tests/specs/tsx/type_param.tsx.snap
@@ -45,6 +45,7 @@ Bracket same line: false
Attribute Position: Auto
Expand lists: Auto
Operator linebreak: After
+Trailing newline: true
-----
```tsx
@@ -62,4 +63,5 @@ Operator linebreak: After
class A {}
class B {}
class C {}
+
```
diff --git a/crates/biome_js_semantic/src/format_semantic_model.rs b/crates/biome_js_semantic/src/format_semantic_model.rs
index 3b179fdccce1..ec7c0fc9fb43 100644
--- a/crates/biome_js_semantic/src/format_semantic_model.rs
+++ b/crates/biome_js_semantic/src/format_semantic_model.rs
@@ -1,7 +1,7 @@
use biome_formatter::prelude::*;
use biome_formatter::{
FormatContext, FormatOptions, IndentStyle, IndentWidth, LineEnding, LineWidth,
- SourceMapGeneration, TransformSourceMap,
+ SourceMapGeneration, TrailingNewline, TransformSourceMap,
};
use biome_formatter::{format_args, write};
use biome_js_syntax::TextSize;
@@ -27,6 +27,10 @@ impl FormatOptions for FormatSemanticModelOptions {
LineEnding::Lf
}
+ fn trailing_newline(&self) -> TrailingNewline {
+ TrailingNewline::default()
+ }
+
fn as_print_options(&self) -> PrinterOptions {
PrinterOptions {
indent_width: self.indent_width(),
diff --git a/crates/biome_js_type_info/src/format_type_info.rs b/crates/biome_js_type_info/src/format_type_info.rs
index 49afaa8e00b0..807f9a147b5b 100644
--- a/crates/biome_js_type_info/src/format_type_info.rs
+++ b/crates/biome_js_type_info/src/format_type_info.rs
@@ -10,7 +10,7 @@ use crate::{
use biome_formatter::prelude::*;
use biome_formatter::{
FormatContext, FormatOptions, IndentStyle, IndentWidth, LineEnding, LineWidth,
- SourceMapGeneration, TransformSourceMap,
+ SourceMapGeneration, TrailingNewline, TransformSourceMap,
};
use biome_formatter::{format_args, write};
use biome_js_syntax::TextSize;
@@ -38,6 +38,10 @@ impl FormatOptions for FormatTypeOptions {
LineEnding::Lf
}
+ fn trailing_newline(&self) -> TrailingNewline {
+ TrailingNewline::default()
+ }
+
fn as_print_options(&self) -> PrinterOptions {
PrinterOptions {
indent_width: self.indent_width(),
diff --git a/crates/biome_json_formatter/src/context.rs b/crates/biome_json_formatter/src/context.rs
index 5506379af917..806c74813a7b 100644
--- a/crates/biome_json_formatter/src/context.rs
+++ b/crates/biome_json_formatter/src/context.rs
@@ -5,7 +5,7 @@ use biome_formatter::separated::TrailingSeparator;
use biome_formatter::{BracketSpacing, Expand, IndentWidth, prelude::*};
use biome_formatter::{
CstFormatContext, FormatContext, FormatOptions, IndentStyle, LineEnding, LineWidth,
- TransformSourceMap,
+ TrailingNewline, TransformSourceMap,
};
use biome_json_syntax::{JsonFileSource, JsonLanguage};
use std::default::Default;
@@ -68,6 +68,8 @@ pub struct JsonFormatOptions {
trailing_commas: TrailingCommas,
expand: Expand,
bracket_spacing: BracketSpacing,
+ /// Whether to add a trailing newline at the end of the file. Defaults to true.
+ trailing_newline: TrailingNewline,
/// The kind of file
_file_source: JsonFileSource,
}
@@ -126,6 +128,7 @@ impl JsonFormatOptions {
pub fn new(file_source: JsonFileSource) -> Self {
Self {
_file_source: file_source,
+ trailing_newline: TrailingNewline::default(),
..Default::default()
}
}
@@ -165,6 +168,11 @@ impl JsonFormatOptions {
self
}
+ pub fn with_trailing_newline(mut self, trailing_newline: TrailingNewline) -> Self {
+ self.trailing_newline = trailing_newline;
+ self
+ }
+
pub fn set_indent_style(&mut self, indent_style: IndentStyle) {
self.indent_style = indent_style;
}
@@ -194,6 +202,10 @@ impl JsonFormatOptions {
self.expand = expand;
}
+ pub fn set_trailing_newline(&mut self, trailing_newline: TrailingNewline) {
+ self.trailing_newline = trailing_newline;
+ }
+
pub fn bracket_spacing(&self) -> BracketSpacing {
self.bracket_spacing
}
@@ -202,6 +214,10 @@ impl JsonFormatOptions {
self.expand
}
+ pub fn trailing_newline(&self) -> TrailingNewline {
+ self.trailing_newline
+ }
+
pub(crate) fn to_trailing_separator(&self) -> TrailingSeparator {
match self.trailing_commas {
TrailingCommas::None => TrailingSeparator::Omit,
@@ -227,6 +243,10 @@ impl FormatOptions for JsonFormatOptions {
self.line_ending
}
+ fn trailing_newline(&self) -> TrailingNewline {
+ self.trailing_newline
+ }
+
fn as_print_options(&self) -> PrinterOptions {
PrinterOptions::from(self)
}
@@ -241,7 +261,6 @@ impl fmt::Display for JsonFormatOptions {
writeln!(f, "Trailing commas: {}", self.trailing_commas)?;
writeln!(f, "Expand: {}", self.expand)?;
writeln!(f, "Bracket spacing: {}", self.bracket_spacing.value())?;
-
- Ok(())
+ writeln!(f, "Trailing newline: {}", self.trailing_newline.value())
}
}
diff --git a/crates/biome_json_formatter/src/json/auxiliary/root.rs b/crates/biome_json_formatter/src/json/auxiliary/root.rs
index 5795d7b96898..dce27485f3fd 100644
--- a/crates/biome_json_formatter/src/json/auxiliary/root.rs
+++ b/crates/biome_json_formatter/src/json/auxiliary/root.rs
@@ -21,10 +21,15 @@ impl FormatNodeRule for FormatJsonRoot {
[
bom_token.format(),
format_or_verbatim(value.format()),
- format_removed(&eof_token?),
- hard_line_break()
+ format_removed(&eof_token?)
]
- )
+ )?;
+
+ if f.options().trailing_newline().value() {
+ write!(f, [hard_line_break()])
+ } else {
+ Ok(())
+ }
}
// Don't fail formatting if the root contains no root value
Err(_) => {
diff --git a/crates/biome_json_formatter/tests/specs/json/array/empty_line.json.snap b/crates/biome_json_formatter/tests/specs/json/array/empty_line.json.snap
index d6795bcdf278..b336c799b8c5 100644
--- a/crates/biome_json_formatter/tests/specs/json/array/empty_line.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/array/empty_line.json.snap
@@ -30,6 +30,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -40,4 +41,5 @@ Bracket spacing: true
3, 4, 5, 6, 6
]
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/array/fill_layout.json.snap b/crates/biome_json_formatter/tests/specs/json/array/fill_layout.json.snap
index 47c55730e6e7..afcea6630544 100644
--- a/crates/biome_json_formatter/tests/specs/json/array/fill_layout.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/array/fill_layout.json.snap
@@ -26,6 +26,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -33,4 +34,5 @@ Bracket spacing: true
123231321, 123213213, 12312321, 12321123211232112321, 12321321,
1232132112321321123213211232132112321321
]
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/array/layout.json.snap b/crates/biome_json_formatter/tests/specs/json/array/layout.json.snap
index 961b98dbd7a9..146c17f684bd 100644
--- a/crates/biome_json_formatter/tests/specs/json/array/layout.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/array/layout.json.snap
@@ -34,6 +34,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -63,4 +64,5 @@ Bracket spacing: true
null
]
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/array/multi_line.json.snap b/crates/biome_json_formatter/tests/specs/json/array/multi_line.json.snap
index ca09b9877801..5d60afea20fe 100644
--- a/crates/biome_json_formatter/tests/specs/json/array/multi_line.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/array/multi_line.json.snap
@@ -30,6 +30,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -46,4 +47,5 @@ Bracket spacing: true
"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"
]
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/array/nested.json.snap b/crates/biome_json_formatter/tests/specs/json/array/nested.json.snap
index 7fc0a0bdcb8f..9b25181a2dd6 100644
--- a/crates/biome_json_formatter/tests/specs/json/array/nested.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/array/nested.json.snap
@@ -26,6 +26,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -49,4 +50,5 @@ Bracket spacing: true
"Element"
]
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/array/one_per_line_layout.json.snap b/crates/biome_json_formatter/tests/specs/json/array/one_per_line_layout.json.snap
index 684ff5bb2fe4..7768c6469520 100644
--- a/crates/biome_json_formatter/tests/specs/json/array/one_per_line_layout.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/array/one_per_line_layout.json.snap
@@ -34,6 +34,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -80,4 +81,5 @@ Bracket spacing: true
null
]
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/array/single_line.json.snap b/crates/biome_json_formatter/tests/specs/json/array/single_line.json.snap
index c825e29ddd19..4f6114397024 100644
--- a/crates/biome_json_formatter/tests/specs/json/array/single_line.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/array/single_line.json.snap
@@ -31,6 +31,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -38,4 +39,5 @@ Bracket spacing: true
"array": ["aaaaaaa", "bbbbbb", false],
"indented": [1111, 2222, true]
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/bracket-spacing/bracket-spacing-none.json.snap b/crates/biome_json_formatter/tests/specs/json/bracket-spacing/bracket-spacing-none.json.snap
index 4f950354b19f..91011842136e 100644
--- a/crates/biome_json_formatter/tests/specs/json/bracket-spacing/bracket-spacing-none.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/bracket-spacing/bracket-spacing-none.json.snap
@@ -24,10 +24,12 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
{ "foo": { "bar": { "baz": "qux" } } }
+
```
## Output 1
@@ -40,8 +42,10 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: false
+Trailing newline: true
-----
```json
{"foo": {"bar": {"baz": "qux"}}}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/comments/empty_with_comments.json.snap b/crates/biome_json_formatter/tests/specs/json/comments/empty_with_comments.json.snap
index 4b53646ef2e9..35c3fad082b0 100644
--- a/crates/biome_json_formatter/tests/specs/json/comments/empty_with_comments.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/comments/empty_with_comments.json.snap
@@ -38,6 +38,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -63,4 +64,5 @@ Bracket spacing: true
// and a line comment
]
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/comments/multiline.json.snap b/crates/biome_json_formatter/tests/specs/json/comments/multiline.json.snap
index 112c14fd1155..78b98bcf9f37 100644
--- a/crates/biome_json_formatter/tests/specs/json/comments/multiline.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/comments/multiline.json.snap
@@ -39,6 +39,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -64,4 +65,5 @@ Bracket spacing: true
} /**
* Trailing
**/
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/empty.json.snap b/crates/biome_json_formatter/tests/specs/json/empty.json.snap
index df55a31e3758..e5b030cb1979 100644
--- a/crates/biome_json_formatter/tests/specs/json/empty.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/empty.json.snap
@@ -23,9 +23,11 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/expand-never/expand-never.json.snap b/crates/biome_json_formatter/tests/specs/json/expand-never/expand-never.json.snap
index a31824e0629b..5460cdda2ed4 100644
--- a/crates/biome_json_formatter/tests/specs/json/expand-never/expand-never.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/expand-never/expand-never.json.snap
@@ -32,6 +32,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -44,6 +45,7 @@ Bracket spacing: true
}
}
}
+
```
## Output 1
@@ -56,8 +58,10 @@ Line width: 80
Trailing commas: None
Expand: Never
Bracket spacing: true
+Trailing newline: true
-----
```json
{ "foo": { "bar": { "baz": { "qux": true } } } }
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/expand/nested_array.json.snap b/crates/biome_json_formatter/tests/specs/json/expand/nested_array.json.snap
index 0f4483f13bfe..92e675fe3ce9 100644
--- a/crates/biome_json_formatter/tests/specs/json/expand/nested_array.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/expand/nested_array.json.snap
@@ -26,6 +26,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -49,6 +50,7 @@ Bracket spacing: true
"Element"
]
}
+
```
## Output 1
@@ -61,6 +63,7 @@ Line width: 80
Trailing commas: None
Expand: Always
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -88,4 +91,5 @@ Bracket spacing: true
"Element"
]
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/expand/nested_object.json.snap b/crates/biome_json_formatter/tests/specs/json/expand/nested_object.json.snap
index 2f6d826baba5..a242f3306c7b 100644
--- a/crates/biome_json_formatter/tests/specs/json/expand/nested_object.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/expand/nested_object.json.snap
@@ -24,6 +24,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -32,6 +33,7 @@ Bracket spacing: true
"string": "some-string",
"object": { "object": { "number": 123, "boolean": false } }
}
+
```
## Output 1
@@ -44,6 +46,7 @@ Line width: 80
Trailing commas: None
Expand: Always
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -57,4 +60,5 @@ Bracket spacing: true
}
}
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/number.json.snap b/crates/biome_json_formatter/tests/specs/json/number.json.snap
index 36d31bb4b2ed..c21bc2f284db 100644
--- a/crates/biome_json_formatter/tests/specs/json/number.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/number.json.snap
@@ -50,6 +50,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -80,4 +81,5 @@ Bracket spacing: true
2,
2.0
]
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/object/complex.json.snap b/crates/biome_json_formatter/tests/specs/json/object/complex.json.snap
index 3bb59dba7eec..f0377d620e20 100644
--- a/crates/biome_json_formatter/tests/specs/json/object/complex.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/object/complex.json.snap
@@ -30,6 +30,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -46,4 +47,5 @@ Bracket spacing: true
},
"null": null
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/object/missing_value.json.snap b/crates/biome_json_formatter/tests/specs/json/object/missing_value.json.snap
index 1fc68cfaef29..d1c5a2097ba3 100644
--- a/crates/biome_json_formatter/tests/specs/json/object/missing_value.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/object/missing_value.json.snap
@@ -32,6 +32,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -45,4 +46,5 @@ Bracket spacing: true
"c": "2",
"d": 3
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/object/multi_line.json.snap b/crates/biome_json_formatter/tests/specs/json/object/multi_line.json.snap
index 285d350bc89e..cda759361d7d 100644
--- a/crates/biome_json_formatter/tests/specs/json/object/multi_line.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/object/multi_line.json.snap
@@ -27,6 +27,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -34,4 +35,5 @@ Bracket spacing: true
"number": 123,
"string": "some-string"
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/object/multi_line_long.json.snap b/crates/biome_json_formatter/tests/specs/json/object/multi_line_long.json.snap
index 1684cc2c2cff..62eaf427f288 100644
--- a/crates/biome_json_formatter/tests/specs/json/object/multi_line_long.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/object/multi_line_long.json.snap
@@ -27,6 +27,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -34,4 +35,5 @@ Bracket spacing: true
"number": 1123123213123123123123122311231232131231231231231223,
"string": "some-long-long-long-long-long-long-long-string"
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/object/one_line.json.snap b/crates/biome_json_formatter/tests/specs/json/object/one_line.json.snap
index 1bdb56f9d6fd..a40ae293a4fd 100644
--- a/crates/biome_json_formatter/tests/specs/json/object/one_line.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/object/one_line.json.snap
@@ -24,8 +24,10 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
{ "number": 123, "string": "some-string" }
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/object/one_line_long.json.snap b/crates/biome_json_formatter/tests/specs/json/object/one_line_long.json.snap
index d7f415220fe1..0f0f6ac40472 100644
--- a/crates/biome_json_formatter/tests/specs/json/object/one_line_long.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/object/one_line_long.json.snap
@@ -24,6 +24,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -31,4 +32,5 @@ Bracket spacing: true
"number": 1123123213123123123123122311231232131231231231231223,
"string": "some-long-long-long-long-long-long-long-string"
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/object/string.json.snap b/crates/biome_json_formatter/tests/specs/json/object/string.json.snap
index a8ad3712d57f..5bd7274a53b0 100644
--- a/crates/biome_json_formatter/tests/specs/json/object/string.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/object/string.json.snap
@@ -29,6 +29,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -37,6 +38,7 @@ Bracket spacing: true
"/ & \/": "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?",
"slash": "/ & \/"
}
+
```
# Lines exceeding max width of 80 characters
diff --git a/crates/biome_json_formatter/tests/specs/json/smoke.json.snap b/crates/biome_json_formatter/tests/specs/json/smoke.json.snap
index 660e0613d10a..96f526ec699a 100644
--- a/crates/biome_json_formatter/tests/specs/json/smoke.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/smoke.json.snap
@@ -30,6 +30,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -40,4 +41,5 @@ Bracket spacing: true
"d": true,
"e": false
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/trailing_comma_never/classic.json.snap b/crates/biome_json_formatter/tests/specs/json/trailing_comma_never/classic.json.snap
index 95c5e8cd15aa..b1586261fdd1 100644
--- a/crates/biome_json_formatter/tests/specs/json/trailing_comma_never/classic.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/trailing_comma_never/classic.json.snap
@@ -30,6 +30,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -40,6 +41,7 @@ Bracket spacing: true
"list3": [],
"list4": []
}
+
```
## Output 1
@@ -52,6 +54,7 @@ Line width: 80
Trailing commas: All
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
@@ -62,4 +65,5 @@ Bracket spacing: true
"list3": [],
"list4": [],
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/trailing_comma_never/classic.jsonc.snap b/crates/biome_json_formatter/tests/specs/json/trailing_comma_never/classic.jsonc.snap
index c34354ead610..00ea38fb4aaa 100644
--- a/crates/biome_json_formatter/tests/specs/json/trailing_comma_never/classic.jsonc.snap
+++ b/crates/biome_json_formatter/tests/specs/json/trailing_comma_never/classic.jsonc.snap
@@ -30,6 +30,7 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```jsonc
@@ -40,6 +41,7 @@ Bracket spacing: true
"list3": [],
"list4": []
}
+
```
## Output 1
@@ -52,6 +54,7 @@ Line width: 80
Trailing commas: All
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```jsonc
@@ -62,4 +65,5 @@ Bracket spacing: true
"list3": [],
"list4": [],
}
+
```
diff --git a/crates/biome_json_formatter/tests/specs/json/trailing_newline/options.json b/crates/biome_json_formatter/tests/specs/json/trailing_newline/options.json
new file mode 100644
index 000000000000..666e7182a45f
--- /dev/null
+++ b/crates/biome_json_formatter/tests/specs/json/trailing_newline/options.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "../../../../../../packages/@biomejs/biome/configuration_schema.json",
+ "json": {
+ "formatter": {
+ "trailingNewline": false
+ }
+ }
+}
diff --git a/crates/biome_json_formatter/tests/specs/json/trailing_newline/simple.json b/crates/biome_json_formatter/tests/specs/json/trailing_newline/simple.json
new file mode 100644
index 000000000000..bd8dd310d282
--- /dev/null
+++ b/crates/biome_json_formatter/tests/specs/json/trailing_newline/simple.json
@@ -0,0 +1,4 @@
+{
+ "name": "test",
+ "version": "1.0.0"
+}
diff --git a/crates/biome_json_formatter/tests/specs/json/trailing_newline/simple.json.snap b/crates/biome_json_formatter/tests/specs/json/trailing_newline/simple.json.snap
new file mode 100644
index 000000000000..17f22d3b0ae5
--- /dev/null
+++ b/crates/biome_json_formatter/tests/specs/json/trailing_newline/simple.json.snap
@@ -0,0 +1,59 @@
+---
+source: crates/biome_formatter_test/src/snapshot_builder.rs
+info: json/trailing_newline/simple.json
+---
+# Input
+
+```json
+{
+ "name": "test",
+ "version": "1.0.0"
+}
+
+```
+
+
+=============================
+
+# Outputs
+
+## Output 1
+
+-----
+Indent style: Tab
+Indent width: 2
+Line ending: LF
+Line width: 80
+Trailing commas: None
+Expand: Auto
+Bracket spacing: true
+Trailing newline: true
+-----
+
+```json
+{
+ "name": "test",
+ "version": "1.0.0"
+}
+
+```
+
+## Output 1
+
+-----
+Indent style: Tab
+Indent width: 2
+Line ending: LF
+Line width: 80
+Trailing commas: None
+Expand: Auto
+Bracket spacing: true
+Trailing newline: false
+-----
+
+```json
+{
+ "name": "test",
+ "version": "1.0.0"
+}
+```
diff --git a/crates/biome_json_formatter/tests/specs/json/undefined/utf8_bom_empty_object.json.snap b/crates/biome_json_formatter/tests/specs/json/undefined/utf8_bom_empty_object.json.snap
index b3c96b44617e..d8ec5ea320c3 100644
--- a/crates/biome_json_formatter/tests/specs/json/undefined/utf8_bom_empty_object.json.snap
+++ b/crates/biome_json_formatter/tests/specs/json/undefined/utf8_bom_empty_object.json.snap
@@ -23,8 +23,10 @@ Line width: 80
Trailing commas: None
Expand: Auto
Bracket spacing: true
+Trailing newline: true
-----
```json
{}
+
```
diff --git a/crates/biome_service/src/file_handlers/css.rs b/crates/biome_service/src/file_handlers/css.rs
index 0aa1878410cd..fdd1e1240527 100644
--- a/crates/biome_service/src/file_handlers/css.rs
+++ b/crates/biome_service/src/file_handlers/css.rs
@@ -30,6 +30,7 @@ use biome_css_semantic::semantic_model;
use biome_css_syntax::{AnyCssRoot, CssLanguage, CssRoot, CssSyntaxNode};
use biome_formatter::{
FormatError, IndentStyle, IndentWidth, LineEnding, LineWidth, Printed, QuoteStyle,
+ TrailingNewline,
};
use biome_fs::BiomePath;
use biome_parser::AnyParse;
@@ -49,6 +50,7 @@ pub struct CssFormatterSettings {
pub indent_style: Option,
pub quote_style: Option,
pub enabled: Option,
+ pub trailing_newline: Option,
}
impl From for CssFormatterSettings {
@@ -60,6 +62,7 @@ impl From for CssFormatterSettings {
indent_style: configuration.indent_style,
quote_style: configuration.quote_style,
line_ending: configuration.line_ending,
+ trailing_newline: configuration.trailing_newline,
}
}
}
@@ -214,6 +217,11 @@ impl ServiceLanguage for CssLanguage {
.or(global.line_ending)
.unwrap_or_default();
+ let trailing_newline = language
+ .trailing_newline
+ .or(global.trailing_newline)
+ .unwrap_or_default();
+
let mut options = CssFormatOptions::new(
document_file_source
.to_css_file_source()
@@ -223,7 +231,8 @@ impl ServiceLanguage for CssLanguage {
.with_indent_width(indent_width)
.with_line_width(line_width)
.with_line_ending(line_ending)
- .with_quote_style(language.quote_style.unwrap_or_default());
+ .with_quote_style(language.quote_style.unwrap_or_default())
+ .with_trailing_newline(trailing_newline);
overrides.apply_override_css_format_options(path, &mut options);
diff --git a/crates/biome_service/src/file_handlers/graphql.rs b/crates/biome_service/src/file_handlers/graphql.rs
index d7ee63dfc459..ed1562bd5ec1 100644
--- a/crates/biome_service/src/file_handlers/graphql.rs
+++ b/crates/biome_service/src/file_handlers/graphql.rs
@@ -21,7 +21,7 @@ use biome_configuration::graphql::{
};
use biome_formatter::{
BracketSpacing, FormatError, IndentStyle, IndentWidth, LineEnding, LineWidth, Printed,
- QuoteStyle,
+ QuoteStyle, TrailingNewline,
};
use biome_fs::BiomePath;
use biome_graphql_analyze::analyze;
@@ -46,6 +46,7 @@ pub struct GraphqlFormatterSettings {
pub quote_style: Option,
pub bracket_spacing: Option,
pub enabled: Option,
+ pub trailing_newline: Option,
}
impl From for GraphqlFormatterSettings {
@@ -58,6 +59,7 @@ impl From for GraphqlFormatterSettings {
quote_style: configuration.quote_style,
bracket_spacing: configuration.bracket_spacing,
enabled: configuration.enabled,
+ trailing_newline: configuration.trailing_newline,
}
}
}
@@ -145,6 +147,10 @@ impl ServiceLanguage for GraphqlLanguage {
.bracket_spacing
.or(global.bracket_spacing)
.unwrap_or_default();
+ let trailing_newline = language
+ .trailing_newline
+ .or(global.trailing_newline)
+ .unwrap_or_default();
let mut options = GraphqlFormatOptions::new(
document_file_source
@@ -156,7 +162,8 @@ impl ServiceLanguage for GraphqlLanguage {
.with_line_width(line_width)
.with_line_ending(line_ending)
.with_bracket_spacing(bracket_spacing)
- .with_quote_style(language.quote_style.unwrap_or_default());
+ .with_quote_style(language.quote_style.unwrap_or_default())
+ .with_trailing_newline(trailing_newline);
overrides.apply_override_graphql_format_options(path, &mut options);
diff --git a/crates/biome_service/src/file_handlers/grit.rs b/crates/biome_service/src/file_handlers/grit.rs
index a2608a99db29..b1036229d31d 100644
--- a/crates/biome_service/src/file_handlers/grit.rs
+++ b/crates/biome_service/src/file_handlers/grit.rs
@@ -17,7 +17,9 @@ use biome_configuration::grit::{
GritLinterConfiguration, GritLinterEnabled,
};
use biome_diagnostics::{Diagnostic, Severity};
-use biome_formatter::{FormatError, IndentStyle, IndentWidth, LineEnding, LineWidth, Printed};
+use biome_formatter::{
+ FormatError, IndentStyle, IndentWidth, LineEnding, LineWidth, Printed, TrailingNewline,
+};
use biome_fs::BiomePath;
use biome_grit_formatter::{context::GritFormatOptions, format_node, format_sub_tree};
use biome_grit_parser::parse_grit_with_cache;
@@ -35,6 +37,7 @@ pub struct GritFormatterSettings {
pub indent_width: Option,
pub indent_style: Option,
pub enabled: Option,
+ pub trailing_newline: Option,
}
impl From for GritFormatterSettings {
@@ -45,6 +48,7 @@ impl From for GritFormatterSettings {
indent_width: config.indent_width,
indent_style: config.indent_style,
enabled: config.enabled,
+ trailing_newline: config.trailing_newline,
}
}
}
@@ -129,12 +133,18 @@ impl ServiceLanguage for GritLanguage {
.or(global.line_ending)
.unwrap_or_default();
+ let trailing_newline = language
+ .trailing_newline
+ .or(global.trailing_newline)
+ .unwrap_or_default();
+
let mut options =
GritFormatOptions::new(file_source.to_grit_file_source().unwrap_or_default())
.with_indent_style(indent_style)
.with_indent_width(indent_width)
.with_line_width(line_width)
- .with_line_ending(line_ending);
+ .with_line_ending(line_ending)
+ .with_trailing_newline(trailing_newline);
overrides.apply_override_grit_format_options(path, &mut options);
diff --git a/crates/biome_service/src/file_handlers/html.rs b/crates/biome_service/src/file_handlers/html.rs
index 4c888d54d2c5..5cb58462053d 100644
--- a/crates/biome_service/src/file_handlers/html.rs
+++ b/crates/biome_service/src/file_handlers/html.rs
@@ -26,7 +26,7 @@ use biome_formatter::format_element::{Interned, LineMode};
use biome_formatter::prelude::{Document, Tag};
use biome_formatter::{
AttributePosition, BracketSameLine, FormatElement, IndentStyle, IndentWidth, LineEnding,
- LineWidth, Printed,
+ LineWidth, Printed, TrailingNewline,
};
use biome_fs::BiomePath;
use biome_html_analyze::analyze;
@@ -81,6 +81,7 @@ pub struct HtmlFormatterSettings {
pub whitespace_sensitivity: Option,
pub indent_script_and_style: Option,
pub self_close_void_elements: Option,
+ pub trailing_newline: Option,
}
impl From for HtmlFormatterSettings {
@@ -96,6 +97,7 @@ impl From for HtmlFormatterSettings {
whitespace_sensitivity: config.whitespace_sensitivity,
indent_script_and_style: config.indent_script_and_style,
self_close_void_elements: config.self_close_void_elements,
+ trailing_newline: config.trailing_newline,
}
}
}
@@ -176,6 +178,7 @@ impl ServiceLanguage for HtmlLanguage {
let whitespace_sensitivity = language.whitespace_sensitivity.unwrap_or_default();
let indent_script_and_style = language.indent_script_and_style.unwrap_or_default();
let self_close_void_elements = language.self_close_void_elements.unwrap_or_default();
+ let trailing_newline = language.trailing_newline.unwrap_or_default();
let mut options =
HtmlFormatOptions::new(file_source.to_html_file_source().unwrap_or_default())
@@ -187,7 +190,8 @@ impl ServiceLanguage for HtmlLanguage {
.with_bracket_same_line(bracket_same_line)
.with_whitespace_sensitivity(whitespace_sensitivity)
.with_indent_script_and_style(indent_script_and_style)
- .with_self_close_void_elements(self_close_void_elements);
+ .with_self_close_void_elements(self_close_void_elements)
+ .with_trailing_newline(trailing_newline);
overrides.apply_override_html_format_options(path, &mut options);
diff --git a/crates/biome_service/src/file_handlers/javascript.rs b/crates/biome_service/src/file_handlers/javascript.rs
index 69a3c076b54a..4f7d50b3a425 100644
--- a/crates/biome_service/src/file_handlers/javascript.rs
+++ b/crates/biome_service/src/file_handlers/javascript.rs
@@ -33,7 +33,7 @@ use biome_css_syntax::{CssFileSource, CssLanguage, EmbeddingKind};
use biome_formatter::prelude::{Document, Interned, LineMode, Tag};
use biome_formatter::{
AttributePosition, BracketSameLine, BracketSpacing, Expand, FormatElement, FormatError,
- IndentStyle, IndentWidth, LineEnding, LineWidth, Printed, QuoteStyle,
+ IndentStyle, IndentWidth, LineEnding, LineWidth, Printed, QuoteStyle, TrailingNewline,
};
use biome_fs::BiomePath;
use biome_graphql_parser::parse_graphql_with_offset_and_cache;
@@ -86,6 +86,7 @@ pub struct JsFormatterSettings {
pub attribute_position: Option,
pub expand: Option,
pub operator_linebreak: Option,
+ pub trailing_newline: Option,
}
impl From for JsFormatterSettings {
@@ -107,6 +108,7 @@ impl From for JsFormatterSettings {
line_ending: value.line_ending,
expand: value.expand,
operator_linebreak: value.operator_linebreak,
+ trailing_newline: value.trailing_newline,
}
}
}
@@ -274,6 +276,12 @@ impl ServiceLanguage for JsLanguage {
.unwrap_or_default(),
)
.with_expand(language.expand.or(global.expand).unwrap_or_default())
+ .with_trailing_newline(
+ language
+ .trailing_newline
+ .or(global.trailing_newline)
+ .unwrap_or_default(),
+ )
.with_operator_linebreak(language.operator_linebreak.unwrap_or_default());
overrides.override_js_format_options(path, options)
diff --git a/crates/biome_service/src/file_handlers/json.rs b/crates/biome_service/src/file_handlers/json.rs
index 614d5ba5bc65..9ad3e8a55ae3 100644
--- a/crates/biome_service/src/file_handlers/json.rs
+++ b/crates/biome_service/src/file_handlers/json.rs
@@ -25,6 +25,7 @@ use biome_configuration::json::{
use biome_deserialize::json::deserialize_from_json_ast;
use biome_formatter::{
BracketSpacing, Expand, FormatError, IndentStyle, IndentWidth, LineEnding, LineWidth, Printed,
+ TrailingNewline,
};
use biome_fs::{BiomePath, ConfigName};
use biome_json_analyze::{JsonAnalyzeServices, analyze};
@@ -51,6 +52,7 @@ pub struct JsonFormatterSettings {
pub expand: Option,
pub bracket_spacing: Option,
pub enabled: Option,
+ pub trailing_newline: Option,
}
impl From for JsonFormatterSettings {
@@ -64,6 +66,7 @@ impl From for JsonFormatterSettings {
expand: configuration.expand,
bracket_spacing: configuration.bracket_spacing,
enabled: configuration.enabled,
+ trailing_newline: configuration.trailing_newline,
}
}
}
@@ -178,6 +181,11 @@ impl ServiceLanguage for JsonLanguage {
.or(global.indent_width)
.unwrap_or_default();
+ let trailing_newline = language
+ .trailing_newline
+ .or(global.trailing_newline)
+ .unwrap_or_default();
+
let line_ending = language
.line_ending
.or(global.line_ending)
@@ -214,7 +222,8 @@ impl ServiceLanguage for JsonLanguage {
.with_line_width(line_width)
.with_trailing_commas(trailing_commas)
.with_expand(expand_lists)
- .with_bracket_spacing(bracket_spacing);
+ .with_bracket_spacing(bracket_spacing)
+ .with_trailing_newline(trailing_newline);
overrides.apply_override_json_format_options(path, &mut options);
diff --git a/crates/biome_service/src/settings.rs b/crates/biome_service/src/settings.rs
index 73c47e6ed51a..f1c87d8bf96e 100644
--- a/crates/biome_service/src/settings.rs
+++ b/crates/biome_service/src/settings.rs
@@ -24,7 +24,7 @@ use biome_css_syntax::CssLanguage;
use biome_deserialize::Merge;
use biome_formatter::{
AttributePosition, BracketSameLine, BracketSpacing, Expand, IndentStyle, IndentWidth,
- LineEnding, LineWidth,
+ LineEnding, LineWidth, TrailingNewline,
};
use biome_fs::BiomePath;
use biome_graphql_formatter::context::GraphqlFormatOptions;
@@ -507,6 +507,7 @@ pub struct FormatSettings {
pub attribute_position: Option,
pub bracket_same_line: Option,
pub bracket_spacing: Option,
+ pub trailing_newline: Option,
pub expand: Option,
/// List of included paths/files
pub includes: Includes,
@@ -534,6 +535,7 @@ pub struct OverrideFormatSettings {
pub bracket_same_line: Option,
pub attribute_position: Option,
pub expand: Option,
+ pub trailing_newline: Option,
}
impl From for OverrideFormatSettings {
@@ -549,6 +551,7 @@ impl From for OverrideFormatSettings {
bracket_same_line: conf.bracket_same_line,
attribute_position: conf.attribute_position,
expand: conf.expand,
+ trailing_newline: conf.trailing_newline,
}
}
}
@@ -1607,6 +1610,10 @@ impl OverrideSettingPattern {
if let Some(operator_line_break) = js_formatter.operator_linebreak {
options.set_operator_linebreak(operator_line_break);
}
+ if let Some(trailing_newline) = js_formatter.trailing_newline.or(formatter.trailing_newline)
+ {
+ options.set_trailing_newline(trailing_newline);
+ }
}
fn apply_overrides_to_json_format_options(&self, options: &mut JsonFormatOptions) {
@@ -1635,6 +1642,12 @@ impl OverrideSettingPattern {
{
options.set_bracket_spacing(bracket_spacing);
}
+ if let Some(trailing_newline) = json_formatter
+ .trailing_newline
+ .or(formatter.trailing_newline)
+ {
+ options.set_trailing_newline(trailing_newline);
+ }
}
fn apply_overrides_to_css_format_options(&self, options: &mut CssFormatOptions) {
@@ -1656,6 +1669,12 @@ impl OverrideSettingPattern {
if let Some(quote_style) = css_formatter.quote_style {
options.set_quote_style(quote_style);
}
+ if let Some(trailing_newline) = css_formatter
+ .trailing_newline
+ .or(formatter.trailing_newline)
+ {
+ options.set_trailing_newline(trailing_newline);
+ }
}
fn apply_overrides_to_graphql_format_options(&self, options: &mut GraphqlFormatOptions) {
@@ -1683,6 +1702,12 @@ impl OverrideSettingPattern {
if let Some(quote_style) = graphql_formatter.quote_style {
options.set_quote_style(quote_style);
}
+ if let Some(trailing_newline) = graphql_formatter
+ .trailing_newline
+ .or(formatter.trailing_newline)
+ {
+ options.set_trailing_newline(trailing_newline);
+ }
}
fn apply_overrides_to_grit_format_options(&self, options: &mut GritFormatOptions) {
@@ -1701,6 +1726,12 @@ impl OverrideSettingPattern {
if let Some(line_width) = grit_formatter.line_width.or(formatter.line_width) {
options.set_line_width(line_width);
}
+ if let Some(trailing_newline) = grit_formatter
+ .trailing_newline
+ .or(formatter.trailing_newline)
+ {
+ options.set_trailing_newline(trailing_newline);
+ }
}
fn apply_overrides_to_html_format_options(&self, options: &mut HtmlFormatOptions) {
@@ -1752,6 +1783,13 @@ impl OverrideSettingPattern {
}
// #endregion
+
+ if let Some(trailing_newline) = html_formatter
+ .trailing_newline
+ .or(formatter.trailing_newline)
+ {
+ options.set_trailing_newline(trailing_newline);
+ }
}
fn apply_overrides_to_js_parser_options(&self, options: &mut JsParserOptions) {
@@ -1829,6 +1867,7 @@ pub fn to_override_settings(
bracket_same_line: formatter.bracket_same_line,
attribute_position: formatter.attribute_position,
expand: formatter.expand,
+ trailing_newline: formatter.trailing_newline,
})
.unwrap_or_default();
let linter = pattern
@@ -2031,6 +2070,7 @@ pub fn to_format_settings(
bracket_same_line: conf.bracket_same_line,
bracket_spacing: conf.bracket_spacing,
expand: conf.expand,
+ trailing_newline: conf.trailing_newline,
includes: Includes::new(working_directory, conf.includes),
})
}
@@ -2057,6 +2097,7 @@ impl TryFrom for FormatSettings {
bracket_spacing: Some(BracketSpacing::default()),
expand: conf.expand,
format_with_errors: conf.format_with_errors,
+ trailing_newline: conf.trailing_newline,
includes: Default::default(),
})
}
diff --git a/crates/biome_yaml_formatter/src/context.rs b/crates/biome_yaml_formatter/src/context.rs
index f24fadda6070..7e5cd64f8e29 100644
--- a/crates/biome_yaml_formatter/src/context.rs
+++ b/crates/biome_yaml_formatter/src/context.rs
@@ -4,7 +4,7 @@ use std::rc::Rc;
use biome_formatter::{
CstFormatContext, FormatContext, FormatOptions, IndentStyle, LineEnding, LineWidth,
- TransformSourceMap,
+ TrailingNewline, TransformSourceMap,
};
use biome_formatter::{IndentWidth, prelude::*};
use biome_yaml_syntax::{YamlFileSource, YamlLanguage};
@@ -63,6 +63,8 @@ pub struct YamlFormatOptions {
indent_width: IndentWidth,
line_ending: LineEnding,
line_width: LineWidth,
+ /// Whether to add a trailing newline at the end of the file. Defaults to true.
+ trailing_newline: TrailingNewline,
/// The kind of file
_file_source: YamlFileSource,
}
@@ -71,6 +73,7 @@ impl YamlFormatOptions {
pub fn new(file_source: YamlFileSource) -> Self {
Self {
_file_source: file_source,
+ trailing_newline: TrailingNewline::default(),
..Default::default()
}
}
@@ -95,6 +98,11 @@ impl YamlFormatOptions {
self
}
+ pub fn with_trailing_newline(mut self, trailing_newline: TrailingNewline) -> Self {
+ self.trailing_newline = trailing_newline;
+ self
+ }
+
pub fn set_indent_style(&mut self, indent_style: IndentStyle) {
self.indent_style = indent_style;
}
@@ -110,6 +118,10 @@ impl YamlFormatOptions {
pub fn set_line_width(&mut self, line_width: LineWidth) {
self.line_width = line_width;
}
+
+ pub fn set_trailing_newline(&mut self, trailing_newline: TrailingNewline) {
+ self.trailing_newline = trailing_newline;
+ }
}
impl FormatOptions for YamlFormatOptions {
@@ -129,6 +141,10 @@ impl FormatOptions for YamlFormatOptions {
self.line_ending
}
+ fn trailing_newline(&self) -> TrailingNewline {
+ self.trailing_newline
+ }
+
fn as_print_options(&self) -> PrinterOptions {
PrinterOptions::from(self)
}
@@ -140,6 +156,7 @@ impl fmt::Display for YamlFormatOptions {
writeln!(f, "Indent width: {}", self.indent_width.value())?;
writeln!(f, "Line ending: {}", self.line_ending)?;
writeln!(f, "Line width: {}", self.line_width.value())?;
+ writeln!(f, "Trailing newline: {}", self.trailing_newline.value())?;
Ok(())
}
diff --git a/packages/@biomejs/backend-jsonrpc/src/workspace.ts b/packages/@biomejs/backend-jsonrpc/src/workspace.ts
index df26ece24a75..4733df4002d7 100644
--- a/packages/@biomejs/backend-jsonrpc/src/workspace.ts
+++ b/packages/@biomejs/backend-jsonrpc/src/workspace.ts
@@ -209,6 +209,19 @@ match these patterns.
*/
lineWidth?: LineWidth;
/**
+ * Whether to add a trailing newline at the end of the file.
+
+Setting this option to `false` is **highly discouraged** because it could cause many problems with other tools:
+-
+-
+-
+
+Disable the option at your own risk.
+
+Defaults to true.
+ */
+ trailingNewline?: TrailingNewline;
+ /**
* Use any `.editorconfig` files to configure the formatter. Configuration
in `biome.json` will override `.editorconfig` configuration.
@@ -426,6 +439,19 @@ export interface CssFormatterConfiguration {
* The type of quotes used in CSS code. Defaults to double.
*/
quoteStyle?: QuoteStyle;
+ /**
+ * Whether to add a trailing newline at the end of the file.
+
+Setting this option to `false` is **highly discouraged** because it could cause many problems with other tools:
+-
+-
+-
+
+Disable the option at your own risk.
+
+Defaults to true.
+ */
+ trailingNewline?: TrailingNewline;
}
/**
* Options that changes how the CSS linter behaves
@@ -471,6 +497,7 @@ export type LineEnding = "lf" | "crlf" | "cr" | "auto";
The allowed range of values is 1..=320
*/
export type LineWidth = number;
+export type TrailingNewline = boolean;
/**
* Options that changes how the GraphQL linter behaves
*/
@@ -512,6 +539,19 @@ export interface GraphqlFormatterConfiguration {
* The type of quotes used in GraphQL code. Defaults to double.
*/
quoteStyle?: QuoteStyle;
+ /**
+ * Whether to add a trailing newline at the end of the file.
+
+Setting this option to `false` is **highly discouraged** because it could cause many problems with other tools:
+-
+-
+-
+
+Disable the option at your own risk.
+
+Defaults to true.
+ */
+ trailingNewline?: TrailingNewline;
}
/**
* Options that change how the GraphQL linter behaves.
@@ -549,6 +589,19 @@ export interface GritFormatterConfiguration {
* What's the max width of a line applied to Grit files. Defaults to 80.
*/
lineWidth?: LineWidth;
+ /**
+ * Whether to add a trailing newline at the end of the file.
+
+Setting this option to `false` is **highly discouraged** because it could cause many problems with other tools:
+-
+-
+-
+
+Disable the option at your own risk.
+
+Defaults to true.
+ */
+ trailingNewline?: TrailingNewline;
}
export interface GritLinterConfiguration {
/**
@@ -605,6 +658,19 @@ export interface HtmlFormatterConfiguration {
* Whether void elements should be self-closed. Defaults to never.
*/
selfCloseVoidElements?: SelfCloseVoidElements;
+ /**
+ * Whether to add a trailing newline at the end of the file.
+
+Setting this option to `false` is **highly discouraged** because it could cause many problems with other tools:
+-
+-
+-
+
+Disable the option at your own risk.
+
+Defaults to true.
+ */
+ trailingNewline?: TrailingNewline;
/**
* Whether to account for whitespace sensitivity when formatting HTML (and its super languages). Defaults to "css".
*/
@@ -710,6 +776,19 @@ When formatting `package.json`, Biome will use `always` unless configured otherw
* Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all".
*/
trailingCommas?: JsTrailingCommas;
+ /**
+ * Whether to add a trailing newline at the end of the file.
+
+Setting this option to `false` is **highly discouraged** because it could cause many problems with other tools:
+-
+-
+-
+
+Disable the option at your own risk.
+
+Defaults to true.
+ */
+ trailingNewline?: TrailingNewline;
}
/**
* Indicates the type of runtime or transformation used for interpreting JSX.
@@ -793,6 +872,19 @@ When formatting `package.json`, Biome will use `always` unless configured otherw
* Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "none".
*/
trailingCommas?: JsonTrailingCommas;
+ /**
+ * Whether to add a trailing newline at the end of the file.
+
+Setting this option to `false` is **highly discouraged** because it could cause many problems with other tools:
+-
+-
+-
+
+Disable the option at your own risk.
+
+Defaults to true.
+ */
+ trailingNewline?: TrailingNewline;
}
/**
* Linter options specific to the JSON linter
@@ -1053,6 +1145,19 @@ has syntax errors
* What's the max width of a line. Defaults to 80.
*/
lineWidth?: LineWidth;
+ /**
+ * Whether to add a trailing newline at the end of the file.
+
+Setting this option to `false` is **highly discouraged** because it could cause many problems with other tools:
+-
+-
+-
+
+Disable the option at your own risk.
+
+Defaults to true.
+ */
+ trailingNewline?: TrailingNewline;
}
export type OverrideGlobs = Glob[];
export interface OverrideLinterConfiguration {
diff --git a/packages/@biomejs/biome/configuration_schema.json b/packages/@biomejs/biome/configuration_schema.json
index 5c60a0790460..c679b4c9136c 100644
--- a/packages/@biomejs/biome/configuration_schema.json
+++ b/packages/@biomejs/biome/configuration_schema.json
@@ -1326,6 +1326,10 @@
"quoteStyle": {
"description": "The type of quotes used in CSS code. Defaults to double.",
"anyOf": [{ "$ref": "#/$defs/QuoteStyle" }, { "type": "null" }]
+ },
+ "trailingNewline": {
+ "description": "Whether to add a trailing newline at the end of the file.\n\nSetting this option to `false` is **highly discouraged** because it could cause many problems with other tools:\n- \n- \n- \n\nDisable the option at your own risk.\n\nDefaults to true.",
+ "anyOf": [{ "$ref": "#/$defs/TrailingNewline" }, { "type": "null" }]
}
},
"additionalProperties": false
@@ -1564,6 +1568,10 @@
"description": "What's the max width of a line. Defaults to 80.",
"anyOf": [{ "$ref": "#/$defs/LineWidth" }, { "type": "null" }]
},
+ "trailingNewline": {
+ "description": "Whether to add a trailing newline at the end of the file.\n\nSetting this option to `false` is **highly discouraged** because it could cause many problems with other tools:\n- \n- \n- \n\nDisable the option at your own risk.\n\nDefaults to true.",
+ "anyOf": [{ "$ref": "#/$defs/TrailingNewline" }, { "type": "null" }]
+ },
"useEditorconfig": {
"description": "Use any `.editorconfig` files to configure the formatter. Configuration\nin `biome.json` will override `.editorconfig` configuration.\n\nDefault: `true`.",
"anyOf": [{ "$ref": "#/$defs/Bool" }, { "type": "null" }]
@@ -1649,6 +1657,10 @@
"description": "The type of quotes used in GraphQL code. Defaults to double.",
"anyOf": [{ "$ref": "#/$defs/QuoteStyle" }, { "type": "null" }],
"default": null
+ },
+ "trailingNewline": {
+ "description": "Whether to add a trailing newline at the end of the file.\n\nSetting this option to `false` is **highly discouraged** because it could cause many problems with other tools:\n- \n- \n- \n\nDisable the option at your own risk.\n\nDefaults to true.",
+ "anyOf": [{ "$ref": "#/$defs/TrailingNewline" }, { "type": "null" }]
}
},
"additionalProperties": false
@@ -1725,6 +1737,10 @@
"lineWidth": {
"description": "What's the max width of a line applied to Grit files. Defaults to 80.",
"anyOf": [{ "$ref": "#/$defs/LineWidth" }, { "type": "null" }]
+ },
+ "trailingNewline": {
+ "description": "Whether to add a trailing newline at the end of the file.\n\nSetting this option to `false` is **highly discouraged** because it could cause many problems with other tools:\n- \n- \n- \n\nDisable the option at your own risk.\n\nDefaults to true.",
+ "anyOf": [{ "$ref": "#/$defs/TrailingNewline" }, { "type": "null" }]
}
},
"additionalProperties": false
@@ -1901,6 +1917,10 @@
{ "type": "null" }
]
},
+ "trailingNewline": {
+ "description": "Whether to add a trailing newline at the end of the file.\n\nSetting this option to `false` is **highly discouraged** because it could cause many problems with other tools:\n- \n- \n- \n\nDisable the option at your own risk.\n\nDefaults to true.",
+ "anyOf": [{ "$ref": "#/$defs/TrailingNewline" }, { "type": "null" }]
+ },
"whitespaceSensitivity": {
"description": "Whether to account for whitespace sensitivity when formatting HTML (and its super languages). Defaults to \"css\".",
"anyOf": [
@@ -2104,6 +2124,10 @@
"trailingCommas": {
"description": "Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to \"all\".",
"anyOf": [{ "$ref": "#/$defs/JsTrailingCommas" }, { "type": "null" }]
+ },
+ "trailingNewline": {
+ "description": "Whether to add a trailing newline at the end of the file.\n\nSetting this option to `false` is **highly discouraged** because it could cause many problems with other tools:\n- \n- \n- \n\nDisable the option at your own risk.\n\nDefaults to true.",
+ "anyOf": [{ "$ref": "#/$defs/TrailingNewline" }, { "type": "null" }]
}
},
"additionalProperties": false
@@ -2226,6 +2250,10 @@
{ "$ref": "#/$defs/JsonTrailingCommas" },
{ "type": "null" }
]
+ },
+ "trailingNewline": {
+ "description": "Whether to add a trailing newline at the end of the file.\n\nSetting this option to `false` is **highly discouraged** because it could cause many problems with other tools:\n- \n- \n- \n\nDisable the option at your own risk.\n\nDefaults to true.",
+ "anyOf": [{ "$ref": "#/$defs/TrailingNewline" }, { "type": "null" }]
}
},
"additionalProperties": false
@@ -5880,6 +5908,10 @@
"lineWidth": {
"description": "What's the max width of a line. Defaults to 80.",
"anyOf": [{ "$ref": "#/$defs/LineWidth" }, { "type": "null" }]
+ },
+ "trailingNewline": {
+ "description": "Whether to add a trailing newline at the end of the file.\n\nSetting this option to `false` is **highly discouraged** because it could cause many problems with other tools:\n- \n- \n- \n\nDisable the option at your own risk.\n\nDefaults to true.",
+ "anyOf": [{ "$ref": "#/$defs/TrailingNewline" }, { "type": "null" }]
}
},
"additionalProperties": false
@@ -11662,6 +11694,7 @@
},
"additionalProperties": false
},
+ "TrailingNewline": { "type": "boolean" },
"UseAdjacentOverloadSignaturesConfiguration": {
"oneOf": [
{ "$ref": "#/$defs/RulePlainConfiguration" },