@putout/plugin-putout 28.12.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);
@@ -107,6 +108,7 @@ npm i @putout/plugin-putout -D
107
108
  "putout/apply-create-nested-directory": "on",
108
109
  "putout/apply-async-formatter": "on",
109
110
  "putout/apply-declare": "on",
111
+ "putout/apply-destructuring": "on",
110
112
  "putout/apply-engine-node-version": "off",
111
113
  "putout/apply-exports": "off",
112
114
  "putout/apply-exports-to-add-args": "on",
@@ -500,6 +502,22 @@ module.exports.declare = () => ({
500
502
  });
501
503
  ```
502
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
+
503
521
  ## apply-engine-node-version
504
522
 
505
523
  Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/7ed4860732476de489ae149c7f09e2fe/d8b6e131596c0888ec8b99d4728cd999b17165c9).
@@ -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
+ });
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as applyDesturcturing from './apply-desturcturing/index.js';
1
2
  import * as convertGetFileContentToReadFileContent from './convert-get-file-content-to-read-file-content/index.js';
2
3
  import * as addPushArg from './add-push-arg/index.js';
3
4
  import * as convertReplaceToTraverse from './convert-replace-to-traverse/index.js';
@@ -152,4 +153,5 @@ export const rules = {
152
153
  'convert-replace-to-traverse': convertReplaceToTraverse,
153
154
  'add-push-arg': addPushArg,
154
155
  'convert-get-file-content-to-read-file-content': convertGetFileContentToReadFileContent,
156
+ 'apply-desturcturing': applyDesturcturing,
155
157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "28.12.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",