@putout/printer 12.16.0 → 12.17.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
+ 2025.01.24, v12.17.0
2
+
3
+ feature:
4
+ - 9f5b1af @putout/printer: ExpressionStatement: inside AssignemntExpression: after FunctionDeclaration: indent
5
+
1
6
  2025.01.24, v12.16.0
2
7
 
3
8
  feature:
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const {types} = require('@putout/babel');
4
3
  const {
5
4
  isNext,
6
5
  isLast,
@@ -14,11 +13,7 @@ const {
14
13
  isInsideLabel,
15
14
  } = require('../../is');
16
15
 
17
- const {
18
- isExpressionStatement,
19
- isAssignmentExpression,
20
- isFunction,
21
- } = types;
16
+ const {isInsideAssignNextAssignFunction} = require('./is-inside-assign-next-assign-function');
22
17
 
23
18
  const not = (fn) => (...a) => !fn(...a);
24
19
 
@@ -102,28 +97,6 @@ module.exports.ExpressionStatement = {
102
97
  },
103
98
  };
104
99
 
105
- const isInsideAssignNextAssignFunction = (path) => {
106
- const {expression} = path.node;
107
-
108
- if (!isAssignmentExpression(expression))
109
- return false;
110
-
111
- const next = path.getNextSibling();
112
-
113
- if (!isExpressionStatement(next))
114
- return false;
115
-
116
- const {leadingComments} = next.node;
117
-
118
- if (!leadingComments)
119
- return false;
120
-
121
- if (!isAssignmentExpression(next.node.expression))
122
- return false;
123
-
124
- return isFunction(next.node.expression.right);
125
- };
126
-
127
100
  function isTopParentLast({parentPath}) {
128
101
  if (!parentPath.isIfStatement())
129
102
  return false;
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ const {types} = require('@putout/babel');
4
+ const {
5
+ isExpressionStatement,
6
+ isFunction,
7
+ isAssignmentExpression,
8
+ } = types;
9
+
10
+ module.exports.isInsideAssignNextAssignFunction = (path) => {
11
+ const {expression} = path.node;
12
+
13
+ if (!isAssignmentExpression(expression))
14
+ return false;
15
+
16
+ const next = path.getNextSibling();
17
+
18
+ if (isFunction(next) && next.node.leadingComments)
19
+ return true;
20
+
21
+ if (!isExpressionStatement(next))
22
+ return false;
23
+
24
+ const {leadingComments} = next.node;
25
+
26
+ if (!leadingComments)
27
+ return false;
28
+
29
+ if (!isAssignmentExpression(next.node.expression))
30
+ return false;
31
+
32
+ return isFunction(next.node.expression.right);
33
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "12.16.0",
3
+ "version": "12.17.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",