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

False positive no-unused-vars with string enum #582

Closed micaelmbagira closed 5 years ago

micaelmbagira commented 5 years ago

What version of TypeScript are you using? ^3.1.6

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

What code were you trying to parse?

export enum State {
  START = 'start',
  END = 'end',
}

console.log(State.START)

What did you expect to happen? No errors

What happened? I have the following error

  2:3  error  'START' is assigned a value but never used  no-unused-vars
  3:3  error  'END' is assigned a value but never used    no-unused-vars
platinumazure commented 5 years ago

Hi @micaelmbagira, thanks for the issue.

Looks like we have a potential PR to fix here: #558

But there's also some discussion about the best way to fix (and whether this should be handled in eslint-plugin-typescript).

armano2 commented 5 years ago

@platinumazure we are already have code for this in eslint-plugin-typescript

micaelmbagira commented 5 years ago

@platinumazure I am using eslint-plugin-typescript^0.14.0

armano2 commented 5 years ago

@micaelmbagira there was release of version 1.0.0-rc.0 of eslint-plugin-typescript you should consider upgrading :)

micaelmbagira commented 5 years ago

Solved by using eslint-plugin-typescript^1.0.0-rc.0