@putout/plugin-putout 22.4.0 → 22.5.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
@@ -28,6 +28,7 @@ npm i @putout/plugin-putout -D
28
28
  - ✅ [apply-fixture-name-to-message](#apply-fixture-name-to-message);
29
29
  - ✅ [apply-insert-after](#apply-insert-after);
30
30
  - ✅ [apply-insert-before](#apply-insert-before);
31
+ - ✅ [apply-vars](#apply-vars);
31
32
  - ✅ [apply-namespace-specifier](#apply-namespace-specifier);
32
33
  - ✅ [apply-processors-destructuring](#apply-processors-destructuring);
33
34
  - ✅ [apply-remove](#apply-remove);
@@ -92,6 +93,7 @@ npm i @putout/plugin-putout -D
92
93
  "putout/apply-remove": "on",
93
94
  "putout/apply-insert-before": "on",
94
95
  "putout/apply-insert-after": "on",
96
+ "putout/apply-vars": "on",
95
97
  "putout/apply-short-processors": "on",
96
98
  "putout/apply-namespace-specifier": "on",
97
99
  "putout/apply-for-of-to-track-file": "on",
@@ -283,6 +285,42 @@ export const fix = (path) => {
283
285
  };
284
286
  ```
285
287
 
288
+ ## apply-vars
289
+
290
+ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/f96aaef6c54049ca91497a17f7a4b88a/b960916e73a7f51c1c0425ad9a3f304452c0d159).
291
+
292
+ ### ❌ Example of incorrect code
293
+
294
+ ```js
295
+ export const replace = () => ({
296
+ '__a(__args': ({}, path) => {
297
+ return true;
298
+ },
299
+ });
300
+
301
+ export const match = () => ({
302
+ '__a(__args': ({}, path) => {
303
+ return '';
304
+ },
305
+ });
306
+ ```
307
+
308
+ ### ✅ Example of correct code
309
+
310
+ ```js
311
+ export const replace = () => ({
312
+ '__a(__args': (vars, path) => {
313
+ return true;
314
+ },
315
+ });
316
+
317
+ export const match = () => ({
318
+ '__a(__args': (vars, path) => {
319
+ return '';
320
+ },
321
+ });
322
+ ```
323
+
286
324
  ## apply-declare
287
325
 
288
326
  Better to use [`Declareator`](https://github.com/coderaiser/putout/tree/master/packages/engine-runner#declarator) instead of `operator.declare()`.
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ module.exports.report = () => `Use 'var' instead of '{}'`;
4
+
5
+ module.exports.replace = () => ({
6
+ '({}, path) => __body': '(vars, path) => __body',
7
+ });
package/lib/index.js CHANGED
@@ -57,6 +57,7 @@ const convertIncludeToTraverse = require('./convert-include-to-traverse');
57
57
  const removeUselessPrinterOption = require('./remove-useless-printer-option');
58
58
  const addPathArgToVisitors = require('./add-path-arg-to-visitors');
59
59
  const applyFixtureNameToMessage = require('./apply-fixture-name-to-message');
60
+ const applyVars = require('./apply-vars');
60
61
 
61
62
  module.exports.rules = {
62
63
  'apply-processors-destructuring': applyProcessorsDestructuring,
@@ -116,4 +117,5 @@ module.exports.rules = {
116
117
  'remove-useless-printer-option': removeUselessPrinterOption,
117
118
  'add-path-arg-to-visitors': addPathArgToVisitors,
118
119
  'apply-fixture-name-to-message': applyFixtureNameToMessage,
120
+ 'apply-vars': applyVars,
119
121
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "22.4.0",
3
+ "version": "22.5.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with plugins development",
@@ -39,8 +39,7 @@
39
39
  "keywords": [
40
40
  "putout",
41
41
  "putout-plugin",
42
- "plugin",
43
- "putout"
42
+ "plugin"
44
43
  ],
45
44
  "devDependencies": {
46
45
  "@putout/plugin-nodejs": "*",