Skip to content

Commit 43e7194

Browse files
committed
feature: @putout/plugin-parens: remove-useless-for-await: no parens
1 parent 6f8f828 commit 43e7194

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const s = await m();

packages/plugin-parens/lib/remove-useless-for-await/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports.fix = (path) => {
1010

1111
module.exports.traverse = ({push}) => ({
1212
AwaitExpression(path) {
13+
if (!path.node.extra?.parenthesized)
14+
return;
15+
1316
if (path.parentPath.isVariableDeclarator())
1417
push(path);
1518
},

packages/plugin-parens/lib/remove-useless-for-await/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ test('parens: remove-useless-for-await: transform', (t) => {
1919
t.transform('remove-useless-for-await');
2020
t.end();
2121
});
22+
23+
test('parens: remove-useless-for-await: no report: no-parens', (t) => {
24+
t.noReport('no-parens');
25+
t.end();
26+
});

0 commit comments

Comments
 (0)