This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rome_js_formatter): Put closing curly on new line for empty block…
- Loading branch information
1 parent
7a24b21
commit 2a503e2
Showing
9 changed files
with
159 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
crates/rome_js_formatter/tests/specs/js/module/statement/empty_blocks.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Line break before closing `}` | ||
if (true) {} | ||
if (true) {} else {} | ||
|
||
for (x in []) {} | ||
for (x of []) {} | ||
|
||
|
||
|
||
switch ("test") {} | ||
|
||
switch ("test") { | ||
case "test": {} | ||
} | ||
|
||
test: {} | ||
|
||
try { | ||
} catch { | ||
} finally { | ||
} | ||
|
||
// No Line breaks | ||
class Test {} | ||
|
||
function test() {} | ||
|
||
for (;;) {} | ||
while (true) {} | ||
do {} while (true); |
81 changes: 81 additions & 0 deletions
81
crates/rome_js_formatter/tests/specs/js/module/statement/empty_blocks.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
--- | ||
source: crates/rome_js_formatter/tests/spec_test.rs | ||
assertion_line: 242 | ||
expression: empty_blocks.js | ||
--- | ||
# Input | ||
// Line break before closing `}` | ||
if (true) {} | ||
if (true) {} else {} | ||
|
||
for (x in []) {} | ||
for (x of []) {} | ||
|
||
|
||
|
||
switch ("test") {} | ||
|
||
switch ("test") { | ||
case "test": {} | ||
} | ||
|
||
test: {} | ||
|
||
try { | ||
} catch { | ||
} finally { | ||
} | ||
|
||
// No Line breaks | ||
class Test {} | ||
|
||
function test() {} | ||
|
||
for (;;) {} | ||
while (true) {} | ||
do {} while (true); | ||
============================= | ||
# Outputs | ||
## Output 1 | ||
----- | ||
Indent style: Tab | ||
Line width: 80 | ||
Quote style: Double Quotes | ||
----- | ||
// Line break before closing `}` | ||
if (true) { | ||
} | ||
if (true) { | ||
} else { | ||
} | ||
|
||
for (x in []) { | ||
} | ||
for (x of []) { | ||
} | ||
|
||
switch ("test") { | ||
} | ||
|
||
switch ("test") { | ||
case "test": { | ||
} | ||
} | ||
|
||
test: { | ||
} | ||
|
||
try { | ||
} catch { | ||
} finally { | ||
} | ||
|
||
// No Line breaks | ||
class Test {} | ||
|
||
function test() {} | ||
|
||
for (;;) {} | ||
while (true) {} | ||
do {} while (true); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ with ( b) | |
{ | ||
5 | ||
} | ||
|
||
with({}) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
crates/rome_js_formatter/tests/specs/ts/statement/empty_block.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
interface X {} | ||
type X = {}; |
19 changes: 19 additions & 0 deletions
19
crates/rome_js_formatter/tests/specs/ts/statement/empty_block.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
source: crates/rome_js_formatter/tests/spec_test.rs | ||
assertion_line: 242 | ||
expression: empty_block.ts | ||
--- | ||
# Input | ||
interface X {} | ||
type X = {}; | ||
============================= | ||
# Outputs | ||
## Output 1 | ||
----- | ||
Indent style: Tab | ||
Line width: 80 | ||
Quote style: Double Quotes | ||
----- | ||
interface X {} | ||
type X = {}; | ||
|