Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
I'm so sorry for the size of this PR.
Flow makes us use babel to strip the types, and that tends to have a cascading effect. I'm not sure if we'll be able to avoid babel in the long run though. The immediate thing that comes to mind is JSX. If we are ok with a build step (which we are), we'll probably end up using that.
The main annoyance was that the linter was complaining now because the "use strict" directive is redundant; all files are passed through babel which forces strict mode. So the majority of the files changes is just removing all strict directives.
The interesting parts are the files that I annotated with flow:
I wanted to have one of each type of file annotated: a reducer, an action creator, the selectors, and a test. For example, if you go into
I went through many attempts at the initial integration, so some things might still be leftover from that. There are still several places in these files that aren't type-checked, and we need to figure out how to check everything in them, but this PR is already large enough.
Another example is going into
The hardest part about this was trying to type immutable.js, which is certainly possible but required me to learn enough flow before I could get something working. You'll see
It also encourages us to use records so that we can type check it. Switching the sources state to be a record introduced other problems, like not being able to use a naive
Overall, this looks great. A couple small style nits. I'd prefer and start small and use the features that are clearly helpful. There were some examples where flow added annotations that were verbose, and it was hard to see the benefits being worthwhile.
I'd like to merge this soon, but I also don't want to add it if we break karma and cypress. It looks like the cypress fix is easy though. I'm looking into karma now on master so i'll have a better idea where the flakiness is coming from.
Yeah, we'll figure out a balance over time. I think it's a good goal to type check as much as possible. The problem with holes is that they tend to "bleed out", but there are places where it's OK. The worst parts here was in parts of
Yeah, let's not merge it until I fix it up a little more. I'll look into karma too because I'm pretty sure this error is my fault.