@putout/printer 18.20.0 → 18.20.2
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
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
2026.06.20, v18.20.2
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 69369b4e @putout/printer: isNextSimpleWithLeadingComments: type checker
|
|
5
|
+
- b970af9c @putout/printer: binary-expression: newline
|
|
6
|
+
|
|
7
|
+
2026.06.20, v18.20.1
|
|
8
|
+
|
|
9
|
+
feature:
|
|
10
|
+
- 11c8ee02 @putout/printer: ExpressionStatement: isNextSimpleWithLeadingComments: BooleanLiteral
|
|
11
|
+
|
|
1
12
|
2026.06.20, v18.20.0
|
|
2
13
|
|
|
3
14
|
feature:
|
package/README.md
CHANGED
|
@@ -120,7 +120,6 @@ print(ast, {
|
|
|
120
120
|
},
|
|
121
121
|
},
|
|
122
122
|
});
|
|
123
|
-
|
|
124
123
|
// returns
|
|
125
124
|
'const {a/* [hello world] */= 5} = b;\n';
|
|
126
125
|
```
|
|
@@ -185,10 +184,6 @@ Options used to configure logic of output, similar to ESLint rules:
|
|
|
185
184
|
- ✅ `maxPropertiesInOneLine` - count of `ObjectProperties` in one line.
|
|
186
185
|
- ✅ `maxPropertiesLengthInOneLine` - maximum length of `Object Property`, when violated splits event if `maxPropertiesInOneLine` satisfies;
|
|
187
186
|
- ✅ `roundBraces` to output braces or not
|
|
188
|
-
- `arrow`: In a single argument arrow function expressions enabled: `(a) => {}`, disabled: `a => {}`;
|
|
189
|
-
- `sequence`: In sequence expressions: enabled: `for(let e of l) (a(), b())`, disabled: `for(let e of l) a(), b()`;
|
|
190
|
-
- `assign`: In assignment expressions: enabled: `(e.o=w(e.o)`, disabled: `e.o=w(e.o)`;
|
|
191
|
-
- `new`: In new expressions: enabled: `new Date()`, disabled: `new Date`;
|
|
192
187
|
|
|
193
188
|
## Visitors API
|
|
194
189
|
|
|
@@ -15,9 +15,6 @@ import {
|
|
|
15
15
|
const {
|
|
16
16
|
isCallExpression,
|
|
17
17
|
isAssignmentExpression,
|
|
18
|
-
isArrayExpression,
|
|
19
|
-
isStringLiteral,
|
|
20
|
-
isTemplateLiteral,
|
|
21
18
|
isExpressionStatement,
|
|
22
19
|
isStatement,
|
|
23
20
|
} = types;
|
|
@@ -75,39 +72,6 @@ const isNextCallWithLeadingComments = (path) => {
|
|
|
75
72
|
return isCallExpression(nextExpression);
|
|
76
73
|
};
|
|
77
74
|
|
|
78
|
-
function isNextWithLeadingComments(path) {
|
|
79
|
-
const next = path.getNextSibling();
|
|
80
|
-
const {expression} = path.node;
|
|
81
|
-
|
|
82
|
-
if (!path.node.trailingComments)
|
|
83
|
-
return true;
|
|
84
|
-
|
|
85
|
-
if (isAssignmentExpression(expression))
|
|
86
|
-
return true;
|
|
87
|
-
|
|
88
|
-
return !exists(next);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function isNextSimpleWithLeadingComments(path) {
|
|
92
|
-
const next = path.getNextSibling();
|
|
93
|
-
|
|
94
|
-
if (!hasTrailingComment(path))
|
|
95
|
-
return false;
|
|
96
|
-
|
|
97
|
-
if (!isExpressionStatement(next))
|
|
98
|
-
return false;
|
|
99
|
-
|
|
100
|
-
const {expression} = next.node;
|
|
101
|
-
|
|
102
|
-
if (isStringLiteral(expression))
|
|
103
|
-
return true;
|
|
104
|
-
|
|
105
|
-
if (isTemplateLiteral(expression))
|
|
106
|
-
return true;
|
|
107
|
-
|
|
108
|
-
return isArrayExpression(next.node.expression);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
75
|
function isAssignWithTrailingComments(path) {
|
|
112
76
|
const {expression} = path.node;
|
|
113
77
|
|
|
@@ -121,7 +85,6 @@ export const afterIf = createTypeChecker([
|
|
|
121
85
|
['-', isInsideReturn],
|
|
122
86
|
['-', isTopParentLast],
|
|
123
87
|
['+', isNextCallWithLeadingComments],
|
|
124
|
-
['-: -> !', isNextWithLeadingComments],
|
|
125
88
|
['+', isAssignWithTrailingComments],
|
|
126
89
|
['-: node.trailingComments.length -> +'],
|
|
127
90
|
['+', satisfyAfter],
|
|
@@ -12,10 +12,7 @@ import {
|
|
|
12
12
|
printLeadingCommentLine,
|
|
13
13
|
printLeadingCommentBlock,
|
|
14
14
|
} from './comments.js';
|
|
15
|
-
import {
|
|
16
|
-
afterIf,
|
|
17
|
-
isNextSimpleWithLeadingComments,
|
|
18
|
-
} from './after-if.js';
|
|
15
|
+
import {afterIf} from './after-if.js';
|
|
19
16
|
import {beforeIf} from './before-if.js';
|
|
20
17
|
|
|
21
18
|
const {isIfStatement} = types;
|
|
@@ -82,3 +79,12 @@ export const ExpressionStatement = {
|
|
|
82
79
|
maybe.markAfter(store(), path);
|
|
83
80
|
},
|
|
84
81
|
};
|
|
82
|
+
|
|
83
|
+
export const isNextSimpleWithLeadingComments = callWithNext(createTypeChecker([
|
|
84
|
+
['-: -> !', hasLeadingComment],
|
|
85
|
+
['-: -> !ExpressionStatement'],
|
|
86
|
+
['+: node.expression -> TemplateLiteral'],
|
|
87
|
+
['+: node.expression -> ArrayExpression'],
|
|
88
|
+
['+: node.expression -> BooleanLiteral'],
|
|
89
|
+
['+: node.expression -> StringLiteral'],
|
|
90
|
+
]));
|
package/package.json
CHANGED