From 917e397fe47516ebb945bc24b686eaabcd1ad7ac Mon Sep 17 00:00:00 2001 From: Victor Chabbert Date: Mon, 19 Dec 2016 09:37:58 +0100 Subject: Set editorconfig for front-end --- src/main/js/.editorconfig | 9 ++++ src/main/js/src/components/errors/Error404.js | 6 +-- src/main/js/src/containers/App/index.js | 15 +++--- src/main/js/src/containers/Counter/actions.js | 12 ++--- src/main/js/src/containers/Counter/index.js | 68 +++++++++++++-------------- src/main/js/src/containers/Counter/reducer.js | 24 +++++----- src/main/js/src/containers/Counter/saga.js | 6 +-- src/main/js/src/index.js | 14 +++--- src/main/js/src/reducers.js | 6 +-- src/main/js/src/sagas.js | 4 +- src/main/js/src/store.js | 38 +++++++-------- 11 files changed, 105 insertions(+), 97 deletions(-) create mode 100644 src/main/js/.editorconfig diff --git a/src/main/js/.editorconfig b/src/main/js/.editorconfig new file mode 100644 index 00000000..32c3b3d4 --- /dev/null +++ b/src/main/js/.editorconfig @@ -0,0 +1,9 @@ +root = false + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/src/main/js/src/components/errors/Error404.js b/src/main/js/src/components/errors/Error404.js index 13ce5ae5..b657482d 100644 --- a/src/main/js/src/components/errors/Error404.js +++ b/src/main/js/src/components/errors/Error404.js @@ -1,8 +1,8 @@ import React from 'react' import { Link } from 'react-router' -const Error404 = () =>
-

No Match

- Take me back home ! 🏠 +const Error404 = () =>
+

No Match

+ Take me back home ! 🏠
export default Error404 \ No newline at end of file diff --git a/src/main/js/src/containers/App/index.js b/src/main/js/src/containers/App/index.js index b190f960..e7eef332 100644 --- a/src/main/js/src/containers/App/index.js +++ b/src/main/js/src/containers/App/index.js @@ -1,10 +1,9 @@ import React from 'react' import { Link } from 'react-router' -export default () => { - return
-

Hello World

- Go to counter +/- -
- Go to 404 -
-} \ No newline at end of file + +export default () =>
+

Hello World

+ Go to counter +

+ Go to 404 +
\ No newline at end of file diff --git a/src/main/js/src/containers/Counter/actions.js b/src/main/js/src/containers/Counter/actions.js index 01cd8d67..abd6babb 100644 --- a/src/main/js/src/containers/Counter/actions.js +++ b/src/main/js/src/containers/Counter/actions.js @@ -1,20 +1,20 @@ import { - INCREMENT, DECREMENT, - INCREMENT_IF_ODD, INCREMENT_ASYNC + INCREMENT, DECREMENT, + INCREMENT_IF_ODD, INCREMENT_ASYNC } from './constants' export const increment = () => ({ - type: INCREMENT + type: INCREMENT }) export const decrement = () => ({ - type: DECREMENT + type: DECREMENT }) export const incrementIfOdd = () => ({ - type: INCREMENT_IF_ODD + type: INCREMENT_IF_ODD }) export const incrementAsync = () => ({ - type: INCREMENT_ASYNC + type: INCREMENT_ASYNC }) \ No newline at end of file diff --git a/src/main/js/src/containers/Counter/index.js b/src/main/js/src/containers/Counter/index.js index a91af8f5..0be665fd 100644 --- a/src/main/js/src/containers/Counter/index.js +++ b/src/main/js/src/containers/Counter/index.js @@ -2,50 +2,50 @@ import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { - increment, - decrement, - incrementAsync, - incrementIfOdd + increment, + decrement, + incrementAsync, + incrementIfOdd } from './actions' -const Counter = ({ value, increment, decrement, incrementIfOdd, incrementAsync }) => -

- Clicked: {value} times - {' '} - - {' '} - - {' '} - - {' '} - -

+const Counter = ({value, increment, decrement, incrementIfOdd, incrementAsync}) => +

+ Clicked: {value} times + {' '} + + {' '} + + {' '} + + {' '} + +

Counter.propTypes = { - value: PropTypes.number.isRequired, - increment: PropTypes.func.isRequired, - decrement: PropTypes.func.isRequired, - incrementAsync: PropTypes.func.isRequired, - incrementIfOdd: PropTypes.func.isRequired + value: PropTypes.number.isRequired, + increment: PropTypes.func.isRequired, + decrement: PropTypes.func.isRequired, + incrementAsync: PropTypes.func.isRequired, + incrementIfOdd: PropTypes.func.isRequired } const mapStateToProps = (state) => ({ - value: state.counter + value: state.counter }) const mapDispatchToProps = { - increment, - decrement, - incrementAsync, - incrementIfOdd + increment, + decrement, + incrementAsync, + incrementIfOdd } export default connect(mapStateToProps, mapDispatchToProps)(Counter) \ No newline at end of file diff --git a/src/main/js/src/containers/Counter/reducer.js b/src/main/js/src/containers/Counter/reducer.js index 586c4e0a..44006f3e 100644 --- a/src/main/js/src/containers/Counter/reducer.js +++ b/src/main/js/src/containers/Counter/reducer.js @@ -1,17 +1,17 @@ import { - INCREMENT, DECREMENT, - INCREMENT_IF_ODD + INCREMENT, DECREMENT, + INCREMENT_IF_ODD } from './constants' export default function reducer(state = 0, action) { - switch (action.type) { - case INCREMENT: - return state + 1 - case DECREMENT: - return state - 1 - case INCREMENT_IF_ODD: - return (state % 2 === 0) ? state + 1 : state - default: - return state - } + switch (action.type) { + case INCREMENT: + return state + 1 + case DECREMENT: + return state - 1 + case INCREMENT_IF_ODD: + return (state % 2 === 0) ? state + 1 : state + default: + return state + } } \ No newline at end of file diff --git a/src/main/js/src/containers/Counter/saga.js b/src/main/js/src/containers/Counter/saga.js index fe210620..0b9e2866 100644 --- a/src/main/js/src/containers/Counter/saga.js +++ b/src/main/js/src/containers/Counter/saga.js @@ -5,10 +5,10 @@ import { increment } from './actions' import { INCREMENT_ASYNC } from './constants' export function* incrementAsync() { - yield call(delay, 1000) - yield put(increment()) + yield call(delay, 1000) + yield put(increment()) } export default function* counterSaga() { - yield takeEvery(INCREMENT_ASYNC, incrementAsync) + yield takeEvery(INCREMENT_ASYNC, incrementAsync) } \ No newline at end of file diff --git a/src/main/js/src/index.js b/src/main/js/src/index.js index 926c756a..97af0f59 100644 --- a/src/main/js/src/index.js +++ b/src/main/js/src/index.js @@ -16,13 +16,13 @@ import Error404 from './components/errors/Error404' ReactDOM.render( - -
- - - -
-
+ +
+ + + +
+
, document.getElementById('root') ); diff --git a/src/main/js/src/reducers.js b/src/main/js/src/reducers.js index 82540b00..79014615 100644 --- a/src/main/js/src/reducers.js +++ b/src/main/js/src/reducers.js @@ -2,7 +2,7 @@ import { combineReducers } from 'redux' import counterReducer from './containers/Counter/reducer' export default function createReducer() { - return combineReducers({ - counter: counterReducer - }) + return combineReducers({ + counter: counterReducer + }) } \ No newline at end of file diff --git a/src/main/js/src/sagas.js b/src/main/js/src/sagas.js index 80222362..24776bf2 100644 --- a/src/main/js/src/sagas.js +++ b/src/main/js/src/sagas.js @@ -3,5 +3,5 @@ import { fork } from 'redux-saga/effects' import counterSaga from './containers/Counter/saga' export default function* rootSaga() { - yield fork(counterSaga) -} \ No newline at end of file + yield fork(counterSaga) +} diff --git a/src/main/js/src/store.js b/src/main/js/src/store.js index bbeb51bd..31c8aa71 100644 --- a/src/main/js/src/store.js +++ b/src/main/js/src/store.js @@ -5,29 +5,29 @@ import createSagaMiddleware from 'redux-saga' import rootSaga from './sagas' export default function configureStore(initialState = {}) { - const sagaMiddleware = createSagaMiddleware() + const sagaMiddleware = createSagaMiddleware() - const middlewares = [ - sagaMiddleware - ] + const middlewares = [ + sagaMiddleware + ] - const enhancers = [ - applyMiddleware(...middlewares) - ] + const enhancers = [ + applyMiddleware(...middlewares) + ] - const composeEnhancers = - process.env.NODE_ENV !== 'production' && - typeof window === 'object' && - window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? - window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : compose; + const composeEnhancers = + process.env.NODE_ENV !== 'production' && + typeof window === 'object' && + window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? + window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : compose; - const store = createStore( - createReducer(), - initialState, - composeEnhancers(...enhancers) - ) + const store = createStore( + createReducer(), + initialState, + composeEnhancers(...enhancers) + ) - sagaMiddleware.run(rootSaga) + sagaMiddleware.run(rootSaga) - return store + return store } -- cgit