@putout/plugin-putout 28.17.0 → 28.18.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
@@ -17,6 +17,7 @@ npm i @putout/plugin-putout -D
17
17
  - ✅ [add-places-to-compare-places](#add-places-to-compare-places);
18
18
  - ✅ [add-path-arg-to-fix](#add-path-arg-to-fix);
19
19
  - ✅ [add-path-arg-to-visitors](#add-path-arg-to-visitors);
20
+ - ✅ [add-path-arg-to-match](#add-path-arg-to-match);
20
21
  - ✅ [add-push-arg](#add-push-arg);
21
22
  - ✅ [add-test-args](#add-test-args);
22
23
  - ✅ [add-traverse-args](#add-traverse-args);
@@ -100,6 +101,7 @@ npm i @putout/plugin-putout -D
100
101
  "rules": {
101
102
  "putout/add-places-to-compare-places": "on",
102
103
  "putout/add-path-arg-to-fix": "on",
104
+ "putout/add-path-to-match": "on",
103
105
  "putout/add-path-arg-to-visitors": "on",
104
106
  "putout/add-push-arg": "on",
105
107
  "putout/add-test-args": "on",
@@ -1403,6 +1405,36 @@ export const fix = (path) => {
1403
1405
  };
1404
1406
  ```
1405
1407
 
1408
+ ## add-path-arg-to-match
1409
+
1410
+ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/35189d0e47c6ad1ca369e5a9287a34c1/d5fa7513a44fecc86beabd1faa8542bee7bc3e5e).
1411
+
1412
+ ### ❌ Example of incorrect code
1413
+
1414
+ ```js
1415
+ export const match = () => ({
1416
+ 'nemesis.getChar()': () => {
1417
+ return path.parentPath.isExpressionStatement();
1418
+ },
1419
+ 'getChar()': ({__a}) => {
1420
+ return path.parentPath.isExpressionStatement();
1421
+ },
1422
+ });
1423
+ ```
1424
+
1425
+ ### ✅ Example of correct code
1426
+
1427
+ ```js
1428
+ export const match = () => ({
1429
+ 'nemesis.getChar()': (vars, path) => {
1430
+ return path.parentPath.isExpressionStatement();
1431
+ },
1432
+ 'getChar()': ({__a}, path) => {
1433
+ return path.parentPath.isExpressionStatement();
1434
+ },
1435
+ });
1436
+ ```
1437
+
1406
1438
  ## add-path-arg-to-visitors
1407
1439
 
1408
1440
  Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/e20eb16668b2ebbceca1a03cde859e93/fee08d6dbb6aa4d835adacc8e9de4d994fd34848).
@@ -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
+ path: ['vars, path', [
11
+ '(__a) => __body',
12
+ '() => __body',
13
+ ]],
14
+ });
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as addPathArgToMatch from './add-path-arg-to-match/index.js';
1
2
  import * as removeMessageFromNoReportAfterTransform from './remove-message-from-no-report-after-transform/index.js';
2
3
  import * as addCrawlFile from './add-crawl-file/index.js';
3
4
  import * as applyDesturcturing from './apply-desturcturing/index.js';
@@ -158,4 +159,5 @@ export const rules = {
158
159
  'apply-desturcturing': applyDesturcturing,
159
160
  'add-crawl-file': addCrawlFile,
160
161
  'remove-message-from-no-report-after-transform': removeMessageFromNoReportAfterTransform,
162
+ 'add-path-arg-to-match': addPathArgToMatch,
161
163
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "28.17.0",
3
+ "version": "28.18.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",