@putout/printer 8.36.0 → 8.38.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 +11 -0
- package/lib/tokenize/expressions/assignment-expression/assignment-expression.js +5 -8
- package/lib/tokenize/statements/if-statement/if-statement.js +0 -1
- package/lib/tokenize/statements/index.js +1 -1
- package/lib/tokenize/statements/{try-statements.js → try-statement/try-statements.js} +1 -1
- package/lib/tokenize/statements/variable-declaration/variable-declaration.js +1 -1
- package/package.json +2 -2
package/ChangeLog
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
2024.05.24, v8.38.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- f1f3d74 @putout/printer: check-dts v0.8.0
|
|
5
|
+
- 2e9ff2d @putout/printer: AssignmentExpression: newline after FunctionDeclaration
|
|
6
|
+
|
|
7
|
+
2024.05.21, v8.37.0
|
|
8
|
+
|
|
9
|
+
feature:
|
|
10
|
+
- 97bcc9e @putout/printer: VariableDeclaration: add support of LabeledStatement
|
|
11
|
+
|
|
1
12
|
2024.05.19, v8.36.0
|
|
2
13
|
|
|
3
14
|
feature:
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const {isObjectPattern} = require('@putout/babel').types;
|
|
4
4
|
const {isParens} = require('../unary-expression/parens');
|
|
5
5
|
const {isCoupleLines} = require('../../is');
|
|
6
|
+
const {isMarkedAfter} = require('../../mark');
|
|
6
7
|
|
|
7
8
|
module.exports.AssignmentExpression = {
|
|
8
9
|
condition: (path) => {
|
|
@@ -34,18 +35,14 @@ module.exports.AssignmentExpression = {
|
|
|
34
35
|
},
|
|
35
36
|
};
|
|
36
37
|
|
|
37
|
-
const isPrevCoupleLines = (
|
|
38
|
-
const {parentPath} = path;
|
|
38
|
+
const isPrevCoupleLines = ({parentPath}) => {
|
|
39
39
|
const prev = parentPath.getPrevSibling();
|
|
40
40
|
|
|
41
|
-
if (
|
|
41
|
+
if (isMarkedAfter(prev))
|
|
42
42
|
return false;
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
const prevEnd = prev.node?.loc?.end.line;
|
|
46
|
-
|
|
47
|
-
if (!isCoupleLines(prev))
|
|
44
|
+
if (!prev.node)
|
|
48
45
|
return false;
|
|
49
46
|
|
|
50
|
-
return
|
|
47
|
+
return isCoupleLines(prev);
|
|
51
48
|
};
|
|
@@ -33,7 +33,6 @@ module.exports.IfStatement = {
|
|
|
33
33
|
const alternate = path.get('alternate');
|
|
34
34
|
const isConsequentBlock = consequent.isBlockStatement();
|
|
35
35
|
const isVar = consequent.isVariableDeclaration();
|
|
36
|
-
const isRet = consequent.isReturnStatement();
|
|
37
36
|
|
|
38
37
|
if (isConsequentBlock) {
|
|
39
38
|
print.space();
|
|
@@ -6,7 +6,7 @@ const {IfStatement} = require('./if-statement/if-statement');
|
|
|
6
6
|
const {ForOfStatement} = require('./for-of-statement/for-of-statement');
|
|
7
7
|
const {BlockStatement} = require('./block-statement/block-statement');
|
|
8
8
|
const {ReturnStatement} = require('./return-statement/return-statement');
|
|
9
|
-
const TryStatements = require('./try-statements');
|
|
9
|
+
const TryStatements = require('./try-statement/try-statements');
|
|
10
10
|
const {DebuggerStatement} = require('./debugger-statement');
|
|
11
11
|
const {ForStatement} = require('./for-statement');
|
|
12
12
|
const importDeclarations = require('./import-declaration/import-declaration');
|
|
@@ -17,7 +17,7 @@ const {parseLeadingComments} = require('../../comment/comment');
|
|
|
17
17
|
const {maybeDeclare} = require('../../maybe/maybe-declare');
|
|
18
18
|
|
|
19
19
|
const isParentTSModuleBlock = (path) => path.parentPath.isTSModuleBlock();
|
|
20
|
-
const isParentBlock = (path) => /Program|BlockStatement|Export/.test(path.parentPath.type);
|
|
20
|
+
const isParentBlock = (path) => /Program|BlockStatement|Export|LabeledStatement/.test(path.parentPath.type);
|
|
21
21
|
const isInsideBlock = (path) => /^(Program|BlockStatement|TSModuleBlock|SwitchCase)$/.test(path.parentPath.type);
|
|
22
22
|
const isParentSwitchCase = (path) => path.parentPath.isSwitchCase();
|
|
23
23
|
const isFirstInSwitch = (path) => path.parentPath.get('consequent.0') === path;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.38.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Simplest possible opinionated Babel AST printer for 🐊Putout",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@putout/plugin-react-hooks": "^6.0.0",
|
|
54
54
|
"acorn": "^8.8.2",
|
|
55
55
|
"c8": "^9.1.0",
|
|
56
|
-
"check-dts": "^0.
|
|
56
|
+
"check-dts": "^0.8.0",
|
|
57
57
|
"escover": "^4.0.1",
|
|
58
58
|
"eslint": "^9.0.0",
|
|
59
59
|
"eslint-plugin-putout": "^22.0.0",
|