@putout/printer 2.3.0 → 2.4.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.06.12, v2.4.0
2
+
3
+ feature:
4
+ - 1aa1e9e @putout/printer: ObjectExpression: improve support of using as not last argument of CallExpression
5
+
1
6
  2023.06.12, v2.3.0
2
7
 
3
8
  feature:
@@ -79,6 +79,17 @@ const hasNextLeadingComment = (path) => {
79
79
  return hasLeadingComment(next);
80
80
  };
81
81
 
82
+ const notLastArgInsideCall = (path) => {
83
+ const {parentPath} = path;
84
+
85
+ if (!parentPath.isCallExpression())
86
+ return false;
87
+
88
+ return path !== parentPath
89
+ .get('arguments')
90
+ .at(-1);
91
+ };
92
+
82
93
  function shouldAddNewline(path) {
83
94
  if (!path.parentPath.isLogicalExpression())
84
95
  return false;
@@ -96,6 +107,9 @@ function isOneLine(path) {
96
107
  if (!length)
97
108
  return true;
98
109
 
110
+ if (notLastArgInsideCall(path))
111
+ return ONE_LINE;
112
+
99
113
  if (isForOf(path))
100
114
  return ONE_LINE;
101
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "2.3.0",
3
+ "version": "2.4.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",