Skip to content

Commit c1bf2e7

Browse files
committed
Format all files
1 parent a59d2b8 commit c1bf2e7

File tree

103 files changed

+5363
-5349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+5363
-5349
lines changed

.github/workflows/build-and-test-types.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ jobs:
131131
'node-standard',
132132
'node-esm',
133133
'react-native',
134-
'expo'
134+
'expo',
135135
]
136136
steps:
137137
- name: Checkout repo

CHANGELOG.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const mySelector = createSelector(
4040
values => {
4141
console.log('calling..')
4242
return values.reduce((acc, val) => acc + val, 0)
43-
}
43+
},
4444
)
4545

4646
var createSelector = require('./dist/reselect.js').createSelector
@@ -50,7 +50,7 @@ const mySelector = createSelector(
5050
values => {
5151
console.log('calling..')
5252
return values.reduce((acc, val) => acc + val, 0)
53-
}
53+
},
5454
)
5555

5656
var state1 = { values: [1, 2, 3, 4, 5, 6, 7, 8, 9] }
@@ -189,8 +189,8 @@ const structuredSelector = createSelector(
189189
(a, b, c) => ({
190190
a,
191191
b,
192-
c
193-
})
192+
c,
193+
}),
194194
)
195195
```
196196

@@ -202,7 +202,7 @@ const mySelectorB = state => state.b
202202

203203
const structuredSelector = createStructuredSelector({
204204
x: mySelectorA,
205-
y: mySelectorB
205+
y: mySelectorB,
206206
})
207207

208208
const result = structuredSelector({ a: 1, b: 2 }) // will produce {x: 1, y: 2}
@@ -256,7 +256,7 @@ Selector creators can receive a variadic number of dependencies as well as an ar
256256
```js
257257
const selector = createSelector(
258258
[state => state.a, state => state.b],
259-
(a, b) => a * b
259+
(a, b) => a * b,
260260
)
261261
```
262262

@@ -266,7 +266,7 @@ const selector = createSelector(
266266
const selector = createSelector(
267267
state => state.a,
268268
state => state.b,
269-
(a, b) => a * b
269+
(a, b) => a * b,
270270
)
271271
```
272272

@@ -279,7 +279,7 @@ const selector = createSelector(
279279
state => state.a,
280280
(state, props) => state.b * props.c,
281281
(_, props) => props.d,
282-
(a, bc, d) => a + bc + d
282+
(a, bc, d) => a + bc + d,
283283
)
284284
```
285285

@@ -297,7 +297,7 @@ const selector = customSelectorCreator(
297297
(a, b) => {
298298
called++
299299
return a + b
300-
}
300+
},
301301
)
302302
assert.equal(selector({ a: 1, b: 2 }), 3)
303303
assert.equal(selector({ a: 1, b: 2 }), 3)

CREDITS.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# CREDITS
22

3-
* Based on a proposal for Redux by [Robert Binna](https://github.com/speedskater) and Philip Spitzlinger.
3+
- Based on a proposal for Redux by [Robert Binna](https://github.com/speedskater) and Philip Spitzlinger.
44
Lots of the basic structure of the code is thanks to this.
55

6-
* Refactored into reselect library by Martijn Faassen and Lee Bannard
6+
- Refactored into reselect library by Martijn Faassen and Lee Bannard
77
at the React Europe Hackathon 2015. Also added tests.
88

9-
* Contributors: Lee Bannard, Martijn Faassen, Robert Binna, Alex
9+
- Contributors: Lee Bannard, Martijn Faassen, Robert Binna, Alex
1010
Guerra, ryanatkn, Adam Royle, Christian Schuhmann, Jason Huang,
1111
Daniel Barreto, Mihail Diordiev, Daniela Borges, Philip Spitzlinger,
1212
C. T. Lin, SpainTrain, Mark Dalgleish, Brian Ng, 长天之云, Michael Lancaster,
@@ -19,6 +19,6 @@
1919
Whien, Sergei Egorov, Jim Bolla, Carl Bernardo, Daniel Lytkin, John Haley,
2020
alex3165,
2121

22-
* Inspired by getters in Nuclear.js and subscriptions in re-frame.
22+
- Inspired by getters in Nuclear.js and subscriptions in re-frame.
2323

24-
* Special thanks to [David Edmonson](https://github.com/threehams) for maintaining the Typescript type definitions.
24+
- Special thanks to [David Edmonson](https://github.com/threehams) for maintaining the Typescript type definitions.

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ interface RootState {
6666
const state: RootState = {
6767
todos: [
6868
{ id: 0, completed: false },
69-
{ id: 1, completed: true }
69+
{ id: 1, completed: true },
7070
],
7171
alerts: [
7272
{ id: 0, read: false },
73-
{ id: 1, read: true }
74-
]
73+
{ id: 1, read: true },
74+
],
7575
}
7676

7777
const selectCompletedTodos = (state: RootState) => {
@@ -88,7 +88,7 @@ const memoizedSelectCompletedTodos = createSelector(
8888
todos => {
8989
console.log('memoized selector ran')
9090
return todos.filter(todo => todo.completed === true)
91-
}
91+
},
9292
)
9393

9494
memoizedSelectCompletedTodos(state) // memoized selector ran
@@ -98,7 +98,7 @@ memoizedSelectCompletedTodos(state)
9898
console.log(selectCompletedTodos(state) === selectCompletedTodos(state)) //=> false
9999

100100
console.log(
101-
memoizedSelectCompletedTodos(state) === memoizedSelectCompletedTodos(state)
101+
memoizedSelectCompletedTodos(state) === memoizedSelectCompletedTodos(state),
102102
) //=> true
103103
```
104104

