@putout/printer 6.14.0 → 6.15.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
@@ -1,3 +1,8 @@
1
+ 2023.12.03, v6.15.0
2
+
3
+ feature:
4
+ - f05ae8a @putout/printer: MemberExpression: chain inside ifStatement
5
+
1
6
  2023.12.03, v6.14.0
2
7
 
3
8
  feature:
@@ -1,6 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const {isDecorator} = require('@putout/babel').types;
3
+ const {
4
+ isDecorator,
5
+ isMemberExpression,
6
+ } = require('@putout/babel').types;
7
+
4
8
  const {
5
9
  isLast,
6
10
  isCoupleLines,
@@ -18,7 +22,7 @@ const isTrailingIsLeading = (path) => path.node.trailingComments === path.getNex
18
22
  const isNewlineAfter = (path) => {
19
23
  const {parentPath} = path;
20
24
 
21
- if (parentPath.isMemberExpression())
25
+ if (isMemberExpression(parentPath))
22
26
  return false;
23
27
 
24
28
  return !isLast(path) && !isDecorator(path);
@@ -3,7 +3,6 @@
3
3
  const {
4
4
  isUnaryExpression,
5
5
  isArrowFunctionExpression,
6
- isLogicalExpression,
7
6
  isIfStatement,
8
7
  } = require('@putout/babel').types;
9
8
 
@@ -65,7 +64,6 @@ const isCall = (a) => a.type === 'CallExpression';
65
64
  const isExcludedFromChain = satisfy([
66
65
  isUnaryExpression,
67
66
  isArrowFunctionExpression,
68
- isLogicalExpression,
69
67
  isIfStatement,
70
68
  ]);
71
69
 
@@ -76,6 +74,9 @@ function likeChain(path) {
76
74
  if (isExcludedFromChain(root))
77
75
  return false;
78
76
 
77
+ if (path.find(isIfStatement))
78
+ return false;
79
+
79
80
  const calls = properties.filter(isCall);
80
81
  const [firstCall] = calls;
81
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "6.14.0",
3
+ "version": "6.15.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",