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

TSTypeReference does not emit for React.SFC #476

Closed milesj closed 5 years ago

milesj commented 6 years ago

What version of TypeScript are you using?

2.8.1

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

0.12.0

What code were you trying to parse?

export interface PriceProps {
  // Some props
}

export const Price: React.SFC<PriceProps> = function Price(props) {}

What did you expect to happen?

I'm trying to write a rule that verifies the generics in React.SFC are correct, however, the TSTypeReference for React.SFC is never emitted, so I'm unable to capture and and write a rule around it.

For example, this doesn't even log.

TSTypeReference(node) {
  console.log(node);
},

What happened?

Doesn't work.

macklinu commented 6 years ago

I'm wondering if this issue is related to what's blocking https://github.com/nzakas/eslint-plugin-typescript/pull/117.

milesj commented 6 years ago

Sounds like it. I've noticed that if I go up to the parent, I can see the TSTypeReference node correctly as a child. It just doesn't work when referencing it directly.