-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the generated app work if you flowcheck it #72
Comments
I think the first two are fine if we setup |
Indeed our case we’d need to map I am, however, not very happy with creating configs on user’s behalf right in their directory even if they don’t use Flow. The point of this project is that there is no user configuration, at least for as long as you can avoid it. What if |
As a temporary workaround, I added these stubs: 6885094.
And I wish this config was inside |
What about having a command like |
I’d like something like |
I added some instructions to the howto guide for now: https://github.com/facebookincubator/create-react-app/blob/master/template/README.md#adding-flow Longer term, I think we should include Flow by default and Flow should have a way of extending configs like
for basic settings. |
I would love flow being included by default 👍. Does that mean that we would also get flow errors in the chrome console and terminal? Flow helps me a lot with fixing bugs in javascript. People that don't like flow (for some reason) probably wouldn't even notice it, as they don't include the /* @flow */ comment on top of their file. |
So there are a number of tasks that we have created in order to simplify the setup of Flow in create-react-app. Right now the
There's a couple things we want to do to get it down to zero config.
We also want to improve the experience of Flow other than the initial setup.
We discussed allowing the repo to have no As for enabling Flow in create-react-app projects themselves, we would be interested in seeing that happen. As for if it's enabled on all files by default is up to the community to decide on what they want most. We don't want to force ourselves on anyone, but adding If anyone has questions about this let me know, @gabelevi and I will be working through these. |
😍😍😍 There is someone already investigating this I believe:
😍😍😍
This is actually what I do in all my flow projects, is there another way? |
Yes, you can add |
I find it tedious to put What we ended up doing with eslint in Also I would like to volunteer to help out testing any development build with a "flow defaults to on" experience! |
@thejameskyle I could not get the The all=true option seem to do something. In the sense that it taking my mac already 4 min to complete hehe, and still not completed, and making all kind of noises that I have never heard lol :P Is it analyzing now my |
And yeah, it will check everything, including node_modules :) |
It would be nice if the type checking was weak by default, but you could add |
@jameskyle the ignoring of node_modules by default can be problematic. Usually, we want flow to ignore the errors but still read the type information. I tend to publish my NPM modules with their flow types. This way you don't need to get the flow-typed module separately (see react-time ago) I hope that use-case doesn't break. |
+1 to include flow by default |
This is mostly fixed now. I updated instructions in #567. |
I just started a new project with create-react app, and for flow to work I had to include the bit in the documentation,
As well as
|
@thejameskyle did you end up not being able to do this? Doesn't appear to happen--I need to run |
@jayphelps No, this is not included. There is a proof of concept in #350 and @gabelevi expressed interest in having an official Flow loader for webpack but so far I haven't seen any progress on this. |
OBSOLETE You don't need any stub now! Note: with the latest react-scripts there is no flow stubs for css and files. Now you will need to redirect to the stubs made for jest:
Here is my currently working, out of the box,
|
This sounds wrong. You shouldn't need to redirect any stubs, it should "just work". Reopening because I'm confused and need a confirmation that it works without any mappers in the most recent Flow version. |
@gaearon Didn't tried without the mappers actually. I just followed the README generated by create-react-app a while ago. This seems fixed now though (the template doesn't ask you to map anymore). I think you can close this safely and dismiss my last comment! |
I'll still try with the latest flow version. |
Ok, nice, it works with this minimal [ignore]
<PROJECT_ROOT>/node_modules/fbjs/.*
[libs]
./flow-typed I also ran this to get type annotations for jest (explaining the npm i -g flow-typed
flow-typed install [email protected] --flowVersion 0.35 |
@rricard Could you update our Flow instructions to match your experience (e.g. Jest thing). |
That bring me to an another point: maybe we should do a flow-typed annotation for |
So, I think documenting the flow-typed procedure could be a good thing, but first we have to figure out the |
It would be nice if |
@gaearon @thejameskyle I'm working on a short-term solution PR for that in |
@gaearon Otherwise, I was wondering if you would be interested in adding flow out of the box to |
I'd definitely be interested. There is a PR with a proof of concept in #350. I reached out to the Flow team several times asking for their feedback on the Webpack loader that this PR used but unfortunately they never got back to me. If you're interested in taking this proof of concept and making it production-ready (maybe looking at other official Flow integrations and taking lessons from them) this is a good contribution opportunity. |
Nah. We'd create it from the loader the first time it sees a flow annotation. |
@gaearon Well, I'll take a look at all of this... One last question, so if you don't want the .flowconfig right away, I imagine, we'll only download them from the loader if we see a flow annotation as well, right? |
@gaearon I don't know either how the flow team would approach this problem, but I would work around |
That way we only depend on |
@rricard It being a loader would help integrating into |
But yea, WP plugin could work too. As long as you have a way to know when to trigger re-checks (or does Flow do this automatically anyway? I have no idea.) |
@gaearon I absolutely see why a loader has its advantages. Plugins in my opinion would work too. |
I don't know when flow updates exactly but once it's started, you just ask for the typechecking results and it's right there with no delay. So the question is when to add the flow errors to the output. |
@rricard And when to "re-trigger" the output due to Flow even if webpack didn't re-trigger it by itself. |
@gaearon Starting to see a bit more precisely what is going on here. I'll try something using |
Cool, thanks for looking at it! |
Going to close as it should be fine now. |
It would be nice if it were possible to add flow to the default project. I tried a minimal flow setup, adding a blank
.flowconfig
to the root and// @flow
toApp.css
. Four errors:For the first two I might be configuring things wrong? The second two seem like flow doesn't know how to handle the non-js imports that webpack is handling for us. I'm not sure what the right way to resolve this.
I was using flow version 0.29.0
The text was updated successfully, but these errors were encountered: