Skip to content

Commit

Permalink
set app to standard
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDez committed Nov 25, 2016
1 parent e4ec723 commit da27832
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 207 deletions.
28 changes: 20 additions & 8 deletions package.json
Expand Up @@ -7,25 +7,23 @@
},
"scripts": {
"docs": "esdoc -c esdoc.json",
"preinstall": "node tools/nodeVersionCheck.js",
"setup": "node tools/setup/setupMessage.js && npm install && node tools/setup/setup.js",
"remove-demo": "babel-node tools/removeDemo.js",
"start-message": "babel-node tools/startMessage.js",
"prestart": "npm-run-all --parallel start-message remove-dist",
"start-message": "babel-node tools/startMessage.js",
"start": "npm-run-all --parallel test:watch open:src lint:watch",
"open:src": "babel-node tools/srcServer.js",
"open:dist": "babel-node tools/distServer.js",
"lint": "esw webpack.config.* src tools --color",
"lint:watch": "npm run lint -- --watch",
"lint:watch": "npm run lint:standard -- --watch",
"clean-dist": "npm run remove-dist && mkdir dist",
"remove-dist": "rimraf ./dist",
"prebuild": "npm run clean-dist && npm run lint && npm run test",
"prebuild": "npm run clean-dist && npm run lint:standard && npm run test",
"build": "babel-node tools/build.js && npm run open:dist",
"test": "mocha tools/testSetup.js \"src/app/**/*.js\" --reporter progress",
"test:cover": "babel-node node_modules/isparta/bin/isparta cover --root src --report html node_modules/mocha/bin/_mocha -- --require ./tools/testSetup.js \"src/app/**/*.js\" --reporter progress",
"test:cover:travis": "babel-node node_modules/isparta/bin/isparta cover --root src --report lcovonly _mocha -- --require ./tools/testSetup.js \"src/app/**/*.js\" && cat ./coverage/lcov.info | node_modules/coveralls/bin/coveralls.js",
"test:watch": "npm run test -- --watch",
"open:cover": "npm run test:cover && open coverage/index.html"
"open:cover": "npm run test:cover && open coverage/index.html",
"lint:standard": "standard ./src/**/*.js --verbose"
},
"author": "SebDez",
"license": "MIT",
Expand All @@ -47,6 +45,7 @@
"superagent": "2.1.0"
},
"devDependencies": {
"standard": "^7.1.1",
"autoprefixer": "6.3.7",
"babel-cli": "6.11.4",
"babel-core": "6.11.4",
Expand Down Expand Up @@ -101,5 +100,18 @@
"repository": {
"type": "git",
"url": ""
}
},
"standard": {
"globals": [
"before",
"describe",
"beforeEach",
"afterEach",
"it",
"expect"
],
"ignore": [
"webpack-public-path.js"
]
}
}
29 changes: 14 additions & 15 deletions src/app/components/App.js
@@ -1,6 +1,6 @@
import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import React /* , { PropTypes }*/ from 'react'
import { connect } from 'react-redux'
// import { bindActionCreators } from 'redux'

/**
* App container, used to define the whole app
Expand All @@ -9,38 +9,37 @@ import {bindActionCreators} from 'redux';
* @return {Object} React component tree
*/
export const App = (props) => {
return (
<div className="appContainer">
</div>);
};
return (
<div className='appContainer'>
</div>)
}

/**
* The container properties' types
* @type {Object}
*/
App.propTypes = {};

App.propTypes = {}

/**
* Map the global state into props
* @param {Object} state The global state
* @return {Object} The container props
*/
function mapStateToProps(state) {
return {};
function mapStateToProps (state) {
return {}
}

/**
* Maps the dispatch to props (to allow to execute action creator)
* @param {Object} dispatch The global dispatch
* @return {Object} The container props
*/
function mapDispatchToProps(dispatch) {
function mapDispatchToProps (dispatch) {
return {}
}

App.mapStateToProps=mapStateToProps;
App.mapDispatchToProps=mapDispatchToProps;
App.mapStateToProps = mapStateToProps
App.mapDispatchToProps = mapDispatchToProps

/**
* Connect the component to access global state object
Expand All @@ -51,4 +50,4 @@ App.mapDispatchToProps=mapDispatchToProps;
export default connect(
mapStateToProps,
mapDispatchToProps
)(App);
)(App)
20 changes: 8 additions & 12 deletions src/app/components/App.spec.js
@@ -1,16 +1,12 @@
import React from 'react';
import {shallow} from 'enzyme';
import {expect} from 'chai';
import {App} from './App';
// import React from 'react'
// import { shallow } from 'enzyme'
import { expect } from 'chai'
import { App } from './App'

describe('App', () => {

const props = {};

describe('mapDispatchToProps', () => {
it('Should return empty object', () => {
expect(App.mapDispatchToProps().actions).to.be.empty;
});
});

});
expect(App.mapDispatchToProps().actions).to.be.empty
})
})
})
16 changes: 8 additions & 8 deletions src/app/reducers/index.js
@@ -1,17 +1,17 @@
import { combineReducers } from 'redux';
import {routerReducer} from 'react-router-redux';
import {i18nReducer } from 'react-redux-i18n';
import { combineReducers } from 'redux'
import { routerReducer } from 'react-router-redux'
import { i18nReducer } from 'react-redux-i18n'

/**
* Get the root reducer object
* @return {Object} The root reducer object
*/
const rootReducer = combineReducers({
i18n: i18nReducer,
routing: routerReducer
});
const rootReducer = combineReducers({
i18n: i18nReducer,
routing: routerReducer
})

/**
* Export the reducer
*/
export default rootReducer;
export default rootReducer
30 changes: 15 additions & 15 deletions src/app/store/configureStore.dev.js
Expand Up @@ -2,35 +2,35 @@
// This boilerplate file is likely to be the same for each project that uses Redux.
// With Redux, the actual stores are in /reducers.

import {createStore, compose, applyMiddleware} from 'redux';
import { loadTranslations, setLocale, syncTranslationWithStore } from 'react-redux-i18n';
import thunk from 'redux-thunk';
import rootReducer from '../reducers';
import translationsObject from './../../assets/lang/index';
import { createStore, compose, applyMiddleware } from 'redux'
import { loadTranslations, setLocale, syncTranslationWithStore } from 'react-redux-i18n'
import thunk from 'redux-thunk'
import rootReducer from '../reducers'
import translationsObject from './../../assets/lang/index'

/**
* Configure the store for the DEV mode
* @param {Object} initialState The initialState given
* @return {Object} The app store
*/
export default function configureStore(initialState) {
export default function configureStore (initialState) {
const store = createStore(rootReducer, initialState, applyMiddleware(thunk), compose(
// Add other middleware on this line...
window.devToolsExtension ? window.devToolsExtension() : f => f // add support for Redux dev tools
)
);
)
)

if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
const nextReducer = require('../reducers').default; // eslint-disable-line global-require
store.replaceReducer(nextReducer);
});
const nextReducer = require('../reducers').default // eslint-disable-line global-require
store.replaceReducer(nextReducer)
})
}

syncTranslationWithStore(store);
store.dispatch(loadTranslations(translationsObject));
store.dispatch(setLocale('fr'));
syncTranslationWithStore(store)
store.dispatch(loadTranslations(translationsObject))
store.dispatch(setLocale('fr'))

return store;
return store
}
4 changes: 2 additions & 2 deletions src/app/store/configureStore.js
@@ -1,5 +1,5 @@
if (process.env.NODE_ENV === 'production') {
module.exports = require('./configureStore.prod');
module.exports = require('./configureStore.prod')
} else {
module.exports = require('./configureStore.dev');
module.exports = require('./configureStore.dev')
}
23 changes: 11 additions & 12 deletions src/app/store/configureStore.prod.js
@@ -1,21 +1,20 @@
import {createStore, applyMiddleware} from 'redux';
import { loadTranslations, setLocale, syncTranslationWithStore } from 'react-redux-i18n';
import thunk from 'redux-thunk';
import rootReducer from '../reducers';
import translationsObject from './../../assets/lang/index';
import { createStore, applyMiddleware } from 'redux'
import { loadTranslations, setLocale, syncTranslationWithStore } from 'react-redux-i18n'
import thunk from 'redux-thunk'
import rootReducer from '../reducers'
import translationsObject from './../../assets/lang/index'

