Skip to content
Permalink
Browse files

fix(eslint-plugin): [no-extra-parens] stop reporting on calling gener…

…ic functions with one argument and type parameters containing parentheses (#2319)
  • Loading branch information
cherryblossom000 committed Jul 27, 2020
1 parent fd90e31 commit 616a841032bec310d9f31f1c987888273df27008
@@ -78,6 +78,25 @@ export default util.createRule<Options, MessageIds>({
});
}

if (
node.arguments.length === 1 &&
node.typeParameters?.params.some(
param =>
param.type === AST_NODE_TYPES.TSParenthesizedType ||
param.type === AST_NODE_TYPES.TSImportType,
)
) {
return rule({
...node,
arguments: [
{
...node.arguments[0],
type: AST_NODE_TYPES.SequenceExpression as any,
},
],
});
}

return rule(node);
}
function unaryUpdateExpression(
@@ -26,6 +26,9 @@ for (a of (b, c));
for (a of b);
for (a in b, c);
for (a in b);
a<import('')>(1);
new a<import('')>(1);
a<(A)>(1);
`,
}),
...batchedSingleLineTests({
@@ -233,6 +236,8 @@ for (a in (b, c));
for (a in (b));
for (a of (b));
typeof (a);
a<import('')>((1));
new a<import('')>((1));
`,
output: `
a = b * c;
@@ -241,6 +246,9 @@ for (a in b, c);
for (a in b);
for (a of b);
typeof a;
a<import('')>(1);
new a<import('')>(1);
a<(A)>((1));
`,
errors: [
{
@@ -273,6 +281,21 @@ typeof a;
line: 7,
column: 8,
},
{
messageId: 'unexpected',
line: 8,
column: 15,
},
{
messageId: 'unexpected',
line: 9,
column: 19,
},
{
messageId: 'unexpected',
line: 10,
column: 8,
},
],
}),
...batchedSingleLineTests({

0 comments on commit 616a841

Please sign in to comment.
You can’t perform that action at this time.