---
source: crates/rome_formatter_test/src/snapshot_builder.rs
info:
test_file: js/module/no-semi/no-semi.js
---
# Input
```js
// with preexisting semi
x; [1, 2, 3].forEach(fn)
x; [a, b, ...c] = [1, 2]
x; /r/i.test('r')
x; +1
x; - 1
x; ('h' + 'i').repeat(10)
x; (1, 2)
x; (() => {})()
x; ({ a: 1 }).entries()
x; ({ a: 1 }).entries()
x;
x; `string`
x; (x, y) => x
// doesn't have to be preceded by a semicolon
class X {} [1, 2, 3].forEach(fn)
// don't semicolon if it doesn't start statement
if (true) (() => {})()
// check indentation
if (true) {
x; (() => {})()
}
// check statement clauses
do break; while (false)
if (true) do break; while (false)
if (true) 1; else 2
for (;;) ;
for (x of y) ;
debugger
// check that it doesn't break non-ASI
1
- 1
1
+ 1
1
/ 1
arr
[0]
fn
(x)
!1
1
< 1
tag
`string`
x; x => x
x; (a || b).c++
x; ++(a || b).c
while (false)
(function(){}())
aReallyLongLine012345678901234567890123456789012345678901234567890123456789 *
(b + c)
```
=============================
# Outputs
## Output 1
-----
Indent style: Tab
Line width: 80
Quote style: Double Quotes
Quote properties: As needed
Trailing comma: All
Semicolons: Always
-----
```js
// with preexisting semi
x;
[1, 2, 3].forEach(fn);
x;
[a, b, ...c] = [1, 2];
x;
/r/i.test("r");
x;
+1;
x;
-1;
x;
("h" + "i").repeat(10);
x;
1, 2;
x;
(() => {})();
x;
({ a: 1 }).entries();
x;
({ a: 1 }).entries();
x;
;
x;
`string`;
x;
(x, y) => x;
// doesn't have to be preceded by a semicolon
class X {}
[1, 2, 3].forEach(fn);
// don't semicolon if it doesn't start statement
if (true) (() => {})();
// check indentation
if (true) {
x;
(() => {})();
}
// check statement clauses
do break;
while (false);
if (true)
do break;
while (false);
if (true) 1;
else 2;
for (;;);
for (x of y);
debugger;
// check that it doesn't break non-ASI
1 - 1;
1 + 1;
1 / 1;
arr[0];
fn(x);
!1;
1 < 1;
tag`string`;
x;
(x) => x;
x;
(a || b).c++;
x;
++(a || b).c;
while (false) (function () {})();
aReallyLongLine012345678901234567890123456789012345678901234567890123456789 *
(b + c);
```
## Output 2
-----
Indent style: Tab
Line width: 80
Quote style: Double Quotes
Quote properties: As needed
Trailing comma: All
Semicolons: As needed
-----
```js
// with preexisting semi
x
;[1, 2, 3].forEach(fn)
x
;[a, b, ...c] = [1, 2]
x
;/r/i.test("r")
x
;+1
x
;-1
x
;("h" + "i").repeat(10)
x
1, 2
x
;(() => {})()
x
;({ a: 1 }).entries()
x
;({ a: 1 }).entries()
x
;
x
;`string`
x
;(x, y) => x
// doesn't have to be preceded by a semicolon
class X {}
;[1, 2, 3].forEach(fn)
// don't semicolon if it doesn't start statement
if (true) (() => {})()
// check indentation
if (true) {
x
;(() => {})()
}
// check statement clauses
do break
while (false)
if (true)
do break
while (false)
if (true) 1
else 2
for (;;);
for (x of y);
debugger
// check that it doesn't break non-ASI
1 - 1
1 + 1
1 / 1
arr[0]
fn(x)
!1
1 < 1
tag`string`
x
;(x) => x
x
;(a || b).c++
x
++(a || b).c
while (false) (function () {})()
aReallyLongLine012345678901234567890123456789012345678901234567890123456789 *
(b + c)
```