/**
* Configure the store for the PROD mode
* @param {Object} initialState The initialState given
* @return {Object} The app store
*/
export default function configureStore(initialState) {
export default function configureStore (initialState) {
const store = createStore(rootReducer, initialState, applyMiddleware(thunk))

const store = createStore(rootReducer, initialState, applyMiddleware(thunk));
syncTranslationWithStore(store)
store.dispatch(loadTranslations(translationsObject))
store.dispatch(setLocale('fr'))

syncTranslationWithStore(store);
store.dispatch(loadTranslations(translationsObject));
store.dispatch(setLocale('fr'));

return store;
return store
}
12 changes: 6 additions & 6 deletions src/app/store/initialState.js
@@ -1,10 +1,10 @@
export default {
user:{
token:null
user: {
token: null
},
app:{
auth:{
isLoginModalOpen:false
app: {
auth: {
isLoginModalOpen: false
}
}
};
}
32 changes: 16 additions & 16 deletions src/assets/lang/en.js
@@ -1,17 +1,17 @@
export default {
application: {
homePage:{
linkTo:'Home'
},
kingdomPage:{
linkTo:'Kingdom'
},
header:{
login:'Login',
logout:'Disconnect'
}
},
date: {
long: 'MMMM Do, YYYY'
}
};
application: {
homePage: {
linkTo: 'Home'
},
kingdomPage: {
linkTo: 'Kingdom'
},
header: {
login: 'Login',
logout: 'Disconnect'
}
},
date: {
long: 'MMMM Do, YYYY'
}
}
22 changes: 11 additions & 11 deletions src/assets/lang/fr.js
@@ -1,17 +1,17 @@
export default {
application: {
homePage:{
linkTo:'Accueil'
},
kingdomPage:{
linkTo:'Royaume'
},
header:{
login:'Se connecter',
logout:'Se déconnecter'
}
homePage: {
linkTo: 'Accueil'
},
kingdomPage: {
linkTo: 'Royaume'
},
header: {
login: 'Se connecter',
logout: 'Se déconnecter'
}
},
date: {
long: 'D MMMM YYYY'
}
};
}
6 changes: 3 additions & 3 deletions src/assets/lang/index.js
@@ -1,7 +1,7 @@
import en from './en';
import fr from './fr';
import en from './en'
import fr from './fr'

export default {
en,
fr
};
}
24 changes: 12 additions & 12 deletions src/index.js
@@ -1,23 +1,23 @@
/* eslint-disable import/default */

import React from 'react';
import {render} from 'react-dom';
import { Provider } from 'react-redux';
import { Router, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { Router, browserHistory } from 'react-router'
import { syncHistoryWithStore } from 'react-router-redux'

import routes from './routes';
import configureStore from './app/store/configureStore';
require('./favicon.ico'); // Tell webpack to load favicon.ico
import './styles/styles.scss'; // Yep, that's right. You can import SASS/CSS files too! Webpack will run the associated loader and plug this into the page.
import routes from './routes'
import configureStore from './app/store/configureStore'
require('./favicon.ico') // Tell webpack to load favicon.ico
import './styles/styles.scss' // Yep, that's right. You can import SASS/CSS files too! Webpack will run the associated loader and plug this into the page.

const store = configureStore();
const store = configureStore()

// Create an enhanced history that syncs navigation events with the store
const history = syncHistoryWithStore(browserHistory, store);
const history = syncHistoryWithStore(browserHistory, store)

render(
<Provider store={store}>
<Router history={history} routes={routes(store)} />
</Provider>, document.getElementById('app')
);
)

0 comments on commit da27832

Please sign in to comment.