@putout/plugin-printer 8.6.1 → 8.6.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.
@@ -13,13 +13,17 @@ const ARROW_NOT_LENGTH = ARROW_NOT.length;
13
13
  const MARK = '🧨';
14
14
  const NOT = '!';
15
15
 
16
+ const TYPES = new Set([
17
+ 'CommentBlock',
18
+ ]);
19
+
16
20
  export const report = ({type}) => {
17
21
  return `Unknown type detected: '${type}'`;
18
22
  };
19
23
 
20
24
  export const fix = ({path, type}) => {
21
25
  const {value} = path.node;
22
- setLiteralValue(path, value.replace(type, `${MARK} ${type}`));
26
+ setLiteralValue(path, value.replace(type, `${MARK}${type}`));
23
27
  };
24
28
 
25
29
  export const traverse = ({push}) => ({
@@ -46,7 +50,7 @@ export const traverse = ({push}) => ({
46
50
 
47
51
  const type = value.slice(typeNotIndex, value.length);
48
52
 
49
- if (!types[`is${type}`])
53
+ if (!isExists(type))
50
54
  push({
51
55
  path,
52
56
  type,
@@ -60,10 +64,17 @@ export const traverse = ({push}) => ({
60
64
 
61
65
  const type = value.slice(typeIndex, value.length);
62
66
 
63
- if (!types[`is${type}`])
67
+ if (!isExists(type))
64
68
  push({
65
69
  path,
66
70
  type,
67
71
  });
68
72
  },
69
73
  });
74
+
75
+ function isExists(type) {
76
+ if (types[`is${type}`])
77
+ return true;
78
+
79
+ return TYPES.has(type);
80
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-printer",
3
- "version": "8.6.1",
3
+ "version": "8.6.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",