Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(eslint-plugin): [no-extra-parens] stop reporting on calling generic functions with one argument and type parameters containing parentheses#2319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bradzacher merged 2 commits intotypescript-eslint:masterfromcherryblossom000:2314
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletionspackages/eslint-plugin/src/rules/no-extra-parens.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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(
Expand Down
23 changes: 23 additions & 0 deletionspackages/eslint-plugin/tests/rules/no-extra-parens.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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({
Expand DownExpand Up@@ -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;
Expand All@@ -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: [
{
Expand DownExpand Up@@ -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({
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp