Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[no-unused-vars] Inconsisitent behaviour with shadowed type name #696

Closed
fa93hws opened this issue Jul 11, 2019 · 2 comments · Fixed by #688
Closed

[no-unused-vars] Inconsisitent behaviour with shadowed type name #696

fa93hws opened this issue Jul 11, 2019 · 2 comments · Fixed by #688
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin scope analyser Issues that are caused by bugs/incomplete cases in the scope analyser

Comments

@fa93hws
Copy link
Contributor

fa93hws commented Jul 11, 2019

Repro

{
  "rules": {
    "@typescript-eslint/no-unused-vars": ["error"]
  }
}
import { SomeType } from 'foo';
export function fn0(SomeType: SomeType){}

type AnotherType;
export function fn1(AnotherType: AnotherType){}

export function fn2(NonExistedType: NonExistedType) {}

Expected Result
All pass the rule or none of them pass the rule

Actual Result
Import is not OK, but the rest is fine even though the first parameter is not used.
When type node is visited, the parameter is marked as used..😰 see: #363

Additional Info
I know it's not possible to implement this rule without type information which will slow down the linting a lot.. But it should be possible to make the behavior consistent?

Versions

package version
@typescript-eslint/eslint-plugin X.Y.Z
@typescript-eslint/parser X.Y.Z
TypeScript X.Y.Z
ESLint X.Y.Z
node X.Y.Z
npm X.Y.Z
@fa93hws fa93hws added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jul 11, 2019
@fa93hws
Copy link
Contributor Author

fa93hws commented Jul 11, 2019

Oh, I just saw #688

@fa93hws fa93hws closed this as completed Jul 11, 2019
@bradzacher bradzacher added bug Something isn't working scope analyser Issues that are caused by bugs/incomplete cases in the scope analyser and removed triage Waiting for maintainers to take a look labels Jul 11, 2019
@bradzacher
Copy link
Member

I'll leave this open to keep it tracked until #688 is merged.

@bradzacher bradzacher reopened this Jul 11, 2019
@bradzacher bradzacher added the has pr there is a PR raised to close this label Jul 16, 2019
@bradzacher bradzacher added this to the scope analysis rewrite milestone Apr 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin scope analyser Issues that are caused by bugs/incomplete cases in the scope analyser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants