fix(rome_formatter): add empty line after interpreter
MODIFY
crates/rome_formatter/src/utils/mod.rs
crates/rome_formatter/src/utils/mod.rs
@@ -6,7 +6,7 @@ mod simple;
use crate::formatter_traits::{FormatOptionalTokenAndNode, FormatTokenAndNode};
use crate::{
- empty_element, format_elements, hard_group_elements, hard_line_break, space_token, token,
+ empty_element, empty_line, format_elements, hard_group_elements, space_token, token,
FormatElement, FormatResult, Formatter, Token,
};
pub use binarish_expression::format_binaryish_expression;
@@ -56,7 +56,7 @@ pub(crate) fn format_interpreter(
) -> FormatResult<FormatElement> {
interpreter.format_with_or(
formatter,
- |interpreter| format_elements![interpreter, hard_line_break()],
+ |interpreter| format_elements![interpreter, empty_line()],
empty_element,
)
}

ADD
crates/rome_formatter/tests/specs/js/module/interpreter.js
+#!/usr/bin/env node
+console.log(1)
+
+console.log(1)
\ No newline at end of file

ADD
crates/rome_formatter/tests/specs/js/module/interpreter.js.snap
+---
+source: crates/rome_formatter/tests/spec_test.rs
+assertion_line: 198
+expression: interpreter.js
+
+---
+# Input
+#!/usr/bin/env node
+console.log(1)
+
+console.log(1)
+=============================
+# Outputs
+## Output 1
+-----
+Indent style: Tab
+Line width: 80
+-----
+#!/usr/bin/env node
+
+console.log(1);
+
+console.log(1);
+

MODIFY
crates/rome_formatter/tests/specs/js/module/script.js.snap
crates/rome_formatter/tests/specs/js/module/script.js.snap
---
source: crates/rome_formatter/tests/spec_test.rs
+assertion_line: 198
expression: script.js
+
---
# Input
#!/usr/bin/env node
@@ -16,6 +18,7 @@ Indent style: Tab
Line width: 80
-----
#!/usr/bin/env node
+
"use strict";
"use asm";
var express = require("express");

MODIFY
crates/rome_formatter/tests/specs/js/script/script.js.snap
crates/rome_formatter/tests/specs/js/script/script.js.snap
---
source: crates/rome_formatter/tests/spec_test.rs
+assertion_line: 198
expression: script.js
+
---
# Input
#!/usr/bin/env node
@@ -16,6 +18,7 @@ Indent style: Tab
Line width: 80
-----
#!/usr/bin/env node
+
"use strict";
"use asm";
var express = require("express");

MODIFY
crates/rome_formatter/tests/specs/prettier/js/comments/trailing_space.js.snap
crates/rome_formatter/tests/specs/prettier/js/comments/trailing_space.js.snap
---
source: crates/rome_formatter/tests/prettier_tests.rs
-assertion_line: 121
+assertion_line: 153
expression: trailing_space.js
---
@@ -17,6 +17,7 @@ expression: trailing_space.js
# Output
```js
#!/there/is-space-here->
+
// Do not trim trailing whitespace from this source file!
// There is some space here ->

MODIFY
crates/rome_formatter/tests/specs/prettier/js/shebang/shebang-newline.js.snap
crates/rome_formatter/tests/specs/prettier/js/shebang/shebang-newline.js.snap
---
source: crates/rome_formatter/tests/prettier_tests.rs
-assertion_line: 57
+assertion_line: 153
expression: shebang-newline.js
---
@@ -15,6 +15,7 @@ function a() {}
# Output
```js
#!/usr/bin/env node
+
function a() {}
```

MODIFY
crates/rome_formatter/tests/specs/prettier/js/shebang/shebang.js.snap
crates/rome_formatter/tests/specs/prettier/js/shebang/shebang.js.snap
---
source: crates/rome_formatter/tests/prettier_tests.rs
-assertion_line: 57
+assertion_line: 153
expression: shebang.js
---
@@ -14,6 +14,7 @@ function a() {}
# Output
```js
#!/usr/bin/env node
+
function a() {}
```

fix(rome_formatter): add empty line after interpreter (#2336)