@putout/printer 14.3.3 → 14.3.5

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,13 @@
1
+ 2025.03.28, v14.3.5
2
+
3
+ feature:
4
+ - 79674c6 @putout/printer: VariableDeclaration: react-hooks
5
+
6
+ 2025.03.28, v14.3.4
7
+
8
+ feature:
9
+ - 544d8fe @putout/printer: VariableDeclarator: simplify
10
+
1
11
  2025.03.28, v14.3.3
2
12
 
3
13
  feature:
@@ -80,11 +80,11 @@ module.exports.VariableDeclaration = {
80
80
 
81
81
  let wasNewline = false;
82
82
 
83
- if (isParentSwitchCase(path) && !isFirstInSwitch(path)) {
84
- write.newline();
85
- wasNewline = true;
86
- } else if (isParentSwitchCase(path)) {
83
+ if (isParentSwitchCase(path)) {
87
84
  write.newline();
85
+
86
+ if (!isFirstInSwitch(path))
87
+ wasNewline = true;
88
88
  }
89
89
 
90
90
  if (isParentBlock(path) && isNext(path) && (noTrailingComment(path) || isNewlineBetweenSiblings(path))) {
@@ -96,6 +96,7 @@ module.exports.VariableDeclaration = {
96
96
  }),
97
97
  afterSatisfy: () => [
98
98
  isNextIf,
99
+ isNextFn,
99
100
  noNextParentBlock,
100
101
  notLastCoupleLines,
101
102
  isNextAssign,
@@ -193,6 +194,11 @@ const isNextIf = (path) => {
193
194
  return nextPath.isIfStatement();
194
195
  };
195
196
 
197
+ const isNextFn = (path) => {
198
+ const nextPath = path.getNextSibling();
199
+ return nextPath.isFunctionDeclaration();
200
+ };
201
+
196
202
  const isNextAssign = (path) => {
197
203
  const nextPath = path.getNextSibling();
198
204
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "14.3.3",
3
+ "version": "14.3.5",
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",