eslint / typescript-eslint-parser

An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.
Other
915 stars 92 forks source link

space-infix-ops: false positive for generics on type declarations #486

Closed OliverJAsh closed 5 years ago

OliverJAsh commented 6 years ago

What version of TypeScript are you using? 2.9.1

What version of typescript-eslint-parser are you using? 16.0.0

What code were you trying to parse?

With space-infix-ops rule enabled:

type Foo<T> = T;

What did you expect to happen? No error.

What happened? False positive for space-infix-ops.

  1:9  error  Infix operators must be spaced  space-infix-ops
OliverJAsh commented 6 years ago

This also effects generics nested inside of constrained generics:

type Bar < T > = T;
type Foo < T extends Bar <any>> = T;
  2:26  error  Infix operators must be spaced  space-infix-ops
zuzusik commented 5 years ago

I did a quick search over the code and looks like the support of GenericTypeAnnotation which was added here https://github.com/eslint/typescript-eslint-parser/pull/53/files#diff-6ecca2b7675f672f87297d93eec1e4baR479 was dropped at some point

I assume the fix would be get back the support of GenericTypeAnnotation

madbence commented 5 years ago

eslint/eslint#10935 fixed this i think (eslint@5.7.0), can you confirm @OliverJAsh ?

joe-re commented 5 years ago

This was fixed on my local to update eslint to 5.7.0. thanks!

kaicataldo commented 5 years ago

It looks like this can be closed now that the space-infix-ops has been updated. :tada: