@putout/plugin-putout 28.11.0 → 28.13.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
@@ -25,6 +25,7 @@ npm i @putout/plugin-putout -D
25
25
  - ✅ [apply-create-test](#apply-create-test);
26
26
  - ✅ [apply-create-nested-directory](#apply-create-nested-directory);
27
27
  - ✅ [apply-declare](#apply-declare);
28
+ - ✅ [apply-destructuring](#apply-destructuring);
28
29
  - ✅ [apply-engine-node-version](#apply-engine-node-version);
29
30
  - ✅ [apply-exports](#apply-exports);
30
31
  - ✅ [apply-exports-to-add-args](#apply-exports-to-add-args);
@@ -53,6 +54,7 @@ npm i @putout/plugin-putout -D
53
54
  - ✅ [convert-dirname-to-url](#convert-dirname-to-url);
54
55
  - ✅ [convert-find-to-traverse](#convert-find-to-traverse);
55
56
  - ✅ [convert-get-rule-to-require](#convert-get-rule-to-require);
57
+ - ✅ [convert-get-file-content-to-read-file-content](#convert-get-file-content-to-read-file-content);
56
58
  - ✅ [convert-match-to-function](#convert-match-to-function);
57
59
  - ✅ [convert-method-to-property](#convert-method-to-property);
58
60
  - ✅ [convert-node-to-path-in-get-template-values](#convert-node-to-path-in-get-template-values);
@@ -106,6 +108,7 @@ npm i @putout/plugin-putout -D
106
108
  "putout/apply-create-nested-directory": "on",
107
109
  "putout/apply-async-formatter": "on",
108
110
  "putout/apply-declare": "on",
111
+ "putout/apply-destructuring": "on",
109
112
  "putout/apply-engine-node-version": "off",
110
113
  "putout/apply-exports": "off",
111
114
  "putout/apply-exports-to-add-args": "on",
@@ -152,6 +155,7 @@ npm i @putout/plugin-putout -D
152
155
  "putout/convert-url-to-dirname": "on",
153
156
  "putout/convert-report-to-function": "on",
154
157
  "putout/convert-get-rule-to-require": "on",
158
+ "putout/convert-get-file-content-to-read-file-content": "on",
155
159
  "putout/convert-progress-to-track-file": "on",
156
160
  "putout/convert-plugins-element-to-tuple": "on",
157
161
  "putout/convert-push-object-to-push-path": "on",
@@ -498,6 +502,22 @@ module.exports.declare = () => ({
498
502
  });
499
503
  ```
500
504
 
505
+ ## apply-destructuring
506
+
507
+ Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/16fb7b414f23b9ed81bef4f5275d921e/e12e3a7c57868e623b2c11d19de1adbf1f5e3569).
508
+
509
+ ### ❌ Example of incorrect code
510
+
511
+ ```js
512
+ const putout = require('putout');
513
+ ```
514
+
515
+ ### ✅ Example of correct code
516
+
517
+ ```js
518
+ const {putout} = require('putout');
519
+ ```
520
+
501
521
  ## apply-engine-node-version
502
522
 
503
523
  Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/7ed4860732476de489ae149c7f09e2fe/d8b6e131596c0888ec8b99d4728cd999b17165c9).
@@ -1724,6 +1744,24 @@ module.exports.rules = {
1724
1744
  };
1725
1745
  ```
1726
1746
 
1747
+ ## convert-get-file-content-to-read-file-content
1748
+
1749
+ To read file content use [`readFileContent`](https://github.com/coderaiser/putout/tree/master/packages/operator-filesystem#readfilecontentfilepath-filepath-string) and never confuse.
1750
+
1751
+ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/828da75f16a526652b138948d810ed9e/754bd02869a7e4e119e9fb442dab93df7785fb56).
1752
+
1753
+ ### ❌ Example of incorrect code
1754
+
1755
+ ```js
1756
+ const content = getFileContent(file);
1757
+ ```
1758
+
1759
+ ### ✅ Example of correct code
1760
+
1761
+ ```js
1762
+ const content = readFileContent(file);
1763
+ ```
1764
+
1727
1765
  ## move-require-on-top-level
1728
1766
 
1729
1767
  ### ❌ Example of incorrect code
@@ -0,0 +1,5 @@
1
+ export const report = () => `Destructure 'putout' in CommonJS`;
2
+
3
+ export const replace = () => ({
4
+ 'const putout = require("putout")': 'const {putout} = require("putout")',
5
+ });
@@ -0,0 +1,5 @@
1
+ export const report = () => `To read file content use 'readFileContent' instead of 'getFileContent'`;
2
+
3
+ export const replace = () => ({
4
+ 'getFileContent(__a)': 'readFileContent(__a)',
5
+ });
package/lib/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import * as applyDesturcturing from './apply-desturcturing/index.js';
2
+ import * as convertGetFileContentToReadFileContent from './convert-get-file-content-to-read-file-content/index.js';
1
3
  import * as addPushArg from './add-push-arg/index.js';
2
4
  import * as convertReplaceToTraverse from './convert-replace-to-traverse/index.js';
3
5
  import * as applyEngineNodeVersion from './apply-engine-node-version/index.js';
@@ -150,4 +152,6 @@ export const rules = {
150
152
  'apply-engine-node-version': applyEngineNodeVersion,
151
153
  'convert-replace-to-traverse': convertReplaceToTraverse,
152
154
  'add-push-arg': addPushArg,
155
+ 'convert-get-file-content-to-read-file-content': convertGetFileContentToReadFileContent,
156
+ 'apply-desturcturing': applyDesturcturing,
153
157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "28.11.0",
3
+ "version": "28.13.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",