From 452a5bef1354f1e2dff737a03dd5d541fcb42a2b Mon Sep 17 00:00:00 2001 From: Moon Date: Tue, 22 Feb 2022 11:25:51 -0800 Subject: [PATCH] Style fix --- src/experiments/data/actions.js | 8 ++++---- src/experiments/data/index.js | 4 ++-- src/experiments/data/reducer.js | 8 ++++---- src/experiments/data/resolvers.js | 18 ++++++++--------- src/experiments/data/selectors.js | 2 +- src/experiments/index.js | 32 +++++++++++++++---------------- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/experiments/data/actions.js b/src/experiments/data/actions.js index 12647ff5952..fdf0f0fdd1d 100644 --- a/src/experiments/data/actions.js +++ b/src/experiments/data/actions.js @@ -4,9 +4,9 @@ import TYPES from './action-types'; import { EXPERIMENT_NAME_PREFIX } from './constants'; -export function toggleExperiment(experimentName) { +export function toggleExperiment( experimentName ) { const storageItem = JSON.parse( - window.localStorage.getItem(EXPERIMENT_NAME_PREFIX + experimentName) + window.localStorage.getItem( EXPERIMENT_NAME_PREFIX + experimentName ) ); const newVariation = @@ -16,7 +16,7 @@ export function toggleExperiment(experimentName) { window.localStorage.setItem( EXPERIMENT_NAME_PREFIX + experimentName, - JSON.stringify(storageItem) + JSON.stringify( storageItem ) ); return { @@ -26,7 +26,7 @@ export function toggleExperiment(experimentName) { }; } -export function setExperiments(experiments) { +export function setExperiments( experiments ) { return { type: TYPES.SET_EXPERIMENTS, experiments, diff --git a/src/experiments/data/index.js b/src/experiments/data/index.js index 969a750b7ad..e476479ea88 100644 --- a/src/experiments/data/index.js +++ b/src/experiments/data/index.js @@ -13,10 +13,10 @@ import * as selectors from './selectors'; import reducer from './reducer'; import { STORE_KEY } from './constants'; -export default registerStore(STORE_KEY, { +export default registerStore( STORE_KEY, { actions, selectors, resolvers, controls, reducer, -}); +} ); diff --git a/src/experiments/data/reducer.js b/src/experiments/data/reducer.js index fd6632d6bda..2bb33b6dded 100644 --- a/src/experiments/data/reducer.js +++ b/src/experiments/data/reducer.js @@ -7,18 +7,18 @@ const DEFAULT_STATE = { experiments: [], }; -const reducer = (state = DEFAULT_STATE, action) => { - switch (action.type) { +const reducer = ( state = DEFAULT_STATE, action ) => { + switch ( action.type ) { case TYPES.TOGGLE_EXPERIMENT: return { ...state, - experiments: state.experiments.map((experiment) => ({ + experiments: state.experiments.map( ( experiment ) => ( { ...experiment, variation: experiment.name === action.experimentName ? action.newVariation : experiment.variation, - })), + } ) ), }; case TYPES.SET_EXPERIMENTS: return { diff --git a/src/experiments/data/resolvers.js b/src/experiments/data/resolvers.js index 99531b3a148..754e32b64bf 100644 --- a/src/experiments/data/resolvers.js +++ b/src/experiments/data/resolvers.js @@ -5,20 +5,20 @@ import { setExperiments } from './actions'; import { EXPERIMENT_NAME_PREFIX } from './constants'; export function* getExperiments() { - const storageItems = Object.entries({ ...window.localStorage }).filter( - (item) => { - return item[0].indexOf(EXPERIMENT_NAME_PREFIX) === 0; + const storageItems = Object.entries( { ...window.localStorage } ).filter( + ( item ) => { + return item[ 0 ].indexOf( EXPERIMENT_NAME_PREFIX ) === 0; } ); - const experiments = storageItems.map((storageItem) => { - const [key, value] = storageItem; - const objectValue = JSON.parse(value); + const experiments = storageItems.map( ( storageItem ) => { + const [ key, value ] = storageItem; + const objectValue = JSON.parse( value ); return { - name: key.replace(EXPERIMENT_NAME_PREFIX, ''), + name: key.replace( EXPERIMENT_NAME_PREFIX, '' ), variation: objectValue.variationName || 'control', }; - }); + } ); - yield setExperiments(experiments); + yield setExperiments( experiments ); } diff --git a/src/experiments/data/selectors.js b/src/experiments/data/selectors.js index 83d271626cb..f988d197e32 100644 --- a/src/experiments/data/selectors.js +++ b/src/experiments/data/selectors.js @@ -1,3 +1,3 @@ -export function getExperiments(state) { +export function getExperiments( state ) { return state.experiments; } diff --git a/src/experiments/index.js b/src/experiments/index.js index c262bead923..97e110fb908 100644 --- a/src/experiments/index.js +++ b/src/experiments/index.js @@ -11,7 +11,7 @@ import { Button } from '@wordpress/components'; import { STORE_KEY } from './data/constants'; import './data'; -function Experiments({ experiments, toggleExperiment }) { +function Experiments( { experiments, toggleExperiment } ) { return (

Experiments

@@ -24,16 +24,16 @@ function Experiments({ experiments, toggleExperiment }) { - {experiments.map(({ name, variation }, index) => { + { experiments.map( ( { name, variation }, index ) => { return ( - - {name} - {variation} + + { name } + { variation }
@@ -49,17 +49,17 @@ function Experiments({ experiments, toggleExperiment }) { } export default compose( - withSelect((select) => { - const { getExperiments } = select(STORE_KEY); + withSelect( ( select ) => { + const { getExperiments } = select( STORE_KEY ); return { experiments: getExperiments(), }; - }), - withDispatch((dispatch) => { - const { toggleExperiment } = dispatch(STORE_KEY); + } ), + withDispatch( ( dispatch ) => { + const { toggleExperiment } = dispatch( STORE_KEY ); return { toggleExperiment, }; - }) -)(Experiments); + } ) +)( Experiments );