@putout/plugin-tape 9.7.0 β†’ 9.9.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
@@ -21,6 +21,7 @@ npm i @putout/plugin-tape -D
21
21
  {
22
22
  "rules": {
23
23
  "tape/apply-stub": "on",
24
+ "tape/apply-destructuring": "on",
24
25
  "tape/apply-stub-operator": "on",
25
26
  "tape/apply-with-name": "on",
26
27
  "tape/add-t-end": "on",
@@ -341,6 +342,26 @@ test('copymitter', async (t) => {
341
342
  });
342
343
  ```
343
344
 
345
+ ## apply-destructuring
346
+
347
+ Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/adf238850271c0a4ad917e71bab8757c/4ff416c3d9f3de0930339c7a4929eb4b62461d1a).
348
+
349
+ ### ❌ Example of incorrect code
350
+
351
+ ```js
352
+ const test = require('supertape');
353
+ const {stub} = test;
354
+ ```
355
+
356
+ ### βœ… Example of correct code
357
+
358
+ ```js
359
+ const {
360
+ test,
361
+ stub,
362
+ } = require('supertape');
363
+ ```
364
+
344
365
  ## apply-stub
345
366
 
346
367
  Apply [stub](https://github.com/cloudcmd/stub) functions created. Look how it works in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/d098a8c8d03a072a7f3981e3cfb1d7af/f1542bfa39513ac625b2a9cd9243cc06dee286c0).
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ module.exports.report = () => `Use destructuring when using 'stub()' in 'test()'`;
4
+
5
+ module.exports.match = () => ({
6
+ 'const test = require("supertape")': (vars, path) => path.scope.bindings.stub,
7
+ });
8
+
9
+ module.exports.replace = () => ({
10
+ 'const test = require("supertape")': (vars, path) => {
11
+ path.scope.bindings.stub.path.remove();
12
+ return 'const {test, stub} = require("supertape")';
13
+ },
14
+ });
15
+
@@ -6,7 +6,7 @@ const {
6
6
  isArrayExpression,
7
7
  } = types;
8
8
 
9
- module.exports.report = () => `Use 'array' as calledWith 'args'`;
9
+ module.exports.report = () => `Use an array as args to 'calledWith()'`;
10
10
 
11
11
  module.exports.match = () => ({
12
12
  't.calledWith(__a, __b)': ({__b}) => {
@@ -23,3 +23,4 @@ module.exports.match = () => ({
23
23
  module.exports.replace = () => ({
24
24
  't.calledWith(__a, __b)': 't.calledWith(__a, [__b])',
25
25
  });
26
+
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@ const getRule = (a) => ({
6
6
 
7
7
  module.exports.rules = {
8
8
  ...getRule('apply-stub'),
9
+ ...getRule('apply-destructuring'),
9
10
  ...getRule('apply-with-name'),
10
11
  ...getRule('add-await-to-re-import'),
11
12
  ...getRule('sync-with-name'),
@@ -10,6 +10,7 @@ module.exports.replace = () => ({
10
10
  't.equal(__a, __b, "should equal")': 't.equal(__a, __b)',
11
11
  't.notEqual(__a, __b, "should not equal")': 't.notEqual(__a, __b)',
12
12
  't.deepEqual(__a, __b, "should deep equal")': 't.deepEqual(__a, __b)',
13
+ 't.deepEqual(__a, __b, "should equal")': 't.deepEqual(__a, __b)',
13
14
  't.notDeepEqual(__a, __b, "should not deep equal")': 't.notDeepEqual(__a, __b)',
14
15
  });
15
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-tape",
3
- "version": "9.7.0",
3
+ "version": "9.9.1",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with tests",
@@ -36,7 +36,7 @@
36
36
  "eslint": "^8.0.1",
37
37
  "eslint-plugin-node": "^11.0.0",
38
38
  "eslint-plugin-putout": "^15.0.0",
39
- "lerna": "^4.0.0",
39
+ "lerna": "^5.0.0",
40
40
  "madrun": "^9.0.0",
41
41
  "montag": "^1.2.1",
42
42
  "nodemon": "^2.0.1"