@putout/plugin-tape 21.4.0 → 21.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
@@ -46,6 +46,7 @@ npm i @putout/plugin-tape -D
46
46
  - ✅ [remove-skip](#remove-skip);
47
47
  - ✅ [remove-useless-not-called-args](#remove-useless-not-called-args);
48
48
  - ✅ [remove-useless-t-end](#remove-useless-t-end);
49
+ - ✅ [remove-useless-undefined](#remove-useless-undefined);
49
50
  - ✅ [switch-expected-with-result](#switch-expected-with-result);
50
51
  - ✅ [sync-with-name](#sync-with-name);
51
52
 
@@ -81,6 +82,7 @@ npm i @putout/plugin-tape -D
81
82
  "tape/extract-args-from-called-with": "on",
82
83
  "tape/remove-default-messages": "on",
83
84
  "tape/remove-useless-not-called-args": "on",
85
+ "tape/remove-useless-undefined": "on",
84
86
  "tape/remove-only": ["on", {
85
87
  "allowed": ["test"]
86
88
  }],
@@ -593,6 +595,22 @@ test('test: remove me', () => {
593
595
  });
594
596
  ```
595
597
 
598
+ ## remove-useless-undefined
599
+
600
+ ### ❌ Example of incorrect code
601
+
602
+ ```js
603
+ stub().returns(undefined);
604
+ stub().resolves(undefined);
605
+ ```
606
+
607
+ ### ✅ Example of correct code
608
+
609
+ ```js
610
+ stub();
611
+ stub().resolves();
612
+ ```
613
+
596
614
  ## convert-ok-to-match
597
615
 
598
616
  ### ❌ Example of incorrect code
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as removeUselessUndefined from './remove-useless-undefined/index.js';
1
2
  import * as extractArgsFromCalledWith from './extract-args-from-called-with/index.js';
2
3
  import * as applyStub from './apply-stub/index.js';
3
4
  import * as applyDestructuring from './apply-destructuring/index.js';
@@ -64,4 +65,5 @@ export const rules = {
64
65
  'remove-only': removeOnly,
65
66
  'remove-skip': removeSkip,
66
67
  'extract-args-from-called-with': extractArgsFromCalledWith,
68
+ 'remove-useless-undefined': removeUselessUndefined,
67
69
  };
@@ -0,0 +1,6 @@
1
+ export const report = () => `Avoid useless 'returns/resolves(undefined)'`;
2
+
3
+ export const replace = () => ({
4
+ 'stub().returns(undefined)': 'stub()',
5
+ 'stub().resolves(undefined)': 'stub().resolves()',
6
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-tape",
3
- "version": "21.4.0",
3
+ "version": "21.5.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with tests",