@putout/printer 18.9.0 → 18.9.1

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
+ 2026.03.21, v18.9.1
2
+
3
+ feature:
4
+ - c470f660 @putout/printer: JSXElement: indent
5
+
1
6
  2026.03.20, v18.9.0
2
7
 
3
8
  feature:
@@ -3,16 +3,12 @@ import {createTypeChecker} from '#type-checker';
3
3
 
4
4
  const {isFunction} = types;
5
5
 
6
- export function isNeedIndent(path) {
7
- if (hasComplexAttribute(path))
8
- return false;
9
-
10
- const insideFn = path.parentPath.isArrowFunctionExpression();
11
- const insideJSX = path.parentPath.isJSXElement();
12
- const insideCall = path.parentPath.parentPath.isCallExpression();
13
-
14
- return insideJSX || insideFn && insideCall;
15
- }
6
+ export const isNeedIndent = createTypeChecker([
7
+ ['-', hasComplexAttribute],
8
+ ['+: parentPath -> JSXElement'],
9
+ ['-: parentPath.parentPath -> !CallExpression'],
10
+ ['+: parentPath -> ArrowFunctionExpression'],
11
+ ]);
16
12
 
17
13
  const isComplexAttribute = createTypeChecker([
18
14
  ['+: -> JSXSpreadAttribute'],
@@ -24,6 +20,9 @@ const isComplexAttribute = createTypeChecker([
24
20
  function hasComplexAttribute(path) {
25
21
  const attributes = path.get('openingElement.attributes');
26
22
 
23
+ if (attributes.length > 4)
24
+ return true;
25
+
27
26
  for (const attribute of attributes) {
28
27
  if (isComplexAttribute(attribute))
29
28
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.9.0",
3
+ "version": "18.9.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",