eslint/typescript-eslint-parser

no-shadow if const and enum value are the same

samijaber opened this issue · 1 comments

What version of TypeScript are you using?
3.1.6

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

What code were you trying to parse?

const f = 0;
enum Foo {
  f,
}

What did you expect to happen?
No errors

What happened?
Got a no-shadow error

Might be somewhat related to #459

Thank you for this report.

However, this is an expected behavior because the enum member f literally shadows the upper f.

const f = 777;
enum E1 {
    f = 1, // Shadows the upper `f`.
    g = f, // = 1
}
enum E2 {
    f1 = 1,
    g = f, // This is the upper `f`.
}

Open playground