gajus / eslint-plugin-flowtype

Flow type linting rules for ESLint.
Other
1.08k stars 153 forks source link

Bug: incorrect `no-undef` error for Flow Enums #502

Open mrtnzlml opened 3 years ago

mrtnzlml commented 3 years ago

I know this sounds like it's not a problem with this plugin but bear with me.

Problematic code:

// @flow strict

enum Status {
  Active,
  Paused,
  Off,
}

This code uses the new Flow Enums. Eslint throws the following errors:

  3:6  error  'Status' is not defined  no-undef
  4:3  error  'Active' is not defined  no-undef
  5:3  error  'Paused' is not defined  no-undef
  6:3  error  'Off' is not defined     no-undef

It should not throw anything (at least not no-undef).

We already have define-flow-type that seems to be solving the issue for other Flow specifics (code). I think we have to extend this rule to support Flow Enums correctly.

mrtnzlml commented 2 years ago

This issue seems to be fixed in the newly released descendant of this plugin: https://github.com/flow-typed/eslint-plugin-ft-flow