Skip to content

[flow] Upgrade to flow 0.53.1#7869

Merged
rosskevin merged 36 commits into
mui:v1-betafrom
alienfast:flow-531
Aug 23, 2017
Merged

[flow] Upgrade to flow 0.53.1#7869
rosskevin merged 36 commits into
mui:v1-betafrom
alienfast:flow-531

Conversation

@rosskevin

@rosskevin rosskevin commented Aug 23, 2017

Copy link
Copy Markdown
Contributor

Fixes #7788

This is a massive changeset to accomodate the major change in flow's built-in libdef for react. The changes and reference to docs are outlined in the release notes: https://github.com/facebook/flow/releases/tag/v0.53.0

Given this huge changeset, it is virtually un-reviewable.

Once the tests pass on CircleCI, I'll be squash merging, and I pledge to handle what would normally be reviewable separately and timely.

rosskevin and others added 30 commits August 22, 2017 09:15
- ran flow-upgrade
- switch React.Element<any> references to React.Node
- switch all react imports to `* as React` and use the React.* for access to uniformly access both function and types
- linted
This isn’t a fix, it just gets past the error.  I assume generated prop types are still invalid.
* [docs] Fix missing props in css-in-js examples

`this.classes.root` wouldn't work - `this.props.classes.root' would.

* Update css-in-js.md
@rosskevin

Copy link
Copy Markdown
Contributor Author

Some notes to those that find this, to use flow + react in what was formerly known as weak mode, you can simply do React.Component<any, any>. The flow-upgrade will put in React.Component<$FlowFixMeProps, $FlowFixMeState> but if you have zero plans to use flow, using <any, any> is fine.

@rosskevin

Copy link
Copy Markdown
Contributor Author

Docs are failing so more left...

@rosskevin

Copy link
Copy Markdown
Contributor Author

Docs are working again. Another FYI, with this PR I've converted several additional components to Flow, increasing our coverage.

@rosskevin

Copy link
Copy Markdown
Contributor Author

react-docgen continues to fail, namely on ButtonBase

@oliviertassinari - do you see anything on ButtonBase that would cause react-docgen to just fail entirely? I couldn't find anything

// @flow

import React from 'react';
import * as React from 'react';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to perform such change? I have never seen such pattern for importing React. That's hiding something.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It allows import of both types and functions. Without it we need to import everything separately. Since the migration tool automatically does this and all examples use it, it seemed to be what users are most likely to be familiar with. We can incrementally switch to individual imports.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oliviertassinari oliviertassinari Aug 23, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good then for the source code 👍. I haven't looked at the demos, but I don't think that they should be flowtyped covered as used in an unknown environnement. We have been using flow weak so far.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demos I have kept as weak as possible. The only change was I had to change extends React.Component to extends React.Component<any, any>

@oliviertassinari oliviertassinari Aug 23, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rosskevin Won't that break with users using Typescript or not using the babel flow plugin?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could disable flow for the demo folders instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it will break without the flow type stripping plugin or not. If we decide to, I'll PR separate.

@oliviertassinari oliviertassinari Aug 23, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it will break without the flow type stripping plugin or not

Yes, it does.

@rosskevin

Copy link
Copy Markdown
Contributor Author

I have created #7880 to get the docgen working properly again.

@oliviertassinari

oliviertassinari commented Aug 23, 2017

Copy link
Copy Markdown
Member

Do you plan on fixing #7881, #7880 as well as the demos before merging this PR? Otherwise I fear they will stay unsolved.

@rosskevin

rosskevin commented Aug 23, 2017

Copy link
Copy Markdown
Contributor Author

No on #7880, I'm hoping somebody will pick up the docgen issue, it affects every single flow user of docgen. Worst case if someone doesn't pick up in a week I can look at it.

No on #7881, I'm going to address it next (today). It is a pre-existing problem and not caused by this PR (a small amount of growth is). I think I can solve that one today due to my familiarity with PRing on that plugin.

@rosskevin

Copy link
Copy Markdown
Contributor Author

Will address #7882 demos today as well.

@rosskevin
rosskevin merged commit 470a825 into mui:v1-beta Aug 23, 2017
@rosskevin rosskevin added the breaking change Introduces changes that are not backward compatible. label Aug 23, 2017
@oliviertassinari

Copy link
Copy Markdown
Member

@rosskevin Awesome, one step at the time 👍

@rsolomon

Copy link
Copy Markdown
Contributor

Nice work!

@rosskevin
rosskevin deleted the flow-531 branch August 24, 2017 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants