@putout/printer 6.15.0 → 6.16.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 +5 -0
- package/lib/tokenize/expressions/class/class.js +1 -3
- package/lib/tokenize/expressions/member-expression/member-expressions.js +22 -1
- package/lib/tokenize/statements/if-statement/if-statement.js +0 -1
- package/lib/tokenize/statements/return-statement/return-statement.js +3 -0
- package/lib/tokenize/typescript/interface/ts-interface-declaration.js +1 -3
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -67,6 +67,27 @@ const isExcludedFromChain = satisfy([
|
|
|
67
67
|
isIfStatement,
|
|
68
68
|
]);
|
|
69
69
|
|
|
70
|
+
const isIfUp = (path) => {
|
|
71
|
+
const ifPath = path.find(isIfStatement);
|
|
72
|
+
let is = false;
|
|
73
|
+
|
|
74
|
+
if (!ifPath)
|
|
75
|
+
return is;
|
|
76
|
+
|
|
77
|
+
ifPath
|
|
78
|
+
.get('test')
|
|
79
|
+
.traverse({
|
|
80
|
+
MemberExpression(currentPath) {
|
|
81
|
+
if (path === currentPath) {
|
|
82
|
+
is = true;
|
|
83
|
+
path.stop();
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return is;
|
|
89
|
+
};
|
|
90
|
+
|
|
70
91
|
module.exports.likeChain = likeChain;
|
|
71
92
|
function likeChain(path) {
|
|
72
93
|
const [root, properties] = chain(path);
|
|
@@ -74,7 +95,7 @@ function likeChain(path) {
|
|
|
74
95
|
if (isExcludedFromChain(root))
|
|
75
96
|
return false;
|
|
76
97
|
|
|
77
|
-
if (path.find(
|
|
98
|
+
if (path.find(isIfUp))
|
|
78
99
|
return false;
|
|
79
100
|
|
|
80
101
|
const calls = properties.filter(isCall);
|
|
@@ -4,7 +4,6 @@ const {markAfter} = require('../../mark');
|
|
|
4
4
|
const {exists, isNext} = require('../../is');
|
|
5
5
|
|
|
6
6
|
const isInside = ({parentPath}) => !parentPath.parentPath.isProgram();
|
|
7
|
-
|
|
8
7
|
const isEmptyConsequent = (path) => path.get('consequent').isEmptyStatement();
|
|
9
8
|
|
|
10
9
|
const isInsideNestedBody = ({parentPath}) => {
|
package/package.json
CHANGED