@putout/plugin-conditions 8.4.0 → 8.5.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.
|
@@ -12,7 +12,7 @@ export const report = () => `Use consistent blocks`;
|
|
|
12
12
|
export const fix = (path) => {
|
|
13
13
|
const paths = getAllNodes(path);
|
|
14
14
|
|
|
15
|
-
if (isAllBlocks(paths))
|
|
15
|
+
if (isAllBlocks(paths)) {
|
|
16
16
|
for (const path of paths) {
|
|
17
17
|
if (isBlockStatement(path))
|
|
18
18
|
continue;
|
|
@@ -20,14 +20,17 @@ export const fix = (path) => {
|
|
|
20
20
|
const {node} = path;
|
|
21
21
|
replaceWith(path, blockStatement([node]));
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
for (const path of paths) {
|
|
28
|
+
if (!isBlockStatement(path))
|
|
29
|
+
continue;
|
|
30
|
+
|
|
31
|
+
const [node] = path.node.body;
|
|
32
|
+
replaceWith(path, node);
|
|
33
|
+
}
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
function isAllBlocks(paths) {
|
|
@@ -80,7 +83,7 @@ export const filter = (path) => {
|
|
|
80
83
|
continue;
|
|
81
84
|
|
|
82
85
|
if (first.leadingComments?.length)
|
|
83
|
-
|
|
86
|
+
return false;
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
blocks.push(is);
|
package/package.json
CHANGED