Skip to content

Commit

Permalink
Upgrade flow (#1819)
Browse files Browse the repository at this point in the history
* ⬆️ upgrade flow-bin

* 🏷️update flow type definitions

* 🚨 fix flow errors

* 🚨 format with prettier

* 🏷️ add changeset

* 🔥 cleanup type definitions

* ♻️ check for body

body can be null by the flow definition

* ⬆️ upgrade flow to 0.110.1

* ⬆️ upgrade @emotion packages

Signed-off-by: w01fgang <sumin@unix-center.ru>

* 👌 replace suppress conmment

* 🚨 fix type import

* 🚨 add missing semicolon

* 🏷️ add fixturez type definition

* ♻️ don't change values

* 🐛 forwardRef and memo no defaultProps

facebook/flow#7467

* ✅ wait until the ui updates
  • Loading branch information
w01fgang authored and emmatown committed Oct 30, 2019
1 parent 50ff300 commit 8226eb4
Show file tree
Hide file tree
Showing 71 changed files with 595 additions and 317 deletions.
18 changes: 18 additions & 0 deletions .changeset/neat-seahorses-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@keystone-alpha/app-admin-ui': patch
'@arch-ui/button': patch
'@arch-ui/confirm': patch
'@arch-ui/controls': patch
'@arch-ui/day-picker': patch
'@arch-ui/dialog': patch
'@arch-ui/drawer': patch
'@arch-ui/layout': patch
'@arch-ui/modal-utils': patch
'@arch-ui/navbar': patch
'@arch-ui/pagination': patch
'@arch-ui/typography': patch
'@keystone-alpha/build-field-types': patch
'@keystone-alpha/fields': patch
---

Upgrade flow & fix flow errors and (probably) bugs
39 changes: 39 additions & 0 deletions .changeset/sharp-dots-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
'@keystonejs/demo-project-blog': patch
'@keystonejs/demo-project-meetup': patch
'@keystonejs/app-admin-ui': patch
'@arch-ui/docs': patch
'@arch-ui/alert': patch
'@arch-ui/badge': patch
'@arch-ui/button': patch
'@arch-ui/card': patch
'@arch-ui/confirm': patch
'@arch-ui/controls': patch
'@arch-ui/day-picker': patch
'@arch-ui/dialog': patch
'@arch-ui/drawer': patch
'@arch-ui/dropdown': patch
'@arch-ui/fields': patch
'@arch-ui/filters': patch
'@arch-ui/input': patch
'@arch-ui/layout': patch
'@arch-ui/loading': patch
'@arch-ui/lozenge': patch
'@arch-ui/modal-utils': patch
'@arch-ui/navbar': patch
'@arch-ui/options': patch
'@arch-ui/pagination': patch
'@arch-ui/pill': patch
'@arch-ui/popout': patch
'@arch-ui/tooltip': patch
'@arch-ui/typography': patch
'@keystonejs/build-field-types': patch
'@keystonejs/field-content': patch
'@keystonejs/fields-markdown': patch
'@keystonejs/fields-wysiwyg-tinymce': patch
'@keystonejs/fields': patch
'@keystonejs/oembed-adapters': patch
'@keystonejs/website': patch
---

Upgrade @emotion/core & @emotion/styled
7 changes: 6 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[declarations]

[ignore]
.*/node_modules/react-window/.*
.*/node_modules/sarcastic/.*
.*/node_modules/fixturez/.*

.*/node_modules/cypress/.*
.*/packages/website/.cache/.*
Expand All @@ -20,6 +23,8 @@
module.name_mapper='^@keystonejs\/\(.+\)$' -> '<PROJECT_ROOT>/packages/\1'
module.name_mapper='.*FIELD_TYPES' -> '<PROJECT_ROOT>/packages/field-views-loader/field-types'
module.name_mapper='^@arch-ui\/\([^\/]+\)$' -> '@arch-ui/\1/src/index.js'
server.max_workers=1
server.max_workers=4
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
lazy_mode=fs

[version]
4 changes: 2 additions & 2 deletions demo-projects/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"dependencies": {
"@arch-ui/layout": "^0.2.4",
"@arch-ui/typography": "^0.0.8",
"@emotion/core": "^10.0.14",
"@emotion/styled": "^10.0.14",
"@emotion/core": "^10.0.22",
"@emotion/styled": "^10.0.22",
"@keystonejs/adapter-mongoose": "^5.0.0",
"@keystonejs/app-admin-ui": "^5.0.0",
"@keystonejs/app-graphql": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion demo-projects/meetup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"start": "cross-env NODE_ENV=production keystone start"
},
"dependencies": {
"@emotion/core": "^10.0.14",
"@emotion/core": "^10.0.22",
"@keystonejs/adapter-mongoose": "^5.0.0",
"@keystonejs/app-admin-ui": "^5.0.0",
"@keystonejs/app-graphql": "^5.0.0",
Expand Down
28 changes: 28 additions & 0 deletions flow-typed/npm/fixturez_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// flow-typed signature: c0a247c13aec79d77053b130b7a57ff6
// flow-typed version: fixturez_v1.1.0/flow_v0.110.0

/**
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'fixturez' {
declare type Opts = {
glob?: string | Array<string>,
root?: string,
cleanup?: boolean,
};

declare type fixturez = (
cwd: string,
opts?: Opts
) => {
find: (name: string) => string,
temp: () => string,
copy: (name: string) => string,
cleanup: () => void,
};

declare module.exports: fixturez;
}
25 changes: 15 additions & 10 deletions flow-typed/npm/p-limit_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
// flow-typed signature: 375bd9e884de49de21ffed99c7e577dc
// flow-typed version: <<STUB>>/p-limit_v1/flow_v0.85.0
// flow-typed version: p-limit_v1/flow_v0.85.0

/**
* This is an autogenerated libdef stub for:
*
* 'p-limit'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'p-limit' {
declare module.exports: (
concurrency: number
) => <V, Args>(func: (...args: Args) => Promise<V>, ...args: Args) => Promise<V>;
declare interface Limit {
<Arguments: mixed[], ReturnType>(
fn: (...arguments: Arguments) => PromiseLike<ReturnType> | ReturnType,
...arguments: Arguments
): Promise<ReturnType>;
/* The number of promises that are currently running. */
+activeCount: number;

/* The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). */
+pendingCount: number;
}

/* Run multiple promise-returning & async functions with limited concurrency. */
declare export default function pLimit(concurrency: number): Limit;
}
2 changes: 1 addition & 1 deletion flow-typed/npm/react-router-dom_v4.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ declare module 'react-router-dom' {

declare export function withRouter<WrappedComponent: ComponentType<*>>(
Component: WrappedComponent
): ComponentType<$Diff<ElementConfig<$Supertype<WrappedComponent>>, ContextRouterVoid>>;
): ComponentType<$Diff<ElementConfig<$Shape<WrappedComponent>>, ContextRouterVoid>>;

