@putout/printer 9.0.0 → 9.0.2

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
+ 2024.06.07, v9.0.2
2
+
3
+ feature:
4
+ - 153f14d @putout/printer: ReturnStatement: SequenceExpression: no space, no roundBraces
5
+
6
+ 2024.06.07, v9.0.1
7
+
8
+ feature:
9
+ - cf5dfe7 @putout/printer: SequenceExpression: roundBraces: LogicalExpressions
10
+
1
11
  2024.06.07, v9.0.0
2
12
 
3
13
  feature:
package/README.md CHANGED
@@ -174,7 +174,7 @@ Options used to configure logic of output, similar to ESLint rules:
174
174
  - ✅ `maxVariablesInOneLine` - count of `VariableDeclarators` in one line.
175
175
  - ✅ `maxPropertiesInOneLine` - count of `ObjectProperties` in one line.
176
176
  - ✅ `maxPropertiesLengthInOneLine` - maximum length of `Object Property`, when violated splits event if `maxPropertiesInOneLine` satisfies;
177
- - ✅ `roundBraces` to output braces or not
177
+ - ✅ `roundBraces` to output braces or not
178
178
  - In a single argument arrow function expressions `(a) => {}` or not `a => {}`;
179
179
  - In sequence expressions: `for(let e of l) (a(), b())` or not `for(let e of l) a(), b()`;
180
180
 
@@ -30,6 +30,11 @@ function maybeWriteBrace(path, printer, semantics, {brace}) {
30
30
  return;
31
31
  }
32
32
 
33
+ if (path.parentPath.isLogicalExpression()) {
34
+ write(brace);
35
+ return;
36
+ }
37
+
33
38
  if (!roundBraces)
34
39
  return;
35
40
 
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  module.exports.maybeSpaceAfterKeyword = (path, {print}, semantics) => {
4
+ const {roundBraces} = semantics;
4
5
  const {argument} = path.node;
5
6
 
6
7
  if (!argument)
@@ -8,7 +9,7 @@ module.exports.maybeSpaceAfterKeyword = (path, {print}, semantics) => {
8
9
 
9
10
  const {type} = argument;
10
11
 
11
- if (type === 'SequenceExpression')
12
+ if (type === 'SequenceExpression' && roundBraces)
12
13
  return print.space();
13
14
 
14
15
  if (type === 'StringLiteral' || type === 'TemplateLiteral')
@@ -20,7 +21,7 @@ module.exports.maybeSpaceAfterKeyword = (path, {print}, semantics) => {
20
21
  if (type === 'UnaryExpression' && argument.operator === '!')
21
22
  return print.space();
22
23
 
23
- if (type === 'ArrowFunctionExpression' && semantics.roundBraces)
24
+ if (type === 'ArrowFunctionExpression' && roundBraces)
24
25
  return print.space();
25
26
 
26
27
  print(' ');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "9.0.0",
3
+ "version": "9.0.2",
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",