@putout/plugin-printer 8.7.0 → 8.7.2
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/README.md
CHANGED
|
@@ -292,7 +292,7 @@ When you have only negative branch defined in type checker it never never succee
|
|
|
292
292
|
|
|
293
293
|
Consider adding success branch, or remove type checker.
|
|
294
294
|
|
|
295
|
-
☝️ *This rule has no autofix,
|
|
295
|
+
☝️ *This rule has no autofix, because most likely tests will fail after auto fix,
|
|
296
296
|
and instead of observing code with a problem, you will first see failed tests,
|
|
297
297
|
and then after some searches determine that there is a wrong auto fix.*
|
|
298
298
|
|
|
@@ -334,7 +334,7 @@ const isSimpleAfterObject = createTypeChecker([
|
|
|
334
334
|
|
|
335
335
|
Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/9b35f5f2f23bece832f0f87c929d30e2/b08df8ef8ce6c2a03bceebe6119846c45a78a119).
|
|
336
336
|
|
|
337
|
-
☝️ *This rule has no autofix,
|
|
337
|
+
☝️ *This rule has no autofix, because most likely tests will fail after auto fix,
|
|
338
338
|
and instead of observing code with a problem, you will first see failed tests,
|
|
339
339
|
and then after some searches determine that there is a wrong auto fix.*
|
|
340
340
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import process from 'node:process';
|
|
2
1
|
import {operator, types} from 'putout';
|
|
3
2
|
import {createTypeChecker} from '@putout/printer/type-checker';
|
|
4
3
|
|
|
@@ -15,7 +14,7 @@ const {replaceWith} = operator;
|
|
|
15
14
|
|
|
16
15
|
const hasResult = (value) => /^[+-]/.test(value);
|
|
17
16
|
const typeOptions = {
|
|
18
|
-
|
|
17
|
+
instrumentName: 'PUTOUT_INSTRUMENT',
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
const isDsl = createTypeChecker([
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {types} from 'putout';
|
|
2
2
|
|
|
3
|
+
const addQuotes = (a) => `'${a}'`;
|
|
3
4
|
const {
|
|
4
5
|
isIdentifier,
|
|
5
6
|
isCallExpression,
|
|
@@ -11,12 +12,30 @@ const ARROW_LENGTH = ARROW.length;
|
|
|
11
12
|
const ARROW_NOT_LENGTH = ARROW_NOT.length;
|
|
12
13
|
const NOT = '!';
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
+
const TYPES_EXISTS = new Set([
|
|
15
16
|
'CommentBlock',
|
|
16
17
|
]);
|
|
17
18
|
|
|
19
|
+
const TYPES_NOT_EXISTS = new Set([
|
|
20
|
+
'ExportDeclaration',
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
const INSTEAD = new Map([
|
|
24
|
+
['ExportDeclaration', [
|
|
25
|
+
'ExportAllDeclaration',
|
|
26
|
+
'ExportDefaultDeclaration',
|
|
27
|
+
'ExportNamedDeclaration',
|
|
28
|
+
]],
|
|
29
|
+
]);
|
|
30
|
+
|
|
18
31
|
export const report = ({type}) => {
|
|
19
|
-
|
|
32
|
+
if (!INSTEAD.has(type))
|
|
33
|
+
return `Unknown type detected: '${type}'`;
|
|
34
|
+
|
|
35
|
+
const instead = INSTEAD.get(type).map(addQuotes)
|
|
36
|
+
.join(', ');
|
|
37
|
+
|
|
38
|
+
return `Unknown type detected: '${type}'. Use ${instead} instead`;
|
|
20
39
|
};
|
|
21
40
|
|
|
22
41
|
export const fix = () => {};
|
|
@@ -72,8 +91,11 @@ export const traverse = ({push}) => ({
|
|
|
72
91
|
});
|
|
73
92
|
|
|
74
93
|
function isExists(type) {
|
|
94
|
+
if (TYPES_NOT_EXISTS.has(type))
|
|
95
|
+
return false;
|
|
96
|
+
|
|
75
97
|
if (types[`is${type}`])
|
|
76
98
|
return true;
|
|
77
99
|
|
|
78
|
-
return
|
|
100
|
+
return TYPES_EXISTS.has(type);
|
|
79
101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-printer",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.2",
|
|
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",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"madrun": "^13.0.0",
|
|
46
46
|
"montag": "^1.2.1",
|
|
47
47
|
"nodemon": "^3.0.1",
|
|
48
|
-
"superc8": "^12.0.0"
|
|
48
|
+
"superc8": "^12.0.0",
|
|
49
|
+
"supertape": "^12.7.0"
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {
|
|
51
52
|
"putout": ">=42",
|