Skip to content

Commit

Permalink
Fix flow errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jorilallo committed May 10, 2017
1 parent e051713 commit 75ad276
Show file tree
Hide file tree
Showing 19 changed files with 530 additions and 190 deletions.
5 changes: 4 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[ignore]
<PROJECT_ROOT>/node_modules/.*
.*/node_modules/styled-components/.*
.*/node_modules/react-side-effect/.*
.*/node_modules/fbjs/.*

[libs]

Expand All @@ -10,6 +12,7 @@ module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=frontend

module.name_mapper='^\(.*\)\.s?css$' -> 'empty/object'
module.file_ext=.js
module.file_ext=.scss

esproposal.decorators=ignore
Expand Down
1 change: 1 addition & 0 deletions .githooks/pre-commit/flow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn flow
2 changes: 1 addition & 1 deletion __mocks__/window.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
window.matchMedia = (data) => data;
window.matchMedia = data => data;
183 changes: 183 additions & 0 deletions flow-typed/npm/styled-components_v1.4.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
// flow-typed signature: 8e43d27dae79968dc11e73b131ec77da
// flow-typed version: d36e170dab/styled-components_v1.4.x/flow_>=v0.25.x

// @flow

declare module 'styled-components' {
declare type Interpolation =
| ((executionContext: Object) => string)
| string
| number;
declare type NameGenerator = (hash: number) => string;

declare type StyledComponent = (
strings: Array<string>,
...interpolations: Array<Interpolation>
) => ReactClass<*>;

declare type Theme = { [key: string]: mixed };
declare type ThemeProviderProps = {
theme: ((outerTheme: Theme) => void) | Theme,
};
declare type Component =
| React$Component<*, *, *>
| ((props: *) => React$Element<*>);

declare class ThemeProvider extends React$Component {
props: ThemeProviderProps,
}

declare module.exports: {
(baseComponent: Component): StyledComponent,
injectGlobal: (
strings: Array<string>,
...interpolations: Array<Interpolation>
) => void,
css: (
strings: Array<string>,
...interpolations: Array<Interpolation>
) => Array<Interpolation>,
keyframes: (
strings: Array<string>,
...interpolations: Array<Interpolation>
) => string,
withTheme: (
component: Component
) => React$Component<*, ThemeProviderProps, *>,
ThemeProvider: typeof ThemeProvider,
a: StyledComponent,
abbr: StyledComponent,
address: StyledComponent,
area: StyledComponent,
article: StyledComponent,
aside: StyledComponent,
audio: StyledComponent,
b: StyledComponent,
base: StyledComponent,
bdi: StyledComponent,
bdo: StyledComponent,
big: StyledComponent,
blockquote: StyledComponent,
body: StyledComponent,
br: StyledComponent,
button: StyledComponent,
canvas: StyledComponent,
caption: StyledComponent,
cite: StyledComponent,
code: StyledComponent,
col: StyledComponent,
colgroup: StyledComponent,
data: StyledComponent,
datalist: StyledComponent,
dd: StyledComponent,
del: StyledComponent,
details: StyledComponent,
dfn: StyledComponent,
dialog: StyledComponent,
div: StyledComponent,
dl: StyledComponent,
dt: StyledComponent,
em: StyledComponent,
embed: StyledComponent,
fieldset: StyledComponent,
figcaption: StyledComponent,
figure: StyledComponent,
footer: StyledComponent,
form: StyledComponent,
h1: StyledComponent,
h2: StyledComponent,
h3: StyledComponent,
h4: StyledComponent,
h5: StyledComponent,
h6: StyledComponent,
head: StyledComponent,
header: StyledComponent,
hgroup: StyledComponent,
hr: StyledComponent,
html: StyledComponent,
i: StyledComponent,
iframe: StyledComponent,
img: StyledComponent,
input: StyledComponent,
ins: StyledComponent,
kbd: StyledComponent,
keygen: StyledComponent,
label: StyledComponent,
legend: StyledComponent,
li: StyledComponent,
link: StyledComponent,
main: StyledComponent,
map: StyledComponent,
mark: StyledComponent,
menu: StyledComponent,
menuitem: StyledComponent,
meta: StyledComponent,
meter: StyledComponent,
nav: StyledComponent,
noscript: StyledComponent,
object: StyledComponent,
ol: StyledComponent,
optgroup: StyledComponent,
option: StyledComponent,
output: StyledComponent,
p: StyledComponent,
param: StyledComponent,
picture: StyledComponent,
pre: StyledComponent,
progress: StyledComponent,
q: StyledComponent,
rp: StyledComponent,
rt: StyledComponent,
ruby: StyledComponent,
s: StyledComponent,
samp: StyledComponent,
script: StyledComponent,
section: StyledComponent,
select: StyledComponent,
small: StyledComponent,
source: StyledComponent,
span: StyledComponent,
strong: StyledComponent,
style: StyledComponent,
sub: StyledComponent,
summary: StyledComponent,
sup: StyledComponent,
table: StyledComponent,
tbody: StyledComponent,
td: StyledComponent,
textarea: StyledComponent,
tfoot: StyledComponent,
th: StyledComponent,
thead: StyledComponent,
time: StyledComponent,
title: StyledComponent,
tr: StyledComponent,
track: StyledComponent,
u: StyledComponent,
ul: StyledComponent,
var: StyledComponent,
video: StyledComponent,
wbr: StyledComponent,

// SVG
circle: StyledComponent,
clipPath: StyledComponent,
defs: StyledComponent,
ellipse: StyledComponent,
g: StyledComponent,
image: StyledComponent,
line: StyledComponent,
linearGradient: StyledComponent,
mask: StyledComponent,
path: StyledComponent,
pattern: StyledComponent,
polygon: StyledComponent,
polyline: StyledComponent,
radialGradient: StyledComponent,
rect: StyledComponent,
stop: StyledComponent,
svg: StyledComponent,
text: StyledComponent,
tspan: StyledComponent,
};
}
1 change: 1 addition & 0 deletions frontend/components/CenteredContent/CenteredContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import styles from './CenteredContent.scss';
type Props = {
children: any,
style: Object,
maxWidth: string,
};

const CenteredContent = (props: Props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ const testHtml = `
`;

test('renders', () => {
const wrapper = shallow(
<DocumentHtml
html={ testHtml }
/>
);
const wrapper = shallow(<DocumentHtml html={testHtml} />);
expect(wrapper.find('.document').length).toBe(1);
});
6 changes: 4 additions & 2 deletions frontend/components/SlackAuthLink/SlackAuthLink.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// @flow
import React from 'react';
import { observer, inject } from 'mobx-react';
import type { User } from 'types';
import UserStore from 'stores/UserStore';

@inject('user')
@observer
class SlackAuthLink extends React.Component {
props: {
children: any,
scopes: Array<string>,
user: User,
user: UserStore,
redirectUri: string,
};

Expand All @@ -25,8 +25,10 @@ class SlackAuthLink extends React.Component {
slackUrl = () => {
const baseUrl = 'https://slack.com/oauth/authorize';
const params = {
// $FlowIssue global variable
client_id: SLACK_KEY,
scope: this.props.scopes.join(' '),
// $FlowIssue global variable
redirect_uri: this.props.redirectUri || SLACK_REDIRECT_URI,
state: this.props.user.getOauthState(),
};
Expand Down
4 changes: 3 additions & 1 deletion frontend/scenes/Settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import SlackAuthLink from 'components/SlackAuthLink';
</Title>
);

// $FlowIssue global variable
const showSlackSettings = DEPLOYMENT === 'hosted';

return (
Expand All @@ -47,7 +48,8 @@ import SlackAuthLink from 'components/SlackAuthLink';

<SlackAuthLink
scopes={['commands']}
redirectUri={`${URL}/auth/slack/commands`}
redirectUri={// $FlowIssue URL is a global variable
`${URL}/auth/slack/commands`}
>
<img
alt="Add to Slack"
Expand Down
Loading

0 comments on commit 75ad276

Please sign in to comment.