@putout/plugin-putout 11.3.0 → 11.6.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
@@ -38,6 +38,7 @@ npm i @putout/plugin-putout -D
38
38
  "putout/convert-add-argument-to-add-args": "on",
39
39
  "putout/convert-dirname-to-url": "on",
40
40
  "putout/convert-url-to-dirname": "on",
41
+ "putout/convert-report-to-function": "on",
41
42
  "putout/shorten-imports": "on",
42
43
  "putout/check-replace-code": "on",
43
44
  "putout/declare": "on",
@@ -558,6 +559,20 @@ const test = createTest(import.meta.url, {
558
559
  });
559
560
  ```
560
561
 
562
+ ## convert-report-to-function
563
+
564
+ ### ❌ Example of incorrect code
565
+
566
+ ```js
567
+ module.exports.report = `'report' should be a 'function'`;
568
+ ```
569
+
570
+ ### ✅ Example of correct code
571
+
572
+ ```js
573
+ module.exports.report = () => `'report' should be a 'function'`;
574
+ ```
575
+
561
576
  ## move-require-on-top-level
562
577
 
563
578
  ### ❌ Example of incorrect code
@@ -10,11 +10,19 @@ module.exports = addArgs({
10
10
  'test.only("__a", async (__args) => __body)',
11
11
  ],
12
12
  ],
13
+
13
14
  process: ['{process}', [
14
15
  'test("__a", async (__args) => __body)',
15
16
  'test.skip("__a", async (__args) => __body)',
16
17
  'test.only("__a", async (__args) => __body)',
17
18
  ],
18
19
  ],
20
+
21
+ noProcess: ['{noProcess}', [
22
+ 'test("__a", async (__args) => __body)',
23
+ 'test.skip("__a", async (__args) => __body)',
24
+ 'test.only("__a", async (__args) => __body)',
25
+ ],
26
+ ],
19
27
  });
20
28
 
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ const {types} = require('putout');
4
+ const {
5
+ isStringLiteral,
6
+ isTemplateLiteral,
7
+ } = types;
8
+
9
+ module.exports.report = () => `Typeof 'report' should be a 'function'`;
10
+
11
+ module.exports.match = () => ({
12
+ 'module.exports.report = __a': ({__a}) => isStringLiteral(__a) || isTemplateLiteral(__a),
13
+ });
14
+
15
+ module.exports.replace = () => ({
16
+ 'module.exports.report = __a': 'module.exports.report = () => __a',
17
+ });
@@ -6,8 +6,9 @@ module.exports = {
6
6
  compareAll: `const {compareAll} = operator`,
7
7
  compareAny: `const {compareAny} = operator`,
8
8
  contains: `const {contains} = operator`,
9
- traverse: `const {traverse} = operator`,
10
9
  declare: `const {declare} = operator`,
10
+ extract: `const {extract} = operator`,
11
+ traverse: `const {traverse} = operator`,
11
12
  isSimpleRegExp: `const {isSimpleRegExp} = operator`,
12
13
  getTemplateValues: `const {getTemplateValues} = operator`,
13
14
  addArgs: `const {addArgs} = operator`,
package/lib/index.js CHANGED
@@ -26,6 +26,7 @@ module.exports.rules = {
26
26
  ...getRule('convert-add-argument-to-add-args'),
27
27
  ...getRule('convert-dirname-to-url'),
28
28
  ...getRule('convert-url-to-dirname'),
29
+ ...getRule('convert-report-to-function'),
29
30
  ...getRule('replace-test-message'),
30
31
  ...getRule('rename-operate-to-operator'),
31
32
  ...getRule('replace-operate-with-operator'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "11.3.0",
3
+ "version": "11.6.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",
@@ -41,7 +41,7 @@
41
41
  "eslint": "^8.0.1",
42
42
  "eslint-plugin-node": "^11.0.0",
43
43
  "eslint-plugin-putout": "^15.0.0",
44
- "lerna": "^4.0.0",
44
+ "lerna": "^5.0.0",
45
45
  "madrun": "^9.0.0",
46
46
  "montag": "^1.2.1",
47
47
  "nodemon": "^2.0.1"