@@ -121,7 +121,7 @@ The below example serves as a visual aid:
121121
```ts
122122
const outputSelector = createSelector(
123123
[inputSelector1, inputSelector2, inputSelector3], // synonymous with `dependencies`.
124-
resultFunc // Result function
124+
resultFunc, // Result function
125125
)
126126
```
127127

codecov.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
comment:
2-
layout: "reach, diff, flags, files"
2+
layout: 'reach, diff, flags, files'
33
behavior: default
4-
require_changes: false # if true: only post the comment if coverage changes
5-
require_base: no # [yes :: must have a base report to post]
6-
require_head: no # [yes :: must have a head report to post]
4+
require_changes: false # if true: only post the comment if coverage changes
5+
require_base: no # [yes :: must have a base report to post]
6+
require_head: no # [yes :: must have a head report to post]

docs/examples/FAQ/createCurriedSelector.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const createCurriedSelector = <
66
InputSelectors extends SelectorArray,
77
Result,
88
OverrideMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,
9-
OverrideArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize
9+
OverrideArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,
1010
>(
1111
...args: Parameters<
1212
typeof createSelector<

docs/examples/FAQ/createParametricSelectorHook.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,31 @@ const state: RootState = {
1717
id: 0,
1818
completed: false,
1919
title: 'Figure out if plants are really plotting world domination.',
20-
description: 'They may be.'
20+
description: 'They may be.',
2121
},
2222
{
2323
id: 1,
2424
completed: true,
2525
title: 'Practice telekinesis for 15 minutes',
26-
description: 'Just do it'
27-
}
26+
description: 'Just do it',
27+
},
2828
],
2929
alerts: [
3030
{ id: 0, read: false },
31-
{ id: 1, read: true }
32-
]
31+
{ id: 1, read: true },
32+
],
3333
}
3434

3535
const selectTodoById = createSelector(
3636
[(state: RootState) => state.todos, (state: RootState, id: number) => id],
37-
(todos, id) => todos.find(todo => todo.id === id)
37+
(todos, id) => todos.find(todo => todo.id === id),
3838
)
3939

