@putout/plugin-printer 8.6.6 → 8.6.8
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.
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {types
|
|
1
|
+
import {types} from 'putout';
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
4
|
isIdentifier,
|
|
5
5
|
isCallExpression,
|
|
6
6
|
} = types;
|
|
7
7
|
|
|
8
|
-
const {setLiteralValue} = operator;
|
|
9
8
|
const ARROW = ' -> ';
|
|
10
9
|
const ARROW_NOT = ' -> !';
|
|
11
10
|
const ARROW_LENGTH = ARROW.length;
|
|
12
11
|
const ARROW_NOT_LENGTH = ARROW_NOT.length;
|
|
13
|
-
const MARK = '🧨';
|
|
14
12
|
const NOT = '!';
|
|
15
13
|
|
|
16
14
|
const TYPES = new Set([
|
|
@@ -21,10 +19,7 @@ export const report = ({type}) => {
|
|
|
21
19
|
return `Unknown type detected: '${type}'`;
|
|
22
20
|
};
|
|
23
21
|
|
|
24
|
-
export const fix = (
|
|
25
|
-
const {value} = path.node;
|
|
26
|
-
setLiteralValue(path, value.replace(type, `${MARK}${type}`));
|
|
27
|
-
};
|
|
22
|
+
export const fix = () => {};
|
|
28
23
|
|
|
29
24
|
export const traverse = ({push}) => ({
|
|
30
25
|
StringLiteral(path) {
|
|
@@ -38,9 +33,6 @@ export const traverse = ({push}) => ({
|
|
|
38
33
|
|
|
39
34
|
const {value} = path.node;
|
|
40
35
|
|
|
41
|
-
if (value.includes(MARK))
|
|
42
|
-
return;
|
|
43
|
-
|
|
44
36
|
if (!value.includes(ARROW)) {
|
|
45
37
|
if (/^[a-zA-Z].+/.test(value) && !isExists(value))
|
|
46
38
|
push({
|
|
@@ -51,12 +51,17 @@ function createWhere(value) {
|
|
|
51
51
|
endsWith,
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
traceColon(tools);
|
|
55
|
+
traceSpaces(tools);
|
|
56
56
|
|
|
57
57
|
return where;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
function traceSpaces({push, includes}) {
|
|
61
|
+
if (includes(' '))
|
|
62
|
+
push('double-spaces');
|
|
63
|
+
}
|
|
64
|
+
|
|
60
65
|
function traceColon({push, includes}) {
|
|
61
66
|
if (includes(' :'))
|
|
62
67
|
push('before-colon');
|
|
@@ -66,5 +71,8 @@ function removeSpaces(value, where) {
|
|
|
66
71
|
if (where.includes('before-colon'))
|
|
67
72
|
value = value.replace(' :', ':');
|
|
68
73
|
|
|
74
|
+
if (where.includes('double-spaces'))
|
|
75
|
+
value = value.replaceAll(' ', ' ');
|
|
76
|
+
|
|
69
77
|
return value;
|
|
70
78
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-printer",
|
|
3
|
-
"version": "8.6.
|
|
3
|
+
"version": "8.6.8",
|
|
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",
|