@putout/printer 1.32.0 → 1.33.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
|
@@ -6,6 +6,7 @@ const {
|
|
|
6
6
|
isObjectProperty,
|
|
7
7
|
isStringLiteral,
|
|
8
8
|
isArrayExpression,
|
|
9
|
+
isIdentifier,
|
|
9
10
|
} = require('@babel/types');
|
|
10
11
|
|
|
11
12
|
const {
|
|
@@ -17,6 +18,7 @@ const isForOf = ({parentPath}) => parentPath.isForOfStatement();
|
|
|
17
18
|
const SECOND = 1;
|
|
18
19
|
const isStringAndArray = ([a, b]) => isStringLiteral(a) && isArrayExpression(b);
|
|
19
20
|
const isStringAndString = ([a, b]) => isStringLiteral(a) && isStringLiteral(b);
|
|
21
|
+
const isIdentifierAndIdentifier = ([a, b]) => isIdentifier(a) && isIdentifier(b);
|
|
20
22
|
const isArrayParent = (path) => path.parentPath.isArrayExpression();
|
|
21
23
|
|
|
22
24
|
const isTwoLongStrings = ([a, b]) => {
|
|
@@ -42,7 +44,10 @@ module.exports.ArrayExpression = {
|
|
|
42
44
|
if (isCoupleLines(parentPath))
|
|
43
45
|
return false;
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
if (isStringAndIdentifier(elements))
|
|
48
|
+
return true;
|
|
49
|
+
|
|
50
|
+
return isIdentifierAndIdentifier(elements);
|
|
46
51
|
},
|
|
47
52
|
before(path, {print}) {
|
|
48
53
|
print.breakline();
|
|
@@ -97,7 +102,10 @@ module.exports.ArrayExpression = {
|
|
|
97
102
|
if (isCoupleLines(parentPath))
|
|
98
103
|
return false;
|
|
99
104
|
|
|
100
|
-
|
|
105
|
+
if (isStringAndIdentifier(elements))
|
|
106
|
+
return true;
|
|
107
|
+
|
|
108
|
+
return isIdentifierAndIdentifier(elements);
|
|
101
109
|
},
|
|
102
110
|
after(path, {print, indent}) {
|
|
103
111
|
indent.dec();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Easiest possible opinionated Babel AST printer made with ❤️ to use in 🐊Putout",
|