@putout/plugin-putout 28.6.0 → 28.7.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.
@@ -5,18 +5,22 @@ const {compare} = operator;
5
5
  export const report = () => `Use 'traverse' instead of 'replace' when using 'fix'`;
6
6
 
7
7
  export const match = () => ({
8
- 'export const replace = __a': (vars, path) => {
9
- const {body} = path.scope.getProgramParent().path.node;
10
-
11
- for (const current of body) {
12
- if (compare(current, 'export const fix = __a'))
13
- return true;
14
- }
15
-
16
- return false;
17
- },
8
+ 'export const replace = __a': contains('export const fix = __a'),
9
+ 'module.exports.replace = __a': contains('module.exports.fix = __a'),
18
10
  });
19
11
 
20
12
  export const replace = () => ({
21
13
  'export const replace = __a': 'export const traverse = __a',
14
+ 'module.exports.replace = __a': 'module.exports.traverse = __a',
22
15
  });
16
+
17
+ const contains = (template) => (vars, path) => {
18
+ const {body} = path.scope.getProgramParent().path.node;
19
+
20
+ for (const current of body) {
21
+ if (compare(current, template))
22
+ return true;
23
+ }
24
+
25
+ return false;
26
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "28.6.0",
3
+ "version": "28.7.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with plugins development",