@putout/plugin-putout 23.13.0 → 23.14.1

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
@@ -32,6 +32,7 @@ npm i @putout/plugin-putout -D
32
32
  - ✅ [apply-vars](#apply-vars);
33
33
  - ✅ [apply-lowercase-to-node-builders](#apply-lowercase-to-node-builders);
34
34
  - ✅ [apply-namespace-specifier](#apply-namespace-specifier);
35
+ - ✅ [apply-report](#apply-report);
35
36
  - ✅ [apply-processors-destructuring](#apply-processors-destructuring);
36
37
  - ✅ [apply-remove](#apply-remove);
37
38
  - ✅ [apply-rename](#apply-rename);
@@ -95,6 +96,7 @@ npm i @putout/plugin-putout -D
95
96
  "putout/apply-create-nested-directory": "on",
96
97
  "putout/apply-async-formatter": "on",
97
98
  "putout/apply-declare": "on",
99
+ "putout/apply-report": "on",
98
100
  "putout/apply-processors-destructuring": "on",
99
101
  "putout/apply-rename": "on",
100
102
  "putout/apply-parens": "on",
@@ -166,6 +168,56 @@ path.node = Identifier('x');
166
168
  path.node = identifier('x');
167
169
  ```
168
170
 
171
+ ## apply-report
172
+
173
+ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/e9debc0b256556a632fb031be86afffc/afefbd44443f07dbb7d8f2972f2e40a9a82c214f).
174
+
175
+ ### ❌ Example of incorrect code
176
+
177
+ ```js
178
+ t.noReport('rename-files-full', {
179
+ from: ['/'],
180
+ to: [],
181
+ });
182
+
183
+ t.noReportWithOptions('rename-files-full');
184
+
185
+ t.noReport('a', 'Use b');
186
+ t.report('a');
187
+ ```
188
+
189
+ ### ✅ Example of correct code
190
+
191
+ ```js
192
+ t.noReportWithOptions('rename-files-full', {
193
+ from: ['/'],
194
+ to: [],
195
+ });
196
+
197
+ t.noReport('rename-files-full');
198
+
199
+ t.report('a', 'Use b');
200
+ t.noReport('a');
201
+ ```
202
+
203
+ ## apply-processors-destructuring
204
+
205
+ ### ❌ Example of incorrect code
206
+
207
+ ```js
208
+ test('', async (t) => {
209
+ await t.process({});
210
+ });
211
+ ```
212
+
213
+ ### ✅ Example of correct code
214
+
215
+ ```js
216
+ test('', async ({process}) => {
217
+ await process({});
218
+ });
219
+ ```
220
+
169
221
  ## apply-processors-destructuring
170
222
 
171
223
  ### ❌ Example of incorrect code
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ const {operator} = require('putout');
4
+ const {compare} = operator;
5
+ const TYPES = {
6
+ noReport: 'noReportWithOptions',
7
+ report: 'noReport',
8
+ noReportWithOptions: 'noReport',
9
+ };
10
+
11
+ module.exports.report = (path) => {
12
+ const {name} = path.node.callee.property;
13
+
14
+ if (compare(path, 't.noReport(__a, "__b")'))
15
+ return `Use 't.noReport(__a)' instead of 't.noReport(__a, "__b")'`;
16
+
17
+ if (compare(path, 't.noReportWithOptions(__a, "__b", __c)'))
18
+ return `Use 't.noReportWithOptions(__a, __c)' instead of 't.noReportWithOptions(__a, "__b", __c)'`;
19
+
20
+ return `Use '${TYPES[name]}()' instead of '${name}()'`;
21
+ };
22
+
23
+ module.exports.replace = () => ({
24
+ 't.noReport(__a, __object)': 't.noReportWithOptions(__a, __object)',
25
+ 't.noReport(__a, "__b")': 't.noReport(__a)',
26
+ 't.report(__a)': 't.noReport(__a)',
27
+ 't.noReportWithOptions(__a)': 't.noReport(__a)',
28
+ 't.noReportWithOptions(__a, "__b", __c)': 't.noReportWithOptions(__a, __c)',
29
+ });
package/lib/index.js CHANGED
@@ -64,6 +64,7 @@ const declarePathVariable = require('./declare-path-variable');
64
64
  const applyParens = require('./apply-parens');
65
65
  const applyLowercaseToNodeBuilders = require('./apply-lowercase-to-node-builders');
66
66
  const applyCreateNestedDirectory = require('./apply-create-nested-directory');
67
+ const applyReport = require('./apply-report');
67
68
 
68
69
  module.exports.rules = {
69
70
  'apply-processors-destructuring': applyProcessorsDestructuring,
@@ -130,4 +131,5 @@ module.exports.rules = {
130
131
  'apply-parens': applyParens,
131
132
  'apply-lowercase-to-node-builders': applyLowercaseToNodeBuilders,
132
133
  'apply-create-nested-directory': applyCreateNestedDirectory,
134
+ 'apply-report': applyReport,
133
135
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "23.13.0",
3
+ "version": "23.14.1",
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",