-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding prettier, hook prettier up with eslint and formatting project
- Loading branch information
Roy Yu
committed
May 3, 2019
1 parent
7e439a3
commit 6dcd240
Showing
29 changed files
with
290 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { createStore } from 'redux'; | ||
import { createStore } from "redux"; | ||
|
||
export const getStore = (obj = {}) => createStore((state) => state, obj) | ||
export const getStore = (obj = {}) => createStore((state) => state, obj); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = 'test-file-stub'; | ||
module.exports = "test-file-stub"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,32 @@ | ||
import React, { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Provider } from 'react-redux' | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { Provider } from "react-redux"; | ||
// You could use BrowserRoute or HashRoute | ||
// But passing in history directly to Route will | ||
// give your app more flexibility on deeper integration of `history` | ||
import { Router } from 'react-router-dom' | ||
import { IntlProvider } from 'react-intl' | ||
import { Router } from "react-router-dom"; | ||
import { IntlProvider } from "react-intl"; | ||
|
||
export default class Root extends Component { | ||
get content() { | ||
const { routes, history } = this.props | ||
const { routes, history } = this.props; | ||
|
||
return ( | ||
<Router history={history}> | ||
{routes} | ||
</Router> | ||
) | ||
return <Router history={history}>{routes}</Router>; | ||
} | ||
|
||
render() { | ||
const { store } = this.props | ||
const { store } = this.props; | ||
|
||
return ( | ||
<IntlProvider locale="en"> | ||
<Provider store={store}> | ||
{this.content} | ||
</Provider> | ||
<Provider store={store}>{this.content}</Provider> | ||
</IntlProvider> | ||
) | ||
); | ||
} | ||
} | ||
|
||
Root.propTypes = { | ||
history: PropTypes.object.isRequired, | ||
routes: PropTypes.element.isRequired, | ||
store: PropTypes.object.isRequired, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { default as Example } from './Example'; | ||
export { default as ExampleWithError } from './ExampleWithError'; | ||
export { default as Example } from "./Example"; | ||
export { default as ExampleWithError } from "./ExampleWithError"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default as Header } from './Header'; | ||
export { default as Header } from "./Header"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import Loadable from 'react-loadable' | ||
import Loadable from "react-loadable"; | ||
|
||
import Loading from './Loading' | ||
import Loading from "./Loading"; | ||
|
||
export const create = (loader) => ( | ||
export const create = (loader) => | ||
Loadable({ | ||
loader, | ||
loading: Loading, | ||
}) | ||
) | ||
}); | ||
|
||
export default create | ||
export default create; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,46 @@ | ||
import React, { PureComponent } from 'react' | ||
import React, { PureComponent } from "react"; | ||
|
||
const style = { | ||
padding: '.75rem 1.25rem', | ||
marginBottom: '1rem', | ||
border: '1px solid transparent', | ||
borderRadius: '.25rem', | ||
color: '#721c24', | ||
backgroundColor: '#f8d7da', | ||
borderColor: '#f5c6cb', | ||
} | ||
padding: ".75rem 1.25rem", | ||
marginBottom: "1rem", | ||
border: "1px solid transparent", | ||
borderRadius: ".25rem", | ||
color: "#721c24", | ||
backgroundColor: "#f8d7da", | ||
borderColor: "#f5c6cb", | ||
}; | ||
|
||
class ErrorBoundary extends PureComponent { | ||
constructor(props) { | ||
super(props) | ||
super(props); | ||
this.state = { | ||
hasError: false, | ||
}; | ||
} | ||
|
||
componentDidCatch(error, info) { | ||
// you probably want to log it somewhere | ||
console.log(error, info) | ||
console.log(error, info); | ||
this.setState({ | ||
hasError: true, | ||
}); | ||
} | ||
|
||
render() { | ||
const { hasError } = this.state | ||
const { children } = this.props | ||
const { hasError } = this.state; | ||
const { children } = this.props; | ||
|
||
if (hasError) { | ||
return ( | ||
<div style={style}> | ||
Something is going wrong!! This error is caught by ErrorBoundary feature in React 16 \o/ | ||
Something is going wrong!! This error is caught by ErrorBoundary | ||
feature in React 16 \o/ | ||
</div> | ||
); | ||
} | ||
|
||
return children | ||
return children; | ||
} | ||
} | ||
|
||
export default ErrorBoundary | ||
export default ErrorBoundary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default as ErrorBoundary } from './ErrorBoundary'; | ||
export { default as ErrorBoundary } from "./ErrorBoundary"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export type exampleType = { | ||
title: string, | ||
description: string, | ||
source: string, | ||
} | ||
source: string | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,30 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { fromJS } from 'immutable' | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import { fromJS } from "immutable"; | ||
|
||
import routes from './routes' | ||
import Root from './Root' | ||
import configureStore from './redux/configureStore' | ||
import { history } from './app-history' | ||
import routes from "./routes"; | ||
import Root from "./Root"; | ||
import configureStore from "./redux/configureStore"; | ||
import { history } from "./app-history"; | ||
|
||
let initialState = {} | ||
let initialState = {}; | ||
|
||
// rehydrate initialState for JS app | ||
if (window.__INITIAL_STATE__) { | ||
initialState = window.__INITIAL_STATE__ | ||
initialState = window.__INITIAL_STATE__; | ||
|
||
// Transform into Immutable.js collections, | ||
// but leave top level keys untouched for Redux | ||
Object | ||
.keys(initialState) | ||
.forEach((key) => { | ||
initialState[key] = fromJS(initialState[key]) | ||
}) | ||
Object.keys(initialState).forEach((key) => { | ||
initialState[key] = fromJS(initialState[key]); | ||
}); | ||
} | ||
|
||
const store = configureStore(initialState, history) | ||
|
||
const store = configureStore(initialState, history); | ||
|
||
// Render the React application to the DOM | ||
// Root component is to bootstrap Provider, Router and DevTools | ||
ReactDOM.render( | ||
<Root history={history} routes={routes} store={store} />, | ||
document.getElementById('app-container') | ||
) | ||
document.getElementById("app-container") | ||
); |
Oops, something went wrong.