@putout/plugin-putout 21.5.0 → 21.6.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.
package/README.md CHANGED
@@ -51,6 +51,7 @@ npm i @putout/plugin-putout -D
51
51
  - ✅ [convert-replace-with-multiple](#convert-replace-with-multiple);
52
52
  - ✅ [convert-report-to-function](#convert-report-to-function);
53
53
  - ✅ [convert-to-no-transform-code](#convert-to-no-transform-code);
54
+ - ✅ [convert-include-to-traverse](#convert-include-to-traverse);
54
55
  - ✅ [convert-traverse-to-include](#convert-traverse-to-include);
55
56
  - ✅ [convert-traverse-to-replace](#convert-traverse-to-replace);
56
57
  - ✅ [convert-traverse-to-scan](#convert-traverse-to-scan);
@@ -104,6 +105,7 @@ npm i @putout/plugin-putout -D
104
105
  "putout/convert-babel-types": "on",
105
106
  "putout/convert-destructuring-to-identifier": "on",
106
107
  "putout/convert-node-to-path-in-get-template-values": "on",
108
+ "putout/convert-include-to-traverse": "on",
107
109
  "putout/convert-traverse-to-include": "on",
108
110
  "putout/convert-traverse-to-replace": "on",
109
111
  "putout/convert-traverse-to-scan": "on",
@@ -623,6 +625,26 @@ const parseOptions = require('putout/lib/parse-options');
623
625
  const parseOptions = require('putout/parse-options');
624
626
  ```
625
627
 
628
+ ## convert-include-to-traverse
629
+
630
+ Checkout in 🐊[**Putout Editor*](https://putout.cloudcmd.io/#/gist/a41b5c943a74b59a6c18f31fc6d31937/d79c6084f49b6444536840bc2fc1fba725ba83f8).
631
+
632
+ ### ❌ Example of incorrect code
633
+
634
+ ```js
635
+ export const include = () => ({
636
+ ClassDeclaration(path) {},
637
+ });
638
+ ```
639
+
640
+ ### ✅ Example of correct code
641
+
642
+ ```js
643
+ export const traverse = () => ({
644
+ ClassDeclaration(path) {},
645
+ });
646
+ ```
647
+
626
648
  ## convert-traverse-to-include
627
649
 
628
650
  ### ❌ Example of incorrect code
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ const {types} = require('putout');
4
+ const {isObjectExpression} = types;
5
+
6
+ module.exports.report = () => `Use 'traverse' instead of 'include'`;
7
+
8
+ const check = ({__a}) => {
9
+ return isObjectExpression(__a.body);
10
+ };
11
+
12
+ module.exports.match = () => ({
13
+ 'const include = __a': check,
14
+ 'module.exports.include = __a': check,
15
+ });
16
+
17
+ module.exports.replace = () => ({
18
+ 'const include = __a': 'const traverse = __a',
19
+ 'module.exports.include = __a': 'module.exports.traverse = __a',
20
+ });
package/lib/index.js CHANGED
@@ -53,6 +53,7 @@ const simplifyReplaceTemplate = require('./simplify-replace-template');
53
53
  const removeEmptyArrayFromProcess = require('./remove-empty-array-from-process');
54
54
  const addPlacesToComparePlaces = require('./add-places-to-compare-places');
55
55
  const addPathArgToFix = require('./add-path-arg-to-fix');
56
+ const convertIncludeToTraverse = require('./convert-include-to-traverse');
56
57
 
57
58
  module.exports.rules = {
58
59
  'apply-processors-destructuring': applyProcessorsDestructuring,
@@ -108,4 +109,5 @@ module.exports.rules = {
108
109
  'remove-empty-array-from-process': removeEmptyArrayFromProcess,
109
110
  'add-places-to-compare-places': addPlacesToComparePlaces,
110
111
  'add-path-arg-to-fix': addPathArgToFix,
112
+ 'convert-include-to-traverse': convertIncludeToTraverse,
111
113
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "21.5.0",
3
+ "version": "21.6.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with plugins development",