@putout/printer 1.111.0 → 1.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -121,7 +121,8 @@ Default options produce:
|
|
|
121
121
|
|
|
122
122
|
```js
|
|
123
123
|
if (a > 3)
|
|
124
|
-
console.log('ok');
|
|
124
|
+
console.log('ok');
|
|
125
|
+
else
|
|
125
126
|
console.log('not ok');
|
|
126
127
|
```
|
|
127
128
|
|
|
@@ -142,7 +143,8 @@ And have minified code:
|
|
|
142
143
|
|
|
143
144
|
```js
|
|
144
145
|
if (a > 3)
|
|
145
|
-
console.log('ok');
|
|
146
|
+
console.log('ok');
|
|
147
|
+
else
|
|
146
148
|
console.log('not ok');
|
|
147
149
|
```
|
|
148
150
|
|
package/lib/tokenize/is.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {isMarkedAfter} = require('./mark');
|
|
4
|
-
|
|
5
3
|
const {
|
|
6
4
|
isStringLiteral,
|
|
7
5
|
isIdentifier,
|
|
@@ -20,9 +18,6 @@ const isNext = (path) => {
|
|
|
20
18
|
if (!next.node)
|
|
21
19
|
return false;
|
|
22
20
|
|
|
23
|
-
if (isMarkedAfter(path.get('body')))
|
|
24
|
-
return false;
|
|
25
|
-
|
|
26
21
|
return !next.isEmptyStatement();
|
|
27
22
|
};
|
|
28
23
|
|
|
@@ -41,6 +41,9 @@ module.exports.ExpressionStatement = {
|
|
|
41
41
|
print('__expression');
|
|
42
42
|
print(';');
|
|
43
43
|
|
|
44
|
+
if (!isNext(path))
|
|
45
|
+
return;
|
|
46
|
+
|
|
44
47
|
if (shouldBreakline(path)) {
|
|
45
48
|
print.newline();
|
|
46
49
|
maybe.indent(isNext(path) && noTrailingComment(path));
|
|
@@ -74,12 +77,6 @@ module.exports.ExpressionStatement = {
|
|
|
74
77
|
};
|
|
75
78
|
|
|
76
79
|
function isNotLastBody(path) {
|
|
77
|
-
if (!isNext(path) && isParentBlock(path))
|
|
78
|
-
return false;
|
|
79
|
-
|
|
80
|
-
if (isLast(path) || isParentLast(path))
|
|
81
|
-
return false;
|
|
82
|
-
|
|
83
80
|
return path.parentPath.get('body') === path;
|
|
84
81
|
}
|
|
85
82
|
|
|
@@ -15,6 +15,11 @@ const {
|
|
|
15
15
|
|
|
16
16
|
module.exports.ForOfStatement = {
|
|
17
17
|
beforeIf(path) {
|
|
18
|
+
const {parentPath} = path;
|
|
19
|
+
|
|
20
|
+
if (!parentPath.isBlockStatement() && parentPath.isStatement())
|
|
21
|
+
return false;
|
|
22
|
+
|
|
18
23
|
return !isFirst(path) && !hasPrevNewline(path);
|
|
19
24
|
},
|
|
20
25
|
before(path, {print}) {
|
package/package.json
CHANGED