Skip to content

Commit bc9fafc

Browse files
author
Ives van Hoorne
committed
Update flow typings for new flow
1 parent 2e8638b commit bc9fafc

File tree

46 files changed

+156
-195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+156
-195
lines changed

src/app/components/ConfirmLink.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// @flow
2-
import React from 'react';
2+
import * as React from 'react';
33
import { Link } from 'react-router-dom';
44

55
type Props = {
66
enabled: boolean,
77
message: string,
88
};
99

10-
export default class ConfirmLink extends React.PureComponent {
11-
props: Props;
10+
export default class ConfirmLink extends React.PureComponent<Props> {
1211
confirm = (e: Event) => {
1312
const { enabled, message } = this.props;
1413

src/app/components/Portal.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// @flow
2-
import React from 'react';
2+
import * as React from 'react';
33
import ReactDOM from 'react-dom';
44

55
type Props = {
6-
children: React.Element<*>,
6+
children: React.Element<any>,
77
};
88

9-
export default class Portal extends React.Component {
10-
props: Props;
9+
export default class Portal extends React.Component<Props> {
1110
popup: Element;
1211

1312
componentDidMount() {

src/app/components/sandbox/CodeEditor/CodeMirror.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import React from 'react';
2+
import * as React from 'react';
33
import CodeMirror from 'codemirror';
44
import styled, { keyframes } from 'styled-components';
55
import type { Preferences, ModuleError } from 'common/types';
@@ -185,9 +185,7 @@ const handleError = (
185185
}
186186
};
187187

188-
export default class CodeEditor extends React.PureComponent {
189-
props: Props;
190-
188+
export default class CodeEditor extends React.PureComponent<Props> {
191189
shouldComponentUpdate(nextProps: Props) {
192190
return (
193191
nextProps.id !== this.props.id ||

src/app/components/sandbox/CodeEditor/Monaco.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* @flow */
2-
import React from 'react';
2+
import * as React from 'react';
33
import styled from 'styled-components';
44
import { debounce } from 'lodash';
55
import type { Preferences, ModuleError, Module, Directory } from 'common/types';
@@ -150,9 +150,7 @@ const handleError = (
150150
}
151151
};
152152

153-
export default class CodeEditor extends React.PureComponent {
154-
props: Props;
155-
153+
export default class CodeEditor extends React.PureComponent<Props> {
156154
syntaxWorker: ServiceWorker;
157155
lintWorker: ServiceWorker;
158156
typingsFetcherWorker: ServiceWorker;

src/app/components/sandbox/DeleteSandboxButton.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import React from 'react';
2+
import * as React from 'react';
33
import styled from 'styled-components';
44
import DeleteIcon from 'react-icons/lib/md/delete';
55
import Tooltip from 'app/components/Tooltip';
@@ -27,9 +27,9 @@ type Props = {
2727
id: string,
2828
};
2929

30-
export default class DeleteSandboxButtonContainer extends React.PureComponent {
31-
props: Props;
32-
30+
export default class DeleteSandboxButtonContainer extends React.PureComponent<
31+
Props,
32+
> {
3333
deleteSandbox = () => {
3434
this.props.onDelete(this.props.id);
3535
};

src/app/components/sandbox/Preview/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* @flow */
2-
import React from 'react';
2+
import * as React from 'react';
33
import styled from 'styled-components';
44

55
import { debounce } from 'lodash';
@@ -55,7 +55,7 @@ type State = {
5555
urlInAddressBar: string,
5656
};
5757

58-
export default class Preview extends React.PureComponent {
58+
export default class Preview extends React.PureComponent<Props, State> {
5959
initialPath: string;
6060
frames: Array<HTMLFrameElement>;
6161

@@ -320,8 +320,6 @@ export default class Preview extends React.PureComponent {
320320
setProjectView(sandboxId, !isInProjectView);
321321
};
322322

323-
props: Props;
324-
state: State;
325323
element: ?Element;
326324
proxy: ?Object;
327325
rootInstance: ?Object;

src/app/components/sandbox/SandboxList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import React from 'react';
2+
import * as React from 'react';
33
import styled from 'styled-components';
44
import moment from 'moment';
55
import { Link } from 'react-router-dom';

src/app/components/sandbox/Tags/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* @flow */
2-
import React from 'react';
2+
import * as React from 'react';
33
import styled from 'styled-components';
44

55
import Margin from 'app/components/spacing/Margin';

src/app/containers/ContextMenu.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import React from 'react';
2+
import * as React from 'react';
33
import { bindActionCreators } from 'redux';
44
import { spring, Motion } from 'react-motion';
55
import styled from 'styled-components';
@@ -45,7 +45,8 @@ const Item = styled.div`
4545
&:hover {
4646
color: ${props => (props.color ? props.color : theme.secondary())};
4747
background-color: ${() => theme.background2.lighten(0.3)()};
48-
border-left-color: ${props => (props.color ? props.color : theme.secondary())};
48+
border-left-color: ${props =>
49+
props.color ? props.color : theme.secondary()};
4950
}
5051
`;
5152

@@ -60,9 +61,8 @@ const mapStateToProps = state => ({
6061
const mapDispatchToProps = dispatch => ({
6162
contextMenuActions: bindActionCreators(contextMenuActionCreators, dispatch),
6263
});
63-
class ContextMenu extends React.PureComponent {
64+
class ContextMenu extends React.PureComponent<Props> {
6465
interval: number;
65-
props: Props;
6666

6767
setup = el => {
6868
this.mousedown = window.addEventListener('mousedown', event => {
@@ -111,7 +111,7 @@ class ContextMenu extends React.PureComponent {
111111
opacity: spring(1),
112112
}}
113113
>
114-
{({ size, opacity }) => (
114+
{({ size, opacity }) =>
115115
<Container
116116
style={{
117117
left: contextMenu.x + 10,
@@ -121,19 +121,18 @@ class ContextMenu extends React.PureComponent {
121121
}}
122122
>
123123
<div>
124-
{contextMenu.items.map(item => (
124+
{contextMenu.items.map(item =>
125125
<Item
126126
key={item.title}
127127
color={item.color}
128128
onClick={() => item.action() && this.close()}
129129
>
130130
{item.icon && <item.icon />}
131131
{item.title}
132-
</Item>
133-
))}
132+
</Item>,
133+
)}
134134
</div>
135-
</Container>
136-
)}
135+
</Container>}
137136
</Motion>}
138137
</div>
139138
</Portal>

src/app/containers/Navigation/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import React from 'react';
2+
import * as React from 'react';
33
import styled from 'styled-components';
44
import { connect } from 'react-redux';
55
import { Link } from 'react-router-dom';
@@ -78,9 +78,7 @@ const mapStateToProps = state => ({
7878
hasLogin: !!jwtSelector(state),
7979
isPatron: isPatronSelector(state),
8080
});
81-
class Navigation extends React.PureComponent {
82-
props: Props;
83-
81+
class Navigation extends React.PureComponent<Props> {
8482
render() {
8583
const { title, hasLogin, isPatron } = this.props;
8684

0 commit comments

Comments
 (0)