-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[v2] Fixed work with flow >= 0.85, update to 0.91 #3350
Conversation
In the near future, I’ll see what the problem is with reduced coverage. Possible problem after updating babel or there is an error in the code. |
I checked the problem with reduced coverage. The reason is that Example: 49 [√] |export function getMenuPlacement(...) {
58 [√] | const { spacing } = theme;
| // ...
63 [√] | if (!menuEl || !menuEl.offsetParent) return defaultState;
67 [X] | const { height: scrollHeight } = scrollParent.getBoundingClientRect();
| // ...
90 [X] | switch (placement) {
| // ...
152 | case 'top':
153 | // 1: the menu will fit, do nothing
154[√] | if (viewSpaceAbove >= menuHeight) {
155[√] | return { placement: 'top', maxHeight };
156 | }
| // ...
| }
| // ...
|}
So now coverage is calculated correctly in the version of real coverage is 64% |
thanks for this @DragorWW, will have a more detailed look at this shortly. The write up and a cursory glance of the diff lgtm so far. |
Released flow 0.91, today I will update the PR to it |
class Async extends Component<Props, State> { | ||
export const makeAsyncSelect = <C: {}>( | ||
SelectComponent: AbstractComponent<C> | ||
): AbstractComponent<C & AsyncProps> => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use spread instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spread is a good idea if you have exact flow types
I would better split build tools upgrade and flow types upgrade. Two PRs will be easier to review. |
@TrySound yes it is a good idea, I will move build tools upgrade in a separate pr |
@DragorWW, ty for this, can you rebase from master? |
Changelog: [Select] - change type of formatGroupLabel, getOptionLabel, getOptionValue to () => string - Async: filterOption default null - StateManager: stop pass defaultInputValue, defaultMenuIsOpen defaultValue to Select - add types in src/accessibility - add types in AsyncCreatable - use AbstractComponent in HOC - fix untyped type import errors - remove $FlowFixMe from src/components/Menu.js [flow] - update flow to 0.91 - add lint rule: untyped-type-import as error - add lint rule unclear-type as warn - add to ignore @atlaskit/layer-manager files [flow-typed] - add react-router-dom@4.x.x types [Docs] - remove any type in Footer component - Header: fix incorrect usage getOptionLabel change toformatOptionLabel [jest] - update snapshots
rebased to master, and squash commits to one, and already removed some of the outdated edits and minor changes in the code style that were not related to the main task. What do you think about adding flow check to CI? |
@TrySound @gwyneplaine I propose to select all the flow type edits associated with changing the code in separate PRs Today I will prepare the first of them |
sure |
Fixed work with flow >= 0.85, update to 0.90
Since with flow 0.85, it has become stricter, and requires explicit typing of all export methods and variables.
Changelog to support flow
After the upgrade, flow is displayed 58 new issues, most of them refer to external library and to the HOC manageState.
Fixed typing in code and also made minor changes in code of docs
Logic problems in code was fixed
New version flow found the following errors in logics:
All changes are needed to work with the flow >= 0.85
Other moments
P.S.
In my opinion, the required change should not have been so large, a lot of work was done because of old versions of libraries in dependencies
Idea of using types from the npm library (not from flow-typed) is bad, and creates problems
Perhaps it makes sense to divide the pull request into 2 or more, for example, separately babel and separate flow
I am waiting for feedback, maybe I missed something, ready to discuss and correct