@putout/plugin-printer 8.11.0 → 8.12.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.
|
@@ -25,11 +25,22 @@ const prepareValue = (a) => {
|
|
|
25
25
|
|
|
26
26
|
export const report = () => `Merge tuple of type checker`;
|
|
27
27
|
|
|
28
|
+
function prepareChecker(name, value) {
|
|
29
|
+
if (name === 'Boolean') {
|
|
30
|
+
if (value.endsWith('!'))
|
|
31
|
+
return `${value.slice(1, -1)}-`;
|
|
32
|
+
|
|
33
|
+
return `${prepareValue(value)}-> +`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return `${prepareValue(value)}${name}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
28
39
|
export const fix = ({path, name}) => {
|
|
29
40
|
const [first] = path.node.elements;
|
|
30
41
|
const {value} = first;
|
|
31
42
|
|
|
32
|
-
setLiteralValue(first,
|
|
43
|
+
setLiteralValue(first, prepareChecker(name, value));
|
|
33
44
|
path.node.elements.pop();
|
|
34
45
|
};
|
|
35
46
|
|
|
@@ -58,6 +69,12 @@ export const traverse = ({push}) => ({
|
|
|
58
69
|
|
|
59
70
|
const checkerName = checker.node.name;
|
|
60
71
|
|
|
72
|
+
if (checkerName === 'Boolean')
|
|
73
|
+
push({
|
|
74
|
+
path: element,
|
|
75
|
+
name: 'Boolean',
|
|
76
|
+
});
|
|
77
|
+
|
|
61
78
|
if (!checkerName.startsWith('is'))
|
|
62
79
|
continue;
|
|
63
80
|
|
|
@@ -9,9 +9,9 @@ const {setLiteralValue} = operator;
|
|
|
9
9
|
|
|
10
10
|
export const report = ({path, where}) => {
|
|
11
11
|
const {value} = path.node;
|
|
12
|
-
const
|
|
12
|
+
const withoutColon = addColon(value, where);
|
|
13
13
|
|
|
14
|
-
return `Remove useless colon: '${value}' -> '${
|
|
14
|
+
return `Remove useless colon: '${value}' -> '${withoutColon}'`;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export const fix = ({path, where}) => {
|
package/lib/types.js
CHANGED
|
@@ -2,9 +2,13 @@ import {types} from 'putout';
|
|
|
2
2
|
|
|
3
3
|
const TYPES_EXISTS = new Set([
|
|
4
4
|
'CommentBlock',
|
|
5
|
+
'+',
|
|
6
|
+
'-',
|
|
5
7
|
]);
|
|
6
8
|
|
|
7
|
-
const TYPES_NOT_EXISTS = new Set([
|
|
9
|
+
const TYPES_NOT_EXISTS = new Set([
|
|
10
|
+
'ExportDeclaration',
|
|
11
|
+
]);
|
|
8
12
|
|
|
9
13
|
export function isTypeExists(type) {
|
|
10
14
|
if (TYPES_NOT_EXISTS.has(type))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-printer",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin adds support of transformations for @putout/printer",
|
|
@@ -52,8 +52,7 @@
|
|
|
52
52
|
"supertape": "^12.7.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"putout": ">=42"
|
|
56
|
-
"@putout/printer": ">=18"
|
|
55
|
+
"putout": ">=42"
|
|
57
56
|
},
|
|
58
57
|
"license": "MIT",
|
|
59
58
|
"engines": {
|