@putout/printer 11.7.0 → 11.8.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
package/lib/tokenize/is.js
CHANGED
|
@@ -12,6 +12,7 @@ const {
|
|
|
12
12
|
isMemberExpression,
|
|
13
13
|
isArrayExpression,
|
|
14
14
|
isObjectExpression,
|
|
15
|
+
isLabeledStatement,
|
|
15
16
|
} = types;
|
|
16
17
|
|
|
17
18
|
const isParentProgram = (path) => path.parentPath?.isProgram();
|
|
@@ -124,6 +125,8 @@ module.exports.isNewlineBetweenSiblings = (path) => {
|
|
|
124
125
|
return startNext - endCurrent > 1;
|
|
125
126
|
};
|
|
126
127
|
|
|
128
|
+
module.exports.isInsideLabel = ({parentPath}) => isLabeledStatement(parentPath);
|
|
129
|
+
|
|
127
130
|
module.exports.satisfy = (conditions) => (path) => {
|
|
128
131
|
for (const condition of conditions)
|
|
129
132
|
if (condition(path))
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {isLabeledStatement} = require('@putout/babel').types;
|
|
4
3
|
const {
|
|
5
4
|
isNext,
|
|
6
5
|
isLast,
|
|
@@ -11,6 +10,7 @@ const {
|
|
|
11
10
|
noTrailingComment,
|
|
12
11
|
hasTrailingComment,
|
|
13
12
|
isCoupleLines,
|
|
13
|
+
isInsideLabel,
|
|
14
14
|
} = require('../is');
|
|
15
15
|
|
|
16
16
|
const isBeforeElse = (path) => {
|
|
@@ -36,8 +36,6 @@ const shouldBreakline = satisfy([
|
|
|
36
36
|
isStrictMode,
|
|
37
37
|
]);
|
|
38
38
|
|
|
39
|
-
const isInsideLabel = ({parentPath}) => isLabeledStatement(parentPath);
|
|
40
|
-
|
|
41
39
|
module.exports.ExpressionStatement = {
|
|
42
40
|
print(path, {print, maybe, store}) {
|
|
43
41
|
maybe.indent(!isInsideLabel(path));
|
package/package.json
CHANGED