[no-extra-parens] False positive when calling generic function with single argument and type parameter with parentheses #2314
Labels
bug
Something isn't working
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Repro
Expected Result
No errors because
f<import('test')>1
isn't valid syntax.Actual Result
Additional Info
This seems to be because ofgetParentSyntaxParen
used inisParentheszied
in eslint-utils. Normally, the1
inf(1)
isn't considered to be parenthesised because the(
to the left of1
is the same the first(
afterf
. Withf<import('test')>(1)
, the first(
afterf
is the one used inimport('test')
, so1
is reported for being an unnecessarily parenthesised literal.This function is used in ESLint inisParenthesized
->hasExcessParensWithPrecedence
->checkCallNew
.This could be fixed by reducing the precedence of the argument node.
Versions
@typescript-eslint/eslint-plugin
3.7.0
@typescript-eslint/parser
3.7.0
TypeScript
3.9.7
ESLint
7.5.0
node
12.18.2
npm
6.14.5
The text was updated successfully, but these errors were encountered: