Create-react-app: eslint warning `no-use-before-define` should not apply to flow types

Created on 9 May 2017  Â·  3Comments  Â·  Source: facebook/create-react-app

Description

The default eslint rules warn about no-use-before-define of flow types. The warning is pointless because 'use before define' does not apply to flow types. This makes it impossible for example to define recursive types.

Expected behavior

The no-use-before-define warning should not be reported.

Actual behavior

Warning appears in the console.

Reproducible Demo

Create a CRA project and place the following text into one of the files:

type Node = {
  children: Node[];
}
bug

Most helpful comment

Submitted a PR. Not really sure if it is _the right way_ â„¢ since I have no experience with Babel or ESLint but all tests are passing: https://github.com/babel/babel-eslint/pull/584

All 3 comments

Please report this to the upstream projects (in this case, maybe babel-eslint or eslint itself). Or perhaps eslint-plugin-flowtype can help with this.

You can track this in https://github.com/babel/babel-eslint/issues/485. When they fix it, we'll get the fix too. You can also try to help fixing this in babel-eslint repo :-)

Submitted a PR. Not really sure if it is _the right way_ â„¢ since I have no experience with Babel or ESLint but all tests are passing: https://github.com/babel/babel-eslint/pull/584

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dualcnhq picture dualcnhq  Â·  3Comments

ap13p picture ap13p  Â·  3Comments

oltsa picture oltsa  Â·  3Comments

onelson picture onelson  Â·  3Comments

AlexeyRyashencev picture AlexeyRyashencev  Â·  3Comments