Skip to content

Commit

Permalink
Update: package.json versions
Browse files Browse the repository at this point in the history
  • Loading branch information
keremcubuk committed Aug 18, 2020
1 parent 3fc3cfa commit 15553a9
Show file tree
Hide file tree
Showing 18 changed files with 2,800 additions and 2,296 deletions.
1 change: 0 additions & 1 deletion app/containers/App/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ enableES5(); // For EcmaScript support. If you erase this line you can get an er

export const initialState = {};

/* eslint-disable default-case, no-param-reassign */
const appReducer = (state = initialState, action) =>
produce(state, (/* draft */) => {
switch (action.type) {
Expand Down
8 changes: 2 additions & 6 deletions app/containers/App/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { initialState } from './reducer';
* Direct selector to the app state domain
*/

const selectAppDomain = state => state.app || initialState;
const selectAppDomain = (state) => state.app || initialState;

/**
* Other specific selectors
Expand All @@ -15,11 +15,7 @@ const selectAppDomain = state => state.app || initialState;
* Default selector used by App
*/

const makeSelectApp = () =>
createSelector(
selectAppDomain,
substate => substate,
);
const makeSelectApp = () => createSelector(selectAppDomain, (substate) => substate);

export default makeSelectApp;
export { selectAppDomain };
18 changes: 5 additions & 13 deletions app/containers/LanguageProvider/LocaleToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export function LocaleToggle(props) {
<Picker
selectedValue={props.locale}
style={{ height: 50, width: 50 }}
onValueChange={itemValue => props.onLocaleToggle(itemValue)}>
{appLocales.map(locale => (
onValueChange={(itemValue) => props.onLocaleToggle(itemValue)}>
{appLocales.map((locale) => (
<Picker.Item key={locale} label={messages[locale].defaultMessage} value={locale} />
))}
</Picker>
Expand All @@ -34,21 +34,13 @@ LocaleToggle.propTypes = {
locale: PropTypes.string,
};

const mapStateToProps = createSelector(
makeSelectLocale(),
locale => ({
locale,
}),
);
const mapStateToProps = createSelector(makeSelectLocale(), (locale) => ({ locale }));

export function mapDispatchToProps(dispatch) {
return {
onLocaleToggle: locale => dispatch(changeLocale(locale)),
onLocaleToggle: (locale) => dispatch(changeLocale(locale)),
dispatch,
};
}

export default connect(
mapStateToProps,
mapDispatchToProps,
)(LocaleToggle);
export default connect(mapStateToProps, mapDispatchToProps)(LocaleToggle);
7 changes: 1 addition & 6 deletions app/containers/LanguageProvider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ LanguageProvider.propTypes = {
children: PropTypes.element.isRequired,
};

const mapStateToProps = createSelector(
makeSelectLocale(),
locale => ({
locale,
}),
);
const mapStateToProps = createSelector(makeSelectLocale(), (locale) => ({ locale }));

export default connect(mapStateToProps)(LanguageProvider);
3 changes: 1 addition & 2 deletions app/containers/LanguageProvider/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ export const initialState = {
locale: DEFAULT_LOCALE,
};

/* eslint-disable default-case, no-param-reassign */
const languageProviderReducer = (state = initialState, action) =>
produce(state, draft => {
produce(state, (draft) => {
switch (action.type) {
case CHANGE_LOCALE:
draft.locale = action.locale;
Expand Down
8 changes: 2 additions & 6 deletions app/containers/LanguageProvider/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ import { initialState } from './reducer';
* Direct selector to the language domain
*/

const selectLanguage = state => state.language || initialState;
const selectLanguage = (state) => state.language || initialState;

/**
* Select the language locale
*/

const makeSelectLocale = () =>
createSelector(
selectLanguage,
languageState => languageState.locale,
);
const makeSelectLocale = () => createSelector(selectLanguage, (languageState) => languageState.locale);

export { selectLanguage, makeSelectLocale };
5 changes: 1 addition & 4 deletions app/containers/Welcome/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ function mapDispatchToProps(dispatch) {
};
}

const withConnect = connect(
mapStateToProps,
mapDispatchToProps,
);
const withConnect = connect(mapStateToProps, mapDispatchToProps);

export default compose(withConnect)(Welcome);
1 change: 0 additions & 1 deletion app/containers/Welcome/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { DEFAULT_ACTION } from './constants';

export const initialState = {};

/* eslint-disable default-case, no-param-reassign */
const welcomeReducer = (state = initialState, action) =>
produce(state, (/* draft */) => {
switch (action.type) {
Expand Down
8 changes: 2 additions & 6 deletions app/containers/Welcome/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { initialState } from './reducer';
* Direct selector to the welcome state domain
*/

const selectWelcomeDomain = state => state.welcome || initialState;
const selectWelcomeDomain = (state) => state.welcome || initialState;

/**
* Other specific selectors
Expand All @@ -15,11 +15,7 @@ const selectWelcomeDomain = state => state.welcome || initialState;
* Default selector used by Welcome
*/

const makeSelectWelcome = () =>
createSelector(
selectWelcomeDomain,
substate => substate,
);
const makeSelectWelcome = () => createSelector(selectWelcomeDomain, (substate) => substate);

export default makeSelectWelcome;
export { selectWelcomeDomain };
1 change: 0 additions & 1 deletion app/i18n.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
/**
* i18n.js
*
Expand Down
5 changes: 1 addition & 4 deletions app/utils/checkStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ export default function checkStore(store) {
injectedReducers: isObject,
injectedSagas: isObject,
};
invariant(
conformsTo(store, shape),
'(app/utils...) injectors: Expected a valid redux store',
);
invariant(conformsTo(store, shape), '(app/utils...) injectors: Expected a valid redux store');
}
7 changes: 3 additions & 4 deletions app/utils/injectReducer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { ReactReduxContext } from 'react-redux';
Expand All @@ -11,15 +12,13 @@ import getInjectors from './reducerInjectors';
* @param {function} reducer A reducer that will be injected
*
*/
export default ({ key, reducer }) => WrappedComponent => {
export default ({ key, reducer }) => (WrappedComponent) => {
class ReducerInjector extends React.Component {
static WrappedComponent = WrappedComponent;

static contextType = ReactReduxContext;

static displayName = `withReducer(${WrappedComponent.displayName ||
WrappedComponent.name ||
'Component'})`;
static displayName = `withReducer(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;

constructor(props, context) {
super(props, context);
Expand Down
7 changes: 3 additions & 4 deletions app/utils/injectSaga.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { ReactReduxContext } from 'react-redux';
Expand All @@ -16,15 +17,13 @@ import getInjectors from './sagaInjectors';
* - constants.ONCE_TILL_UNMOUNT — behaves like 'RESTART_ON_REMOUNT' but never runs it again.
*
*/
export default ({ key, saga, mode }) => WrappedComponent => {
export default ({ key, saga, mode }) => (WrappedComponent) => {
class InjectSaga extends React.Component {
static WrappedComponent = WrappedComponent;

static contextType = ReactReduxContext;

static displayName = `withSaga(${WrappedComponent.displayName ||
WrappedComponent.name ||
'Component'})`;
static displayName = `withSaga(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;

constructor(props, context) {
super(props, context);
Expand Down
2 changes: 1 addition & 1 deletion app/utils/loadable.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { lazy, Suspense } from 'react';
const loadable = (importFunc, { fallback = null } = { fallback: null }) => {
const LazyComponent = lazy(importFunc);

return props => (
return (props) => (
<Suspense fallback={fallback}>
<LazyComponent {...props} />
</Suspense>
Expand Down
4 changes: 1 addition & 3 deletions app/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,5 @@ function checkStatus(response) {
* @return {object} The response data
*/
export default function request(url, options) {
return fetch(url, options)
.then(checkStatus)
.then(parseJSON);
return fetch(url, options).then(checkStatus).then(parseJSON);
}
6 changes: 3 additions & 3 deletions app/utils/sagaInjectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { DAEMON, ONCE_TILL_UNMOUNT, RESTART_ON_REMOUNT } from './constants';

const allowedModes = [RESTART_ON_REMOUNT, DAEMON, ONCE_TILL_UNMOUNT];

const checkKey = key =>
const checkKey = (key) =>
invariant(isString(key) && !isEmpty(key), '(app/utils...) injectSaga: Expected `key` to be a non empty string');

const checkDescriptor = descriptor => {
const checkDescriptor = (descriptor) => {
const shape = {
saga: isFunction,
mode: mode => isString(mode) && allowedModes.includes(mode),
mode: (mode) => isString(mode) && allowedModes.includes(mode),
};
invariant(conformsTo(descriptor, shape), '(app/utils...) injectSaga: Expected a valid saga descriptor');
};
Expand Down
Loading

0 comments on commit 15553a9

Please sign in to comment.