@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 CHANGED
@@ -1,3 +1,8 @@
1
+ 2026.03.15, v18.7.3
2
+
3
+ feature:
4
+ - 126ac069 @putout/printer: type-checker: boolean: +/-
5
+
1
6
  2026.03.15, v18.7.2
2
7
 
3
8
  feature:
@@ -62,7 +62,7 @@ const isObjectAfterString = (path) => {
62
62
  };
63
63
 
64
64
  export const isIncreaseIndent = createTypeChecker([
65
- ['-: node.elements.length -> !', Boolean],
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 -> !', Boolean],
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 -> !', Boolean],
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', Boolean],
20
+ ['+: node.body.length -> +'],
21
21
  ]);
22
22
 
23
23
  const isLinebreakAfterDirectives = createTypeChecker([
24
- ['-: node.body.length -> !', Boolean],
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', Boolean],
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
- ['-: parentPath -> !IfStatement'],
9
- ['+: parentPath.node.alternate', Boolean],
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
- ['-: node.argument -> !JSXElement'],
42
- ['+: node.argument.leadingComments ->', Boolean],
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
- ['-: node.consequent.length -> !', Boolean],
94
- ['+: node.consequent.0 -> !BlockStatement'],
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.7.2",
3
+ "version": "18.7.3",
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",