Skip to content

Commit

Permalink
Improve flow coverage and add missing annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGrandon authored and fusion-bot[bot] committed May 23, 2018
1 parent 8514cc7 commit a7c18f3
Show file tree
Hide file tree
Showing 33 changed files with 2,033 additions and 1,112 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/env", "@babel/flow"]
}
8 changes: 8 additions & 0 deletions download-selenium.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/** Copyright (c) 2018 Uber Technologies, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

/* globals require */

// see https://github.com/ritz078/embed-js/blob/74b07bc74ac948ecc7ed6d328ef1b8e92be8eae1/nightwatch.conf.js
Expand Down
12 changes: 11 additions & 1 deletion nightwatch-ci.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
/** Copyright (c) 2018 Uber Technologies, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

/* globals module, process, require */

require('@babel/register');

const environments = require('./selenium-environments');

const JOB_IDENTIFIER = process.env.BUILDKITE_BUILD_NUMBER;
Expand Down Expand Up @@ -38,5 +48,5 @@ const settings = {
},
};

Object.assign(settings.test_settings, environments);
settings.test_settings = {...settings.test_settings, ...environments};
module.exports = settings;
11 changes: 10 additions & 1 deletion nightwatch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/* globals module */
/** Copyright (c) 2018 Uber Technologies, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/* globals module, require */

require('@babel/register');

module.exports = {
src_folders: ['src/test/browser/index.js'],
Expand Down
56 changes: 30 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,52 +22,56 @@
"check": "fusion check"
},
"dependencies": {
"fast-async": "^6.3.4",
"fusion-cli": "^1.3.5",
"fusion-core": "^1.2.2",
"fusion-plugin-browser-performance-emitter": "^1.4.0",
"fusion-plugin-csrf-protection-react": "^1.0.2",
"fast-async": "^6.3.7",
"fusion-cli": "^1.6.0",
"fusion-core": "^1.3.1",
"fusion-plugin-browser-performance-emitter": "^1.4.3",
"fusion-plugin-csrf-protection-react": "^1.0.3",
"fusion-plugin-error-handling": "^1.0.5",
"fusion-plugin-font-loader-react": "^1.0.2",
"fusion-plugin-i18n-react": "^1.0.2",
"fusion-plugin-font-loader-react": "^1.0.3",
"fusion-plugin-i18n-react": "^1.0.4",
"fusion-plugin-jwt": "^1.0.5",
"fusion-plugin-node-performance-emitter": "^1.0.2",
"fusion-plugin-react-redux": "^1.0.2",
"fusion-plugin-react-router": "^1.0.5",
"fusion-plugin-redux-action-emitter-enhancer": "^1.0.2",
"fusion-plugin-rpc-redux-react": "^1.0.4",
"fusion-plugin-styletron-react": "^2.0.1",
"fusion-plugin-react-redux": "^1.0.5",
"fusion-plugin-react-router": "^1.1.0",
"fusion-plugin-redux-action-emitter-enhancer": "^1.0.3",
"fusion-plugin-rpc-redux-react": "^1.1.1",
"fusion-plugin-styletron-react": "^2.4.1",
"fusion-plugin-universal-events-react": "^1.0.1",
"fusion-plugin-universal-logger": "^1.0.2",
"fusion-react": "^1.0.3",
"fusion-react-async": "^1.2.1",
"fusion-plugin-universal-logger": "^1.0.3",
"fusion-react": "^1.0.5",
"fusion-react-async": "^1.2.2",
"fusion-tokens": "^1.0.3",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-redux": "^5.0.7",
"recompose": "^0.26.0",
"redux": "^3.7.2",
"recompose": "^0.27.1",
"redux": "^4.0.0",
"unfetch": "^3.0.0",
"winston": "^2.4.1"
"winston": "^2.4.2"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.47",
"@babel/preset-env": "^7.0.0-beta.47",
"@babel/preset-flow": "^7.0.0-beta.47",
"@babel/register": "^7.0.0-beta.47",
"babel-eslint": "^8.2.3",
"enzyme": "^3.3.0",
"eslint": "^4.19.1",
"eslint-config-fusion": "^1.0.0",
"eslint-plugin-cup": "^1.0.0",
"eslint-plugin-flowtype": "^2.46.2",
"eslint-plugin-import": "^2.11.0",
"eslint-config-fusion": "^2.0.0",
"eslint-plugin-cup": "^1.0.2",
"eslint-plugin-flowtype": "^2.47.1",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-react": "^7.7.0",
"flow-bin": "^0.70.0",
"eslint-plugin-react": "^7.8.2",
"flow-bin": "^0.72.0",
"nightmare": "^3.0.1",
"nightwatch": "^0.9.20",
"nightwatch": "^0.9.21",
"node-fetch": "^2.1.2",
"prettier": "1.12.1",
"react-addons-test-utils": "^15.6.2",
"react-test-renderer": "^16.3.2",
"request": "^2.85.0",
"request": "^2.87.0",
"selenium-download": "^2.0.12",
"tape": "^4.9.0"
},
Expand Down
8 changes: 8 additions & 0 deletions selenium-environments.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/** Copyright (c) 2018 Uber Technologies, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

/* globals module */

