@putout/printer 18.7.2 → 18.7.3
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/expressions/array-expression/indent.js +1 -1
- package/lib/tokenize/expressions/array-expression/newline.js +1 -1
- package/lib/tokenize/expressions/class/class.js +1 -1
- package/lib/tokenize/statements/block-statement/block-statement.js +2 -2
- package/lib/tokenize/statements/expression-statement/after-if.js +1 -1
- package/lib/tokenize/statements/return-statement/after-if.js +2 -2
- package/lib/tokenize/statements/return-statement/return-statement.js +2 -2
- package/lib/tokenize/statements/switch-statement/switch-statement.js +3 -2
- package/lib/tokenize/type-checker/create-tuple.js +12 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -62,7 +62,7 @@ const isObjectAfterString = (path) => {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
export const isIncreaseIndent = createTypeChecker([
|
|
65
|
-
['-: node.elements.length ->
|
|
65
|
+
['-: node.elements.length -> -'],
|
|
66
66
|
['+', isBooleanAndObject],
|
|
67
67
|
['-', isInsideCallLoop],
|
|
68
68
|
['+: node.elements.0 -> ObjectExpression'],
|
|
@@ -201,7 +201,7 @@ const isBodyWithOneElement = createTypeChecker([
|
|
|
201
201
|
]);
|
|
202
202
|
|
|
203
203
|
export const isMultiLine = createTypeChecker([
|
|
204
|
-
['-: node.elements.length ->
|
|
204
|
+
['-: node.elements.length -> -'],
|
|
205
205
|
['+', isBodyWithOneElement],
|
|
206
206
|
['+', isMoreThenMaxElementLengthInOneLine],
|
|
207
207
|
['+', isElementsMoreThenMaxWithFirstString],
|
|
@@ -22,7 +22,7 @@ const {isFunction} = types;
|
|
|
22
22
|
const isLessThenTwo = (a) => a < 2;
|
|
23
23
|
|
|
24
24
|
const isSpaceBeforeImplements = createTypeChecker([
|
|
25
|
-
['+: node.typeParameters ->
|
|
25
|
+
['+: node.typeParameters -> -'],
|
|
26
26
|
['+: node.typeParameters.params.length', isLessThenTwo],
|
|
27
27
|
]);
|
|
28
28
|
|
|
@@ -17,11 +17,11 @@ const hasDirectives = (a) => getDirectives(a).length;
|
|
|
17
17
|
|
|
18
18
|
const isNewLineAfterOpenCurlyBrace = createTypeChecker([
|
|
19
19
|
['+', hasDirectives],
|
|
20
|
-
['+: node.body.length'
|
|
20
|
+
['+: node.body.length -> +'],
|
|
21
21
|
]);
|
|
22
22
|
|
|
23
23
|
const isLinebreakAfterDirectives = createTypeChecker([
|
|
24
|
-
['-: node.body.length ->
|
|
24
|
+
['-: node.body.length -> -'],
|
|
25
25
|
['+', hasDirectives],
|
|
26
26
|
]);
|
|
27
27
|
|
|
@@ -34,7 +34,7 @@ const isPathIsConsequent = ({node, parentPath}) => node !== parentPath.node.cons
|
|
|
34
34
|
const isBeforeElse = createTypeChecker([
|
|
35
35
|
['-: parentPath -> !IfStatement'],
|
|
36
36
|
['-', isPathIsConsequent],
|
|
37
|
-
['+: parentPath.node.alternate'
|
|
37
|
+
['+: parentPath.node.alternate -> +'],
|
|
38
38
|
]);
|
|
39
39
|
|
|
40
40
|
const hasTrailingCommentNotCoupleLines = createTypeChecker([
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
import {createTypeChecker} from '#type-checker';
|
|
6
6
|
|
|
7
7
|
const isInsideIfWithElse = createTypeChecker([
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
'-: parentPath -> !IfStatement',
|
|
9
|
+
'+: parentPath.node.alternate -> +',
|
|
10
10
|
]);
|
|
11
11
|
|
|
12
12
|
export const afterIf = createTypeChecker([
|
|
@@ -38,6 +38,6 @@ export const ReturnStatement = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const isJSXWithComment = createTypeChecker([
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
'-: node.argument -> !JSXElement',
|
|
42
|
+
'+: node.argument.leadingComments -> +',
|
|
43
43
|
]);
|
|
@@ -90,6 +90,7 @@ const isNewlineAfterClosingCurlyBrace = createTypeChecker([
|
|
|
90
90
|
]);
|
|
91
91
|
|
|
92
92
|
const isNewlineAfterColon = createTypeChecker([
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
'-: node.consequent.length -> -',
|
|
94
|
+
'+: node.consequent.0 -> !BlockStatement',
|
|
95
95
|
]);
|
|
96
|
+
|
|
@@ -4,6 +4,18 @@ export function createTuple(typeName) {
|
|
|
4
4
|
const array = typeWithNot.split('!');
|
|
5
5
|
const operation = afterSplit.join(' ');
|
|
6
6
|
|
|
7
|
+
if (typeWithNot === '+')
|
|
8
|
+
return [
|
|
9
|
+
`${operation} `,
|
|
10
|
+
Boolean,
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
if (typeWithNot === '-')
|
|
14
|
+
return [
|
|
15
|
+
`${operation} !`,
|
|
16
|
+
Boolean,
|
|
17
|
+
];
|
|
18
|
+
|
|
7
19
|
if (array.length === 1)
|
|
8
20
|
return [
|
|
9
21
|
`${operation} `,
|
package/package.json
CHANGED