Skip to content

Commit f209428

Browse files
committed
chore(types): Clean up some flow type issues & update packages
1 parent 45ee012 commit f209428

File tree

5 files changed

+247
-279
lines changed

5 files changed

+247
-279
lines changed

.flowconfig

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
[ignore]
2-
.*/node_modules/react/.*
32
.*/node_modules/babel.*
43
.*/node_modules/fbjs/.*
54
.*/node_modules/express/.*
65
.*/node_modules/serve-index/.*
7-
.*test
86

97
[include]
10-
./lib
11-
index.js
128

139
[libs]
1410

1511
[options]
16-
suppress_comment=.*\\\\s*$FlowFixMe.*
17-
suppress_comment=.*\\\\s*$FlowBug.*
18-
suppress_comment=.*\\\\s*$FlowIgnore.*
19-
suppress_comment=\\(.\\|\n\\)*\\$FlowNewLine.*
20-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
21-
esproposal.class_instance_fields=ignore
22-
esproposal.class_static_fields=ignore
12+
suppress_comment=\\(.\\|\n\\)*\\s*\\$FlowFixMe.*
13+
suppress_comment=\\(.\\|\n\\)*\\s*\\$FlowBug.*
14+
suppress_comment=\\(.\\|\n\\)*\\s*\\$FlowIgnore.*
15+
suppress_comment=\\(.\\|\n\\)*\\s*\\$FlowNewLine.*
16+
suppress_comment=\\(.\\|\n\\)*\\s*\\$FlowIssue
17+
suppress_type=$FlowFixMe
18+
esproposal.class_static_fields=enable
19+
esproposal.class_instance_fields=enable
20+
esproposal.decorators=ignore
21+
esproposal.export_star_as=enable
22+
experimental.strict_call_arity=true
23+
module.system.node.resolve_dirname=node_modules
24+
module.system.node.resolve_dirname=.
25+
module.use_strict=true
26+
server.max_workers=6
27+
unsafe.enable_getters_and_setters=true

lib/Resizable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type DragCallbackData = {
1616
deltaX: number, deltaY: number,
1717
lastX: number, lastY: number
1818
};
19-
type ResizeCallbackData = {
19+
export type ResizeCallbackData = {
2020
node: HTMLElement,
2121
size: {width: number, height: number}
2222
};

lib/ResizableBox.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
import React from 'react';
33
import PropTypes from 'prop-types';
44
import Resizable from './Resizable';
5-
import type {Props as ResizableProps} from './Resizable';
5+
import type {Props as ResizableProps, ResizeCallbackData} from './Resizable';
66

77
type State = {width: number, height: number};
8-
type Size = {width: number, height: number};
9-
type ResizeData = {element: Element, size: Size};
108

119
// An example use of Resizable.
1210
export default class ResizableBox extends React.Component {
@@ -25,12 +23,13 @@ export default class ResizableBox extends React.Component {
2523
height: this.props.height,
2624
};
2725

28-
onResize = (e: Event, {element, size}: ResizeData) => {
26+
onResize = (e: SyntheticEvent, data: ResizeCallbackData) => {
27+
const {size} = data;
2928
const {width, height} = size;
3029

3130
if (this.props.onResize) {
3231
e.persist && e.persist();
33-
this.setState(size, () => this.props.onResize(e, {element, size}));
32+
this.setState(size, () => this.props.onResize && this.props.onResize(e, data));
3433
} else {
3534
this.setState(size);
3635
}
@@ -52,6 +51,7 @@ export default class ResizableBox extends React.Component {
5251
const {handleSize, onResize, onResizeStart, onResizeStop, draggableOpts,
5352
minConstraints, maxConstraints, lockAspectRatio, axis, width, height, ...props} = this.props;
5453
return (
54+
// $FlowIgnore children & defaultProps bug (https://github.com/facebook/flow/issues/1964)
5555
<Resizable
5656
handleSize={handleSize}
5757
width={this.state.width}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@
3939
"babel-plugin-transform-object-rest-spread": "^6.23.0",
4040
"babel-preset-es2015": "^6.24.1",
4141
"babel-preset-react": "^6.24.1",
42-
"cross-env": "^4.0.0",
42+
"cross-env": "^5.0.0",
4343
"css-loader": "^0.28.0",
4444
"eslint": "^3.19.0",
45-
"eslint-plugin-react": "^6.10.3",
46-
"flow-bin": "^0.45.0",
45+
"eslint-plugin-react": "^7.0.1",
46+
"flow-bin": "^0.46.0",
4747
"lodash": "^4.3.0",
4848
"pre-commit": "^1.1.2",
4949
"react": "^15.5.4",
5050
"react-dom": "^15.5.4",
51-
"style-loader": "^0.17.0",
51+
"style-loader": "^0.18.1",
5252
"webpack": "^2.4.1",
5353
"webpack-dev-server": "^2.4.5"
5454
},

0 commit comments

Comments
 (0)