declare type MatchPathOptions = {
path?: string,
Expand Down
18 changes: 18 additions & 0 deletions flow-typed/npm/react-window_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// flow-typed signature: a0c9e8efa1ca6e9858a69f5b504db9d0
// flow-typed version: <<STUB>>/react-window_v1.7.0/flow_v0.110.0

/**
* This is an autogenerated libdef stub for:
*
* 'react-window'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'react-window' {
declare module.exports: any;
}
35 changes: 35 additions & 0 deletions flow-typed/npm/sarcastic_v1.5.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// flow-typed signature: 15a2b719a9b43541e3723f51ab6dffdf
// flow-typed version: sarcastic_v1.5.0/flow_v0.110.0

declare module 'sarcastic' {
declare type Name = string | ((...keyPath: Array<string | number>) => string);
declare type Assertion<T> = (val: mixed, name: Name) => T;
declare type AssertionMap = { [key: string]: Assertion<any> };
declare type ExtractAssertionType = <T>(Assertion<T>) => T;
declare type AssertionResultMap<T> = $ObjMap<T, ExtractAssertionType>;

declare class AssertionError extends Error {
kind: string;
target: string;
value: mixed;
}

declare module.exports: {
is: <T>(val: mixed, assertion: Assertion<T>, name?: Name) => T,
boolean: Assertion<boolean>,
number: Assertion<number>,
string: Assertion<string>,
array: Assertion<$ReadOnlyArray<mixed>>,
func: Assertion<Function>,
object: Assertion<{ [key: string]: mixed }>,
arrayOf: <T>(assertion: Assertion<T>) => Assertion<Array<T>>,
arrayish: <T>(assertion: Assertion<T>) => Assertion<Array<T>>,
objectOf: <T>(assertion: Assertion<T>) => Assertion<{ [key: string]: T }>,
shape: <T: AssertionMap>(assertions: T) => Assertion<AssertionResultMap<T>>,
maybe: <T>(assertion: Assertion<T>) => Assertion<T | null>,
default: <T>(assertion: Assertion<T>, defaultValue: T) => Assertion<T>,
either: <A, B>(assertionA: Assertion<A>, assertionB: Assertion<B>) => Assertion<A | B>,
AssertionError: AssertionError,
<T>(val: mixed, assertion: Assertion<T>, name?: Name): T,
};
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"eslint-plugin-react-hooks": "^1.6.1",
"express": "^4.17.1",
"falsey": "^1.0.0",
"flow-bin": "0.91.0",
"flow-bin": "0.110.1",
"graphql": "^14.4.2",
"immutable": "^3.8.1",
"is-ci": "^2.0.0",
Expand Down
6 changes: 1 addition & 5 deletions packages/app-admin-ui/client/components/AnimateHeight.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ export default class AnimateHeight extends Component<Props, State> {
scrollToTop = () => {
const { autoScroll } = this.props;
const element = autoScroll instanceof HTMLElement ? autoScroll : this.node;
if (
!element ||
// $FlowFixMe
typeof element.scrollTo !== 'function'
) {
if (!element || typeof element.scrollTo !== 'function') {
return;
}
element.scrollTo(0, 0);
Expand Down
4 changes: 2 additions & 2 deletions packages/app-admin-ui/client/components/Animation.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
/** @jsx jsx */
import { jsx, keyframes } from '@emotion/core';
import { Component, type ElementType } from 'react';
import { Component } from 'react';

const pulse = keyframes`
from { transform: scale3d(1, 1, 1); }
Expand Down Expand Up @@ -29,7 +29,7 @@ const animations = {

type Props = {
name: $Keys<typeof animations>,
tag: ElementType,
tag: string,
duration: string,
isInfinite: boolean,
timing: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/app-admin-ui/client/components/PageError.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Container } from '@arch-ui/layout';

type Props = {
children: React.Node,
Icon: React.ElementType,
Icon: React$AbstractComponent<mixed, mixed>,
};

export default function PageError({ children, Icon, ...props }: Props) {
Expand Down
1 change: 0 additions & 1 deletion packages/app-admin-ui/client/pages/List/url-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import querystring from 'querystring';
import * as React from 'react';

import List from '../../classes/List';
// $FlowFixMe flow doesn't recognise the `*/Controller` entry point
import type { FieldControllerType } from '@keystonejs/fields/Controller';
import { pseudoLabelField } from './FieldSelect';
import type { AdminMeta } from '../../providers/AdminMeta';
Expand Down
4 changes: 2 additions & 2 deletions packages/app-admin-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"@arch-ui/tooltip": "^0.1.2",
"@arch-ui/typography": "^0.0.8",
"@babel/core": "^7.6.2",
"@emotion/core": "^10.0.14",
"@emotion/styled": "^10.0.14",
"@emotion/core": "^10.0.22",
"@emotion/styled": "^10.0.22",
"@keystonejs/build-field-types": "^5.0.0",
"@keystonejs/field-views-loader": "^5.0.0",
"@keystonejs/fields": "^5.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/arch/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"@arch-ui/theme": "^0.0.5",
"@arch-ui/tooltip": "^0.1.2",
"@arch-ui/typography": "^0.0.8",
"@emotion/core": "^10.0.14",
"@emotion/styled": "^10.0.14",
"@emotion/core": "^10.0.22",
"@emotion/styled": "^10.0.22",
"@reach/router": "^1.2.1",
"clipboard-copy": "^3.0.0",
"gatsby": "^2.13.25",
Expand Down
4 changes: 2 additions & 2 deletions packages/arch/packages/alert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
},
"dependencies": {
"@arch-ui/theme": "^0.0.5",
"@emotion/core": "^10.0.14",
"@emotion/styled": "^10.0.14"
"@emotion/core": "^10.0.22",
"@emotion/styled": "^10.0.22"
},
"module": "dist/alert.esm.js"
}
4 changes: 2 additions & 2 deletions packages/arch/packages/badge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"dependencies": {
"@arch-ui/theme": "0.0.5",
"@babel/runtime": "^7.4.3",
"@emotion/core": "^10.0.14",
"@emotion/styled": "^10.0.14"
"@emotion/core": "^10.0.22",
"@emotion/styled": "^10.0.22"
},
"module": "dist/badge.esm.js"
}
4 changes: 2 additions & 2 deletions packages/arch/packages/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"@arch-ui/loading": "^0.0.8",
"@arch-ui/theme": "^0.0.5",
"@babel/runtime": "^7.4.3",
"@emotion/core": "^10.0.14",
"@emotion/styled": "^10.0.14",
"@emotion/core": "^10.0.22",
"@emotion/styled": "^10.0.22",
"react-pseudo-state": "^2.2.2",
"react-router-dom": "5.0.0"
},
Expand Down
Loading

0 comments on commit 8226eb4

Please sign in to comment.