Skip to content

Commit 168a43f

Browse files
authored
Build/update prettier (#189)
* Update Prettier * Re-enable format checks * Fix formatting
1 parent 85923d4 commit 168a43f

8 files changed

+390
-184
lines changed

docs/api/otherExports.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,27 @@ Redux Starter Kit exports some of its internal utilities, and re-exports additio
1515

1616
Creates an instance of the `serializable-state-invariant` middleware described in [`getDefaultMiddleware`](./getDefaultMiddleware.md).
1717

18-
Accepts an options object with `isSerializable` and `getEntries` parameters. The former, `isSerializable`, will be used to determine if a value is considered serializable or not. If not provided, this defaults to `isPlain`. The latter, `getEntries`, will be used to retrieve nested values. If not provided, `Object.entries` will be used by default.
18+
Accepts an options object with `isSerializable` and `getEntries` parameters. The former, `isSerializable`, will be used to determine if a value is considered serializable or not. If not provided, this defaults to `isPlain`. The latter, `getEntries`, will be used to retrieve nested values. If not provided, `Object.entries` will be used by default.
1919

2020
Example:
2121

2222
```js
23-
import { Iterable } from 'immutable';
23+
import { Iterable } from 'immutable'
2424
import {
2525
configureStore,
2626
createSerializableStateInvariantMiddleware,
2727
isPlain
2828
} from 'redux-starter-kit'
2929

3030
// Augment middleware to consider Immutable.JS iterables serializable
31-
const isSerializable = (value) =>
32-
Iterable.isIterable(value) || isPlain(value)
31+
const isSerializable = value => Iterable.isIterable(value) || isPlain(value)
3332

34-
const getEntries = (value) =>
33+
const getEntries = value =>
3534
Iterable.isIterable(value) ? value.entries() : Object.entries(value)
3635

3736
const serializableMiddleware = createSerializableStateInvariantMiddleware({
3837
isSerializable,
39-
getEntries,
38+
getEntries
4039
})
4140

4241
const store = configureStore({

docs/usage/usage-guide.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -154,26 +154,27 @@ Here's some examples of how you can use `createReducer`. We'll start with a typi
154154

155155
```js
156156
function todosReducer(state = [], action) {
157-
switch(action.type) {
158-
case "ADD_TODO": {
159-
return state.concat(action.payload);
160-
}
161-
case "TOGGLE_TODO": {
162-
const {index} = action.payload;
163-
return state.map( (todo, i) => {
164-
if(i !== index) return todo;
165-
166-
return {
167-
...todo,
168-
completed : !todo.completed
169-
};
170-
});
171-
}
172-
case "REMOVE_TODO": {
173-
return state.filter( (todo, i) => i !== action.payload.index)
157+
switch (action.type) {
158+
case 'ADD_TODO': {
159+
return state.concat(action.payload)
160+
}
161+
case 'TOGGLE_TODO': {
162+
const { index } = action.payload
163+
return state.map((todo, i) => {
164+
if (i !== index) return todo
165+
166+
return {
167+
...todo,
168+
completed: !todo.completed
174169
}
175-
default : return state;
170+
})
176171
}
172+
case 'REMOVE_TODO': {
173+
return state.filter((todo, i) => i !== action.payload.index)
174+
}
175+
default:
176+
return state
177+
}
177178
}
178179
```
179180

0 commit comments

Comments
 (0)