@putout/plugin-putout 28.18.0 → 28.19.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
@@ -37,6 +37,7 @@ npm i @putout/plugin-putout -D
37
37
  - ✅ [apply-fixture-name-to-message](#apply-fixture-name-to-message);
38
38
  - ✅ [apply-insert-after](#apply-insert-after);
39
39
  - ✅ [apply-insert-before](#apply-insert-before);
40
+ - ✅ [apply-traverser-to-ignore](#apply-traverser-to-ignore);
40
41
  - ✅ [apply-vars](#apply-vars);
41
42
  - ✅ [apply-lowercase-to-node-builders](#apply-lowercase-to-node-builders);
42
43
  - ✅ [apply-namespace-specifier](#apply-namespace-specifier);
@@ -126,6 +127,7 @@ npm i @putout/plugin-putout -D
126
127
  "putout/apply-remove": "on",
127
128
  "putout/apply-transform-with-options": "on",
128
129
  "putout/apply-insert-before": "on",
130
+ "putout/apply-traverser-to-ignore": "on",
129
131
  "putout/apply-insert-after": "on",
130
132
  "putout/apply-vars": "on",
131
133
  "putout/apply-short-processors": "on",
@@ -446,6 +448,40 @@ export const fix = (path) => {
446
448
  };
447
449
  ```
448
450
 
451
+ ## apply-traverser-to-ignore
452
+
453
+ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/ff74cf775696df17a5ba96c7ec309821/1cbdee25af883ccefd0a3614fe8424d8690fc58a).
454
+
455
+ ### ❌ Example of incorrect code
456
+
457
+ ```js
458
+ export const {
459
+ report,
460
+ match,
461
+ replace,
462
+ } = ignore({
463
+ type: __json,
464
+ name: '.nycrc.json',
465
+ field: 'exclude',
466
+ list: ['*.config.*'],
467
+ });
468
+ ```
469
+
470
+ ### ✅ Example of correct code
471
+
472
+ ```js
473
+ export const {
474
+ report,
475
+ fix,
476
+ traverse,
477
+ } = ignore({
478
+ type: __json,
479
+ name: '.nycrc.json',
480
+ field: 'exclude',
481
+ list: ['*.config.*'],
482
+ });
483
+ ```
484
+
449
485
  ## apply-vars
450
486
 
451
487
  Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/6b1a4b5dc75f2591faf580774d23b38f/7278945371ceb76942494f7caf88375d2eaca869).
@@ -0,0 +1,21 @@
1
+ export const report = () => `Use 'Traverser' instead of 'Replacer'`;
2
+
3
+ const getName = ({key}) => key.name;
4
+ const TRAVERSER = new Set([
5
+ 'report',
6
+ 'fix',
7
+ 'traverse',
8
+ ]);
9
+
10
+ export const match = () => ({
11
+ 'export const __object = ignore(__args)': ({__object}) => {
12
+ const names = new Set(__object.properties.map(getName));
13
+ const diff = TRAVERSER.difference(names);
14
+
15
+ return diff.size;
16
+ },
17
+ });
18
+
19
+ export const replace = () => ({
20
+ 'export const __object = ignore(__args)': 'export const {report, fix, traverse} = ignore(__args)',
21
+ });
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as applyTraverserToIgnore from './apply-traverser-to-ignore/index.js';
1
2
  import * as addPathArgToMatch from './add-path-arg-to-match/index.js';
2
3
  import * as removeMessageFromNoReportAfterTransform from './remove-message-from-no-report-after-transform/index.js';
3
4
  import * as addCrawlFile from './add-crawl-file/index.js';
@@ -160,4 +161,5 @@ export const rules = {
160
161
  'add-crawl-file': addCrawlFile,
161
162
  'remove-message-from-no-report-after-transform': removeMessageFromNoReportAfterTransform,
162
163
  'add-path-arg-to-match': addPathArgToMatch,
164
+ 'apply-traverser-to-ignore': applyTraverserToIgnore,
163
165
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "28.18.0",
3
+ "version": "28.19.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",