Skip to content
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

Upgrade Flow to the latest version #11426

Closed
6 of 12 tasks
mourner opened this issue Jan 20, 2022 · 0 comments
Closed
6 of 12 tasks

Upgrade Flow to the latest version #11426

mourner opened this issue Jan 20, 2022 · 0 comments
Assignees

Comments

@mourner
Copy link
Member

mourner commented Jan 20, 2022

The Flow version we currently use for type checking is nearly 3 years old and critically outdated.

  • It's extremely slow. Running flow check after changing one line of code takes 1+ min, which is unacceptable for iterative development.
  • It's buggy. There have been hundreds of bugfixes since.
  • It's not sound. Many typing errors are silently ignored.
  • The errors are often unhelpful.

The latest version (v0.170) has radically better architecture that allows it to be orders of magnitude faster, while fixing numerous soundness and stability issues. Upgrading to it would allow us to iterate on GL JS much faster, especially when doing bigger refactoring projects. Additionally, if we commit to switching to TypeScript in the future, having better type coverage will make it much easier.

But it's not easy — simply updating the version produces several thousand type errors, some due to increased strictness and soundness, and some due to typing mistakes being silently ignored in the current version (with #11400 as an example of this).

Here's my plan for a gradual upgrade:

Type-first sprint

  • Make a list of all JS files in src/, and assign batches of files across people participating in the sprint.
  • For each file, remove the type_first=false line in .flowconfig, then run flow codemod annotate-exports --write --repeat <path> (see codemod docs)
  • Make sure generated types make sense, fix if necessary.
  • Discard .flowconfig changes and make sure test-flow passes.
  • PR the changes for a batch of files to main.
@mourner mourner self-assigned this Jan 20, 2022
This was referenced Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants