Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[options]
module.name_mapper='^\(actions\|components\|constants\|containers\|reducers\|sagas\|store\|test\)\/\(.*\)$' -> '<PROJECT_ROOT>/src/\1/\2'
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"test:coverage": "jest --coverage",
"postinstall": "npm run build",
"eslint": "eslint .",
"flow": "flow",
"build": "cross-env NODE_ENV=production webpack --config ./webpack.production.js --progress --profile --colors",
"surge": "rm -rf dist && npm run build && cp dist/index.html dist/200.html && surge dist"
},
Expand Down Expand Up @@ -69,6 +70,7 @@
"express": "^4.16.1",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.3",
"flow-bin": "^0.57.3",
"history": "^4.7.2",
"html-loader": "^0.5.1",
"html-webpack-plugin": "^2.30.1",
Expand Down
8 changes: 7 additions & 1 deletion src/actions/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// @flow
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates


import { APP_LOAD } from 'constants/action-types';

export function loadApp() {
export type LoadApp = {
type: 'APP_LOAD'
}

export function loadApp(): LoadApp {
return {
type: APP_LOAD,
};
Expand Down
9 changes: 9 additions & 0 deletions src/actions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @flow
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates
Resolve error: package.json not found in path import/extensions

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates
Resolve error: package.json not found in path import/extensions


import type {
LoadApp
} from './app';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module './app' import/no-unresolved
Missing file extension for "./app" import/extensions

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module './app' import/no-unresolved
Missing file extension for "./app" import/extensions


export type ActionType = LoadApp;

export type Dispatch = (action: ActionType) => void;
4 changes: 3 additions & 1 deletion src/constants/action-types.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const APP_LOAD = 'APP_LOAD';
// @flow

export const APP_LOAD: 'APP_LOAD' = 'APP_LOAD';

export default { APP_LOAD };
25 changes: 17 additions & 8 deletions src/containers/app.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
// @flow
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates
Resolve error: package.json not found in path import/extensions
Resolve error: package.json not found in path import/no-named-as-default
Resolve error: package.json not found in path import/no-named-as-default-member


import React, { Component } from 'react';
import { connect } from 'react-redux';
import { loadApp } from 'actions/app';
import type { Dispatch } from 'actions/index';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'actions/index' import/no-unresolved
Missing file extension for "actions/index" import/extensions

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'actions/index' import/no-unresolved
Missing file extension for "actions/index" import/extensions

import type { State } from 'reducers/index';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'reducers/index' import/no-unresolved
Missing file extension for "reducers/index" import/extensions

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'reducers/index' import/no-unresolved
Missing file extension for "reducers/index" import/extensions

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'reducers/index' import/no-unresolved
Missing file extension for "reducers/index" import/extensions

import styles from './app.css';

type Props = {
dispatch: () => void,
type StateProps = {
loaded: boolean
}

export class AppContainer extends Component {
type Props = StateProps & {
dispatch: Dispatch
}

export class AppContainer extends Component<Props> {
componentDidMount() {
this.props.dispatch(loadApp());
}
const { dispatch } = this.props;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'dispatch' is missing in props validation react/prop-types


props: Props;
dispatch(loadApp());
}

render() {
if (!this.props.loaded) {
const { loaded } = this.props;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'loaded' is missing in props validation react/prop-types


if (!loaded) {
return null;
}

Expand All @@ -26,7 +35,7 @@ export class AppContainer extends Component {
}
}

function mapStateToProperties(state) {
function mapStateToProperties(state: State) {
return {
loaded: state.app.loaded
};
Expand Down
2 changes: 2 additions & 0 deletions src/containers/layout.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @flow
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates
Resolve error: package.json not found in path import/extensions
Resolve error: package.json not found in path import/no-absolute-path
Resolve error: package.json not found in path import/no-named-as-default
Resolve error: package.json not found in path import/no-named-as-default-member


import React from 'react';

type Props = {
Expand Down
17 changes: 11 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
// @flow
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates
Resolve error: package.json not found in path import/extensions
Resolve error: package.json not found in path import/no-absolute-path
Resolve error: package.json not found in path import/no-named-as-default
Resolve error: package.json not found in path import/no-named-as-default-member

import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import store from 'store';
import routes from 'routes';
import store from 'store/index';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'store/index' import/no-unresolved
Missing file extension for "store/index" import/extensions

import routes from './routes';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module './routes' import/no-unresolved
Missing file extension for "./routes" import/extensions


render(
<Provider store={store}>{routes}</Provider>,
document.getElementById('react')
);
const root = document.getElementById('react');

if (root) {
render(
<Provider store={store}>{routes}</Provider>,
root
);
}
13 changes: 10 additions & 3 deletions src/reducers/app.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
// @flow
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates
Resolve error: package.json not found in path import/extensions
Resolve error: package.json not found in path import/no-absolute-path


import type { ActionType } from 'actions/index';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'actions/index' import/no-unresolved
Missing file extension for "actions/index" import/extensions

import { APP_LOAD } from 'constants/action-types';

const initialState = {
loaded: false,
export type AppState = {
loaded: boolean
}

const initialState: AppState = {
loaded: false
};

export default function app(state = initialState, action) {
export default function app(state: AppState = initialState, action: ActionType) {
switch (action.type) {
case APP_LOAD:
return { ...state, loaded: true };
Expand Down
15 changes: 15 additions & 0 deletions src/reducers/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// @flow
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates
Resolve error: package.json not found in path import/extensions
Resolve error: package.json not found in path import/no-absolute-path


import type { Dispatch } from 'actions/index';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'actions/index' import/no-unresolved
Missing file extension for "actions/index" import/extensions

import type { AppState } from './app';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module './app' import/no-unresolved
Missing file extension for "./app" import/extensions


export { default as app } from './app';

export type State = {
app: AppState
};

export type Store = {
dispatch: Dispatch,
getState: () => State,
subscribe: (listener: () => void) => () => void
};

export default {};
2 changes: 2 additions & 0 deletions src/routes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @flow
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates
Resolve error: package.json not found in path import/extensions
Resolve error: package.json not found in path import/no-absolute-path
Resolve error: package.json not found in path import/no-named-as-default
Resolve error: package.json not found in path import/no-named-as-default-member


import React from 'react';
import { Switch, Route } from 'react-router';
import { ConnectedRouter } from 'connected-react-router';
Expand Down
4 changes: 3 additions & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// @flow
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve error: package.json not found in path import/no-unresolved
Resolve error: package.json not found in path import/no-duplicates
Resolve error: package.json not found in path import/extensions
Resolve error: package.json not found in path import/no-absolute-path


// Create final store using all reducers and applying middleware
import { createBrowserHistory } from 'history';
// Redux utility functions
import { compose, createStore, combineReducers, applyMiddleware } from 'redux';
import { routerMiddleware, connectRouter } from 'connected-react-router';
// Import all reducers
import * as reducers from 'reducers';
import * as reducers from 'reducers/index';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'reducers/index' import/no-unresolved
Missing file extension for "reducers/index" import/extensions


// Configure reducer to store state at state.router
// You can store it elsewhere by specifying a custom `routerStateSelector`
Expand Down
Loading