Flow: How to incorporate Flow into the create-react-app workflow

Created on 30 Jul 2017  Â·  6Comments  Â·  Source: facebook/flow

I have created an application and I have used flow.

I have it, in my .babelrc like this:

{
  "presets": [
    "flow",
    "react-app"
  ],
  "plugins": [
    "transform-flow-strip-types",
    "flow-react-proptypes"
  ],
  "env": {
    "development": {
      "plugins": ["flow-react-proptypes"]
    }
  }
}

I have added flow through yarn but the only way I can check for flow errors is to run flow.

If I run flow check I get this output:

Skipping /flow-typed: No such file or directory

Found 0 errors

How can I incorporate my flow errors into my workflow, i.e. know about flow errors without having to manually run flow each time to get the errors?

Is it possible to get the flow errors into the react-error-overlay?

Most helpful comment

Regarding the title of this issue – _"How to incorporate Flow into the create-react-app workflow"_ – why does the Flow documentation state that _"Flow will be run as part of create-react-app's scripts"_ ?

https://flow.org/en/docs/tools/create-react-app/
https://github.com/facebook/flow/blob/v0.63.1/website/en/docs/tools/create-react-app.md

According to the _"Adding Flow"_ section of Create React App's documentation, Flow must be executed manually by running npm run flow or yarn flow (it doesn't seem to be "run as part of create-react-app's scripts"):

https://github.com/facebookincubator/create-react-app/tree/v1.1.0/packages/react-scripts/template#adding-flow

All 6 comments

Most of us use Flow in our editor, to get hints about type issues while writing the code and before running it. What editor do you use? You can probably set up a Flow integration and get feedback quickly through it.

I don't know of a way to get flow errors into the react error overlay. If there is an API for getting build-time information into there, it shouldn't be too hard to add flow, but I haven never seen that done.

This is an old issue and I think more a usage question than a bug/request for Flow, so I'm going to close the issue. Still happy to chat here about dev process though.

Regarding the title of this issue – _"How to incorporate Flow into the create-react-app workflow"_ – why does the Flow documentation state that _"Flow will be run as part of create-react-app's scripts"_ ?

https://flow.org/en/docs/tools/create-react-app/
https://github.com/facebook/flow/blob/v0.63.1/website/en/docs/tools/create-react-app.md

According to the _"Adding Flow"_ section of Create React App's documentation, Flow must be executed manually by running npm run flow or yarn flow (it doesn't seem to be "run as part of create-react-app's scripts"):

https://github.com/facebookincubator/create-react-app/tree/v1.1.0/packages/react-scripts/template#adding-flow

Anyone know anything about this. How is it intended to be used during dev?

I'd like this https://github.com/facebook/flow/issues/4489#issuecomment-358616154 answered too!

+1 for getting some answer regarding @michaelhogg's comment.

i’ve moved onto typescript. that was my solution

Was this page helpful?
0 / 5 - 0 ratings