module.exports = {
Expand Down
18 changes: 15 additions & 3 deletions src/components/csrf-protection-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,34 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import React from 'react';
import {withFetch} from 'fusion-plugin-csrf-protection-react';

class FetchingComponent extends React.Component {
constructor(props) {
type Props = {
fetch: (a: string, ops: {}) => Promise<*>,
};

type State = {
loading?: boolean,
status: ?string,
};

class FetchingComponent extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
loading: true,
status: null,
};
}

componentDidMount() {
const {fetch} = this.props;
fetch('/test-fetch', {method: 'POST'}).then(resp => {
fetch('/test-fetch', {method: 'POST'}).then((resp: {status: string}) => {
this.setState({
loading: false,
status: resp.status,
Expand Down
9 changes: 7 additions & 2 deletions src/components/custom-fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import React, {Component} from 'react';
Expand All @@ -26,8 +28,11 @@ const FontedContainer = FontHOC('lato-regular')(
}))
);

export default class CustomFonts extends Component {
constructor(props, context) {
type Props = empty;
type Context = empty;

export default class CustomFonts extends Component<Props, Context> {
constructor(props: Props, context: Context) {
super(props, context);
}
render() {
Expand Down
2 changes: 2 additions & 0 deletions src/components/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import React from 'react';
Expand Down
38 changes: 27 additions & 11 deletions src/components/polyfill-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,30 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

/* globals window */

import React from 'react';

type Props = empty;
type State = {
symbol: ?boolean,
objectAssign: ?boolean,
arrayInclude: ?boolean,
arrayFind: ?boolean,
map: ?boolean,
promise: ?boolean,
weakMap: ?boolean,
set: ?boolean,
};

// For reasons unknown. Nightmare overrides polyfills in execute functions.
// So we need to insert polyfill results in the DOM
export default class PolyfillsTest extends React.Component {
constructor(props) {
export default class PolyfillsTest extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
symbol: null,
Expand Down Expand Up @@ -102,30 +116,32 @@ export default class PolyfillsTest extends React.Component {
return (
<div id="polyfills-root">
{this.state.symbol !== null ? (
<div id="symbol">{`symbol: ${this.state.symbol}`}</div>
<div id="symbol">{`symbol: ${String(this.state.symbol)}`}</div>
) : null}
{this.state.objectAssign !== null ? (
<div id="assign">{`assign: ${this.state.objectAssign}`}</div>
<div id="assign">{`assign: ${String(this.state.objectAssign)}`}</div>
) : null}
{this.state.arrayInclude !== null ? (
<div id="arrayinclude">{`array.include: ${
<div id="arrayinclude">{`array.include: ${String(
this.state.arrayInclude
}`}</div>
)}`}</div>
) : null}
{this.state.arrayFind !== null ? (
<div id="arrayfind">{`array.find: ${this.state.arrayFind}`}</div>
<div id="arrayfind">{`array.find: ${String(
this.state.arrayFind
)}`}</div>
) : null}
{this.state.map !== null ? (
<div id="map">{`map: ${this.state.map}`}</div>
<div id="map">{`map: ${String(this.state.map)}`}</div>
) : null}
{this.state.weakMap !== null ? (
<div id="weakMap">{`weakMap: ${this.state.weakMap}`}</div>
<div id="weakMap">{`weakMap: ${String(this.state.weakMap)}`}</div>
) : null}
{this.state.set !== null ? (
<div id="set">{`set: ${this.state.set}`}</div>
<div id="set">{`set: ${String(this.state.set)}`}</div>
) : null}
{this.state.promise !== null ? (
<div id="promise">{`promise: ${this.state.promise}`}</div>
<div id="promise">{`promise: ${String(this.state.promise)}`}</div>
) : null}
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/redux-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import React from 'react';
Expand Down
2 changes: 2 additions & 0 deletions src/components/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import React from 'react';
Expand Down
2 changes: 2 additions & 0 deletions src/components/rpc-redux-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import React from 'react';
Expand Down
8 changes: 8 additions & 0 deletions src/components/split-deferred.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/** Copyright (c) 2018 Uber Technologies, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import React from 'react';

export default function splitDeferred() {
Expand Down
2 changes: 2 additions & 0 deletions src/components/split-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import React from 'react';
Expand Down
2 changes: 2 additions & 0 deletions src/components/styletron.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import React from 'react';
Expand Down
2 changes: 2 additions & 0 deletions src/components/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import React from 'react';
Expand Down
2 changes: 2 additions & 0 deletions src/config/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

function getLoggerConfig() {
Expand Down
2 changes: 2 additions & 0 deletions src/font-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

/*
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

// @flow

import App from 'fusion-react';
import JWTSession, {
SessionCookieNameToken,
Expand Down
Loading

0 comments on commit a7c18f3

Please sign in to comment.