Skip to content

Commit 11fb65f

Browse files
committed
feature: @putout/plugin-promises: remove-useless-async: returnType: exclude Promise
1 parent f1f321d commit 11fb65f

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const a = async (): Promise<number> => {
2+
return 5;
3+
}

packages/plugin-promises/lib/remove-useless-async/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export const fix = (path) => {
88
path.node.async = false;
99
};
1010

11-
export const exclude = () => ['__nop'];
11+
export const exclude = () => [
12+
'__nop',
13+
'async (__args): Promise<__b> => __body',
14+
];
1215

1316
export const include = () => [
1417
'async function __(__args) {}',

packages/plugin-promises/lib/remove-useless-async/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ test('plugin-remove-useless-async: no transform: for-of', (t) => {
6767
t.end();
6868
});
6969

70+
test('plugin-remove-useless-async: no report: type', (t) => {
71+
t.noReport('type');
72+
t.end();
73+
});
74+
7075
test('plugin-remove-useless-async: no transform: for-await-of', (t) => {
7176
t.noTransform('for-await-of');
7277
t.end();

0 commit comments

Comments
 (0)