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

Question: How to get access type variables from scope #566

Closed armano2 closed 5 years ago

armano2 commented 5 years ago

I'm unsure if its supported yet, but in eslint scope contains informations about variables declared in it, but i'm unable to find types.

we have node: TSTypeParameterDeclaration -> TSTypeParameter but rather than iterating over all of them and checking if scope is same i don't see easier way to do so.

it will be nice if we could extend scopeManager and add information about this there.

If i'm wrong please correct me :>

mysticatea commented 5 years ago

It's not supported yet. We need design.

I think that we should expose parserServices to access type information. (https://eslint.org/docs/developer-guide/working-with-custom-parsers)

armano2 commented 5 years ago

For sure it will help writing rules, thank you :)

JamesHenry commented 5 years ago

FYI Ben from the TypeScript team recently added the primitives needed for this in typescript-estree On Thu, 22 Nov 2018 at 20:31, Armano notifications@github.com wrote:

For sure it will help writing rules, thank you :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/eslint/typescript-eslint-parser/issues/566#issuecomment-441141272, or mute the thread https://github.com/notifications/unsubscribe-auth/AA29q-mb0XYaZLSVRlfeoC4W52xggXEZks5ux1ABgaJpZM4YwArr .

JamesHenry commented 5 years ago

This issue has been migrated to the new project here: typescript-eslint/typescript-eslint#19

Thanks!