@putout/plugin-printer 8.0.2 → 8.1.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.
|
@@ -9,18 +9,37 @@ const {
|
|
|
9
9
|
export const report = () => `Avoid useless 'maybe'`;
|
|
10
10
|
|
|
11
11
|
export const match = () => ({
|
|
12
|
+
'maybe.indent.__a(!__b)': (vars, path) => {
|
|
13
|
+
const next = path.parentPath.getNextSibling();
|
|
14
|
+
|
|
15
|
+
if (!compare(next, 'maybe.indent.__a(__b)'))
|
|
16
|
+
return false;
|
|
17
|
+
|
|
18
|
+
const {__a, __b} = getTemplateValues(next, 'maybe.indent.__a(__b)');
|
|
19
|
+
|
|
20
|
+
if (!compare(__a, vars.__a))
|
|
21
|
+
return false;
|
|
22
|
+
|
|
23
|
+
return compare(__b, vars.__b);
|
|
24
|
+
},
|
|
12
25
|
'maybe.print.linebreak(__a)': (vars, path) => {
|
|
13
26
|
const next = path.parentPath.getNextSibling();
|
|
14
27
|
|
|
15
28
|
if (!compare(next, 'maybe.print.newline(!__a)'))
|
|
16
29
|
return false;
|
|
17
30
|
|
|
18
|
-
const {__a} = getTemplateValues(
|
|
31
|
+
const {__a} = getTemplateValues(next, 'maybe.print.newline(!__a)');
|
|
19
32
|
|
|
20
33
|
return compare(__a, vars.__a);
|
|
21
34
|
},
|
|
22
35
|
});
|
|
23
36
|
export const replace = () => ({
|
|
37
|
+
'maybe.indent.__a(!__b)': (vars, path) => {
|
|
38
|
+
const next = path.parentPath.getNextSibling();
|
|
39
|
+
remove(next);
|
|
40
|
+
|
|
41
|
+
return 'indent.__a()';
|
|
42
|
+
},
|
|
24
43
|
'maybe.print.linebreak(__a)': (vars, path) => {
|
|
25
44
|
const next = path.parentPath.getNextSibling();
|
|
26
45
|
remove(next);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-printer",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.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",
|