4040
export const createParametricSelectorHook = <
4141
Result,
42-
Params extends readonly unknown[]
42+
Params extends readonly unknown[],
4343
>(
44-
selector: (state: RootState, ...params: Params) => Result
44+
selector: (state: RootState, ...params: Params) => Result,
4545
) => {
4646
return (...args: Params) => {
4747
return useSelector((state: RootState) => selector(state, ...args))

docs/examples/FAQ/currySelector.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ export const currySelector = <
55
State,
66
Result,
77
Params extends readonly any[],
8-
AdditionalFields
8+
AdditionalFields,
99
>(
10-
selector: ((state: State, ...args: Params) => Result) & AdditionalFields
10+
selector: ((state: State, ...args: Params) => Result) & AdditionalFields,
1111
) => {
1212
const curriedSelector = (...args: Params) => {
1313
return (state: State) => {
@@ -20,6 +20,6 @@ export const currySelector = <
2020
const selectTodoByIdCurried = currySelector(
2121
createSelector(
2222
[(state: RootState) => state.todos, (state: RootState, id: number) => id],
23-
(todos, id) => todos.find(todo => todo.id === id)
24-
)
23+
(todos, id) => todos.find(todo => todo.id === id),
24+
),
2525
)

docs/examples/FAQ/howToTest.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ interface RootState {
99
const state: RootState = {
1010
todos: [
1111
{ id: 0, completed: false },
12-
{ id: 1, completed: true }
12+
{ id: 1, completed: true },
1313
],
1414
alerts: [
1515
{ id: 0, read: false },
16-
{ id: 1, read: true }
17-
]
16+
{ id: 1, read: true },
17+
],
1818
}
1919

2020
// With `Vitest` or `Jest`
2121
test('selector unit test', () => {
2222
const selectTodoIds = createSelector(
2323
[(state: RootState) => state.todos],
24-
todos => todos.map(({ id }) => id)
24+
todos => todos.map(({ id }) => id),
2525
)
2626
const firstResult = selectTodoIds(state)
2727
const secondResult = selectTodoIds(state)
@@ -42,7 +42,7 @@ test('selector unit test', () => {
4242
test('selector unit test', () => {
4343
const selectTodoIds = createSelector(
4444
[(state: RootState) => state.todos],
45-
todos => todos.map(({ id }) => id)
45+
todos => todos.map(({ id }) => id),
4646
)
4747
const firstResult = selectTodoIds(state)
4848
const secondResult = selectTodoIds(state)

docs/examples/FAQ/identity.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ const identity = <Func extends (...args: any[]) => any>(func: Func) => func
44

55
const createNonMemoizedSelector = createSelectorCreator({
66
memoize: identity,
7-
argsMemoize: identity
7+
argsMemoize: identity,
88
})

docs/examples/FAQ/selectorRecomputing.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface RootState {
88
const selectAlertsByType = createSelector(
99
[
1010
(state: RootState) => state.alerts,
11-
(state: RootState, type: string) => type
11+
(state: RootState, type: string) => type,
1212
],
1313
(alerts, type) => alerts.filter(todo => todo.type === type),
1414
{
@@ -20,7 +20,7 @@ const selectAlertsByType = createSelector(
2020
console.log('Changed argument:', a, 'to', b)
2121
}
2222
return a === b
23-
}
24-
}
25-
}
23+
},
24+
},
25+
},
2626
)

docs/examples/basicUsage.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ interface RootState {
88
const state: RootState = {
99
todos: [
1010
{ id: 0, completed: false },
11-
{ id: 1, completed: true }
11+
{ id: 1, completed: true },
1212
],
1313
alerts: [
1414
{ id: 0, read: false },
15-
{ id: 1, read: true }
16-
]
15+
{ id: 1, read: true },
16+
],
1717
}
1818

1919
const selectCompletedTodos = (state: RootState) => {
@@ -30,7 +30,7 @@ const memoizedSelectCompletedTodos = createSelector(
3030
todos => {
3131
console.log('memoized selector ran')
3232
return todos.filter(todo => todo.completed === true)
33-
}
33+
},
3434
)
3535

3636
memoizedSelectCompletedTodos(state) // memoized selector ran
@@ -40,5 +40,5 @@ memoizedSelectCompletedTodos(state)
4040
console.log(selectCompletedTodos(state) === selectCompletedTodos(state)) //=> false
4141

4242
console.log(
43-
memoizedSelectCompletedTodos(state) === memoizedSelectCompletedTodos(state)
43+
memoizedSelectCompletedTodos(state) === memoizedSelectCompletedTodos(state),
4444
) //=> true

docs/examples/createSelector/annotateResultFunction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ const selectTodoIds = createAppSelector(
2323
// ❌ Known limitation: Parameter types are not inferred in this scenario
2424
// so you will have to manually annotate them.
2525
// highlight-start
26-
(todos: Todo[]) => todos.map(({ id }) => id)
26+
(todos: Todo[]) => todos.map(({ id }) => id),
2727
// highlight-end
2828
)

docs/examples/createSelector/createAppSelector.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ export const createAppSelector = createSelectorCreator({
1313
memoizeOptions: {
1414
maxSize: 10,
1515
equalityCheck: shallowEqual,
16-
resultEqualityCheck: shallowEqual
16+
resultEqualityCheck: shallowEqual,
1717
},
1818
argsMemoizeOptions: {
1919
isEqual: shallowEqual,
20-
maxSize: 10
20+
maxSize: 10,
2121
},
2222
devModeChecks: {
2323
identityFunctionCheck: 'never',
24-
inputStabilityCheck: 'always'
25-
}
24+
inputStabilityCheck: 'always',
25+
},
2626
}).withTypes<RootState>()
2727

2828
const selectReadAlerts = createAppSelector(
2929
[
3030
// Type of `state` is set to `RootState`, no need to manually set the type
3131
// highlight-start
32-
state => state.alerts
32+
state => state.alerts,
3333
// highlight-end
3434
],
35-
alerts => alerts.filter(({ read }) => read)
35+
alerts => alerts.filter(({ read }) => read),
3636
)

docs/examples/createSelector/withTypes.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const selectTodoIds = createAppSelector(
1111
[
1212
// Type of `state` is set to `RootState`, no need to manually set the type
1313
// highlight-start
14-
state => state.todos
14+
state => state.todos,
1515
// highlight-end
1616
],
17-
todos => todos.map(({ id }) => id)
17+
todos => todos.map(({ id }) => id),
1818
)

docs/examples/createStructuredSelector/MyComponent.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface Props {
99

1010
const MyComponent: FC<Props> = ({ id }) => {
1111
const { todos, alerts, todoById } = useSelector((state: RootState) =>
12-
structuredSelector(state, id)
12+
structuredSelector(state, id),
1313
)
1414

1515
return (

0 commit comments

Comments
 (0)