@putout/plugin-putout 28.12.0 → 28.14.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
@@ -20,11 +20,13 @@ npm i @putout/plugin-putout -D
20
20
  - ✅ [add-push-arg](#add-push-arg);
21
21
  - ✅ [add-test-args](#add-test-args);
22
22
  - ✅ [add-traverse-args](#add-traverse-args);
23
+ - ✅ [add-crawl-file](#add-crawl-file);
23
24
  - ✅ [add-track-file](#add-track-file);
24
25
  - ✅ [apply-async-formatter](#apply-async-formatter);
25
26
  - ✅ [apply-create-test](#apply-create-test);
26
27
  - ✅ [apply-create-nested-directory](#apply-create-nested-directory);
27
28
  - ✅ [apply-declare](#apply-declare);
29
+ - ✅ [apply-destructuring](#apply-destructuring);
28
30
  - ✅ [apply-engine-node-version](#apply-engine-node-version);
29
31
  - ✅ [apply-exports](#apply-exports);
30
32
  - ✅ [apply-exports-to-add-args](#apply-exports-to-add-args);
@@ -101,12 +103,14 @@ npm i @putout/plugin-putout -D
101
103
  "putout/add-push-arg": "on",
102
104
  "putout/add-test-args": "on",
103
105
  "putout/add-traverse-args": "on",
106
+ "putout/add-crawl-file": "on",
104
107
  "putout/add-track-file": "on",
105
108
  "putout/add-await-to-progress": "on",
106
109
  "putout/apply-create-test": "on",
107
110
  "putout/apply-create-nested-directory": "on",
108
111
  "putout/apply-async-formatter": "on",
109
112
  "putout/apply-declare": "on",
113
+ "putout/apply-destructuring": "on",
110
114
  "putout/apply-engine-node-version": "off",
111
115
  "putout/apply-exports": "off",
112
116
  "putout/apply-exports-to-add-args": "on",
@@ -500,6 +504,22 @@ module.exports.declare = () => ({
500
504
  });
501
505
  ```
502
506
 
507
+ ## apply-destructuring
508
+
509
+ Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/16fb7b414f23b9ed81bef4f5275d921e/e12e3a7c57868e623b2c11d19de1adbf1f5e3569).
510
+
511
+ ### ❌ Example of incorrect code
512
+
513
+ ```js
514
+ const putout = require('putout');
515
+ ```
516
+
517
+ ### ✅ Example of correct code
518
+
519
+ ```js
520
+ const {putout} = require('putout');
521
+ ```
522
+
503
523
  ## apply-engine-node-version
504
524
 
505
525
  Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/7ed4860732476de489ae149c7f09e2fe/d8b6e131596c0888ec8b99d4728cd999b17165c9).
@@ -1562,6 +1582,26 @@ test('', async ({progress}) => {
1562
1582
  });
1563
1583
  ```
1564
1584
 
1585
+ ## add-crawl-file
1586
+
1587
+ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/4faf27234e9c5616444d0cabd79f00be/aac768e7150635d96cd71507e4a6eb43d0899814).
1588
+
1589
+ ### ❌ Example of incorrect code
1590
+
1591
+ ```js
1592
+ export const scan = (root, {push, progress}) => {
1593
+ crawlFile();
1594
+ };
1595
+ ```
1596
+
1597
+ ### ✅ Example of correct code
1598
+
1599
+ ```js
1600
+ export const scan = (root, {push, progress, crawlFile}) => {
1601
+ crawlFile();
1602
+ };
1603
+ ```
1604
+
1565
1605
  ## add-track-file
1566
1606
 
1567
1607
  Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/faaba1ce41e6fd274bc82a8875a52bfa/b34a22fdf9080e6b2f06703760f629d83d69ff3d).
@@ -0,0 +1,14 @@
1
+ import {operator} from 'putout';
2
+
3
+ const {addArgs} = operator;
4
+
5
+ export const {
6
+ report,
7
+ fix,
8
+ traverse,
9
+ } = addArgs({
10
+ crawlFile: ['{crawlFile}', [
11
+ '(__a, __b) => __body',
12
+ '(__a) => __body',
13
+ ]],
14
+ });
@@ -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
+ });
@@ -16,7 +16,11 @@ export const fix = ({path}) => {
16
16
 
17
17
  export const traverse = ({push, options}) => ({
18
18
  [__json]: (path) => {
19
- const {nodeVersion = 22, putoutVersion = 41} = options;
19
+ const {
20
+ nodeVersion = 22,
21
+ putoutVersion = 41,
22
+ } = options;
23
+
20
24
  const __aPath = path.get('arguments.0');
21
25
  const {
22
26
  peerDependenciesPath,
package/lib/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import * as addCrawlFile from './add-crawl-file/index.js';
2
+ import * as applyDesturcturing from './apply-desturcturing/index.js';
1
3
  import * as convertGetFileContentToReadFileContent from './convert-get-file-content-to-read-file-content/index.js';
2
4
  import * as addPushArg from './add-push-arg/index.js';
3
5
  import * as convertReplaceToTraverse from './convert-replace-to-traverse/index.js';
@@ -152,4 +154,6 @@ export const rules = {
152
154
  'convert-replace-to-traverse': convertReplaceToTraverse,
153
155
  'add-push-arg': addPushArg,
154
156
  'convert-get-file-content-to-read-file-content': convertGetFileContentToReadFileContent,
157
+ 'apply-desturcturing': applyDesturcturing,
158
+ 'add-crawl-file': addCrawlFile,
155
159
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "28.12.0",
3
+ "version": "28.14.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",