eslint / typescript-eslint-parser

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

no-unused-vars should understand imported type usage #488

Closed Snugug closed 5 years ago

Snugug 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?

import { Application } from 'express';

app().then((server:Application) => {

});

What did you expect to happen? With rule no-unused-vars, I expect Application to come back as being used as it's being imported and used as a type

What happened? 1:10 error 'Application' is defined but never used no-unused-vars

st-sloth commented 6 years ago

This issue duplicates #457 that is closed because this problem is not a parsing but a rule issue.

armano2 commented 5 years ago

To make it work i suggest using https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-unused-vars.md

JamesHenry commented 5 years ago

Using the plugin probably makes the most sense here, ESLint will not be able to understand many TS specific concerns natively.

Please feel free to open any other issues on the new project https://github.com/typescript-eslint/typescript-eslint

Thanks!