You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often notice flow issues too late, when I work on a create react app. The eslint issues are always in my face at the terminal, at the console, and in my editor (Webstorm). So I never miss out on them.
However, for flow issues, I have to run flow manually. Sadly, Webstorm doesn't show any flow issues. And also this project doesn't show any flow issues to me. Sometimes I find a bug after quite some time, and then I notice that flow would have already seen this for ages, but I just forgot to run flow.
I would love it if the flow issues are also seen in the terminal and console.
I was looking at the current lint code and found that we are using eslint-loader. So, it would be great if we can follow the similar approach for flow too. I was looking for a flow-loader and found this. But, this one doesn't pass any error or warning to the emitter and also it's not a loader.
In flow there's an option for getting json output of any command like flow status --json. So, I think I can make a separate flow-loader and integrate it here.
@torifat - The --json output doesn't include the pretty-printed error, but I have written some JS to handle consuming the JSON output and pretty printing it. I really need to stick it into a npm package, but until then it lives here: https://github.com/facebook/flow/blob/master/tsrc/flowResult.js.
@thejameskyle contacted @torifat, waiting for them to come up with a plan. Flow team is definitely interested in this and will pursue making this happen.
Reacted by Vinicius Pacheco, Tony Xiao, zakaria ridouh, Karl Horky, Yoni Mor, Christian Pena Valerio, Jamie Kyle, Max Stoiber, Jeff Friesen, Chase Colman and 4 more
As a stop-gap measure while this is being worked on, I came across this: https://www.npmjs.com/package/flow-watch. It's one more thing to kick off from the command line, but it alerts to errors at save time.
We're probably not going to pursue this. It doesn't seem like the Flow team is actively interested in such integrations, and trying to do something like this is like swimming against the current while APIs change.
Activity
lacker commentedon Aug 1, 2016
I would love this as well, especially if we can make it run in a way that is unobtrusive for people who are not using Flow.
gaearon commentedon Aug 1, 2016
I also would love this but I’m not totally sure how to approach this best. Proof of concept is welcome if you'd like to work on one.
torifat commentedon Aug 2, 2016
@gaearon I would like to work on a POC. One question though. Do we want to include
flow-binor look for the globalflow?gaearon commentedon Aug 2, 2016
@torifat I think including
flow-binis the way to go. Note that I have close to zero experience with it.torifat commentedon Aug 2, 2016
@gaearon no problem. We can revert it easily if any
flowveteran suggests otherwise in the future 😄torifat commentedon Aug 2, 2016
@gaearon It seems we need a
.flowconfigin the root (template) directory. There is a open related issue.facebook/flow#389
gaearon commentedon Aug 2, 2016
For now this is the only way: https://github.com/facebookincubator/create-react-app/blob/master/template/README.md#add-flow
But let’s skip that and focus on integration. We can figure out how to “provide” the config later.
torifat commentedon Aug 2, 2016
I was looking at the current
lintcode and found that we are usingeslint-loader. So, it would be great if we can follow the similar approach forflowtoo. I was looking for aflow-loaderand found this. But, this one doesn't pass any error or warning to the emitter and also it's not aloader.In
flowthere's an option for gettingjsonoutput of any command likeflow status --json. So, I think I can make a separateflow-loaderand integrate it here.@gaearon what's your thought?
Related Issues:
gaearon commentedon Aug 2, 2016
This sounds reasonable.
gabelevi commentedon Aug 2, 2016
@torifat - The
--jsonoutput doesn't include the pretty-printed error, but I have written some JS to handle consuming the JSON output and pretty printing it. I really need to stick it into a npm package, but until then it lives here: https://github.com/facebook/flow/blob/master/tsrc/flowResult.js.torifat commentedon Aug 2, 2016
UPDATE
I have already started working with the loader: https://github.com/torifat/flowtype-loader
Any kind of idea/suggestions are welcome 😄
Hopefully I will be able to finish it within tomorrow.
jntn commentedon Aug 23, 2016
@torifat any update on this? It would be cool to get this working 😄
1 remaining item
torifat commentedon Aug 23, 2016
@jntn It's working, you can check it by pulling my branch. I'm also waiting for feedbacks.
vinipace commentedon Sep 2, 2016
Any update on this?
gaearon commentedon Sep 2, 2016
@thejameskyle contacted @torifat, waiting for them to come up with a plan. Flow team is definitely interested in this and will pursue making this happen.
amilajack commentedon Sep 24, 2016
I'm working on an eslint plugin that reports flow errors as eslint errors:
https://github.com/amilajack/eslint-plugin-flowtype-errors
kasperpeulen commentedon Nov 27, 2016
@amilajack Awesome, I hope something like that will be used in create react app
juanpaco commentedon Aug 1, 2017
As a stop-gap measure while this is being worked on, I came across this: https://www.npmjs.com/package/flow-watch. It's one more thing to kick off from the command line, but it alerts to errors at save time.
gaearon commentedon Jan 8, 2018
We're probably not going to pursue this. It doesn't seem like the Flow team is actively interested in such integrations, and trying to do something like this is like swimming against the current while APIs change.