@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 +5 -0
- package/lib/tokenize/jsx/indent.js +9 -10
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -3,16 +3,12 @@ import {createTypeChecker} from '#type-checker';
|
|
|
3
3
|
|
|
4
4
|
const {isFunction} = types;
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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