Do not put spaces on empty for loop (#169)
```js
for (;;) {
```
instead of
```js
for (; ; ) {
```
This commit is contained in:
1 parent
8e0f97e410
commit
3dcf46c77c
3 files changed
+21
-2
No files matched your search
+10
-2
@@ -874,7 +874,15 @@ function genericPrintNoParens(path, options, print) {
|
||||
|
||||
return group(concat(parts));
|
||||
case "ForStatement":
|
||||
// TODO Get the for (;;) case right.
|
||||
const body = adjustClause(path.call(print, "body"), options);
|
||||
|
||||
if (!n.init && !n.test && !n.update) {
|
||||
return concat([
|
||||
'for (;;)',
|
||||
body,
|
||||
]);
|
||||
}
|
||||
|
||||
return concat([
|
||||
"for (",
|
||||
group(
|
||||
@@ -896,7 +904,7 @@ function genericPrintNoParens(path, options, print) {
|
||||
])
|
||||
),
|
||||
")",
|
||||
adjustClause(path.call(print, "body"), options)
|
||||
body,
|
||||
]);
|
||||
case "WhileStatement":
|
||||
return concat([
|
||||
|
||||
@@ -280,3 +280,12 @@ function corge(x: boolean) {
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test for.js 1`] = `
|
||||
"for (;;) {}
|
||||
for (var i = 0; i < 10; ++i) {}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
for (;;) {}
|
||||
for (var i = 0; i < 10; ++i) {}
|
||||
"
|
||||
`;
|
||||
@@ -0,0 +1,2 @@
|
||||
for (;;) {}
|
||||
for (var i = 0; i < 10; ++i) {}
|
||||
Reference in new issue
Block a user