Skip to content

Commit d25511b

Browse files
committed
Lint and format all files
1 parent 82630d2 commit d25511b

33 files changed

+463
-502
lines changed

src/components/Context.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function getContext(): Context<ReactReduxContextValue | null> {
3535
let realContext = contextMap.get(React.createContext)
3636
if (!realContext) {
3737
realContext = React.createContext<ReactReduxContextValue | null>(
38-
null as any
38+
null as any,
3939
)
4040
if (process.env.NODE_ENV !== 'production') {
4141
realContext.displayName = 'ReactRedux'

src/components/connect.tsx

+18-17
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ type EffectFunc = (...args: any[]) => void | ReturnType<React.EffectCallback>
7070
function useIsomorphicLayoutEffectWithArgs(
7171
effectFunc: EffectFunc,
7272
effectArgs: any[],
73-
dependencies?: React.DependencyList
73+
dependencies?: React.DependencyList,
7474
) {
7575
useIsomorphicLayoutEffect(() => effectFunc(...effectArgs), dependencies)
7676
}
@@ -83,7 +83,7 @@ function captureWrapperProps(
8383
wrapperProps: unknown,
8484
// actualChildProps: unknown,
8585
childPropsFromStoreUpdate: React.MutableRefObject<unknown>,
86-
notifyNestedSubs: () => void
86+
notifyNestedSubs: () => void,
8787
) {
8888
// We want to capture the wrapper props and child props we used for later comparisons
8989
lastWrapperProps.current = wrapperProps
@@ -110,7 +110,7 @@ function subscribeUpdates(
110110
childPropsFromStoreUpdate: React.MutableRefObject<unknown>,
111111
notifyNestedSubs: () => void,
112112
// forceComponentUpdateDispatch: React.Dispatch<any>,
113-
additionalSubscribeListener: () => void
113+
additionalSubscribeListener: () => void,
114114
) {
115115
// If we're not subscribed to the store, nothing to do here
116116
if (!shouldHandleStateChanges) return () => {}
@@ -136,7 +136,7 @@ function subscribeUpdates(
136136
// to determine what the child props should be
137137
newChildProps = childPropsSelector(
138138
latestStoreState,
139-
lastWrapperProps.current
139+
lastWrapperProps.current,
140140
)
141141
} catch (e) {
142142
error = e
@@ -466,13 +466,13 @@ function connect<
466466

467467
// the context consumer to use
468468
context = ReactReduxContext,
469-
}: ConnectOptions<unknown, unknown, unknown, unknown> = {}
469+
}: ConnectOptions<unknown, unknown, unknown, unknown> = {},
470470
): unknown {
471471
if (process.env.NODE_ENV !== 'production') {
472472
if (pure !== undefined && !hasWarnedAboutDeprecatedPureOption) {
473473
hasWarnedAboutDeprecatedPureOption = true
474474
warning(
475-
'The `pure` option has been removed. `connect` is now always a "pure/memoized" component'
475+
'The `pure` option has been removed. `connect` is now always a "pure/memoized" component',
476476
)
477477
}
478478
}
@@ -486,7 +486,7 @@ function connect<
486486
const shouldHandleStateChanges = Boolean(mapStateToProps)
487487

488488
const wrapWithConnect = <TProps,>(
489-
WrappedComponent: ComponentType<TProps>
489+
WrappedComponent: ComponentType<TProps>,
490490
) => {
491491
type WrappedComponentProps = TProps &
492492
ConnectPropsMaybeWithoutContext<TProps>
@@ -496,8 +496,8 @@ function connect<
496496
if (!isValid)
497497
throw new Error(
498498
`You must pass a component to the function returned by connect. Instead received ${stringifyComponent(
499-
WrappedComponent
500-
)}`
499+
WrappedComponent,
500+
)}`,
501501
)
502502
}
503503

@@ -529,7 +529,7 @@ function connect<
529529
}
530530

531531
function ConnectFunction<TOwnProps>(
532-
props: InternalConnectProps & TOwnProps
532+
props: InternalConnectProps & TOwnProps,
533533
) {
534534
const [propsContext, reactReduxForwardedRef, wrapperProps] =
535535
React.useMemo(() => {
@@ -548,11 +548,11 @@ function connect<
548548
if (process.env.NODE_ENV !== 'production') {
549549
const isValid = /*#__PURE__*/ isContextConsumer(
550550
// @ts-ignore
551-
<propsContext.Consumer />
551+
<propsContext.Consumer />,
552552
)
553553
if (!isValid) {
554554
throw new Error(
555-
'You must pass a valid React context consumer as `props.context`'
555+
'You must pass a valid React context consumer as `props.context`',
556556
)
557557
}
558558
ResultContext = propsContext
@@ -583,7 +583,7 @@ function connect<
583583
`Could not find "store" in the context of ` +
584584
`"${displayName}". Either wrap the root component in a <Provider>, ` +
585585
`or pass a custom React context provider to <Provider> and the corresponding ` +
586-
`React context consumer to ${displayName} in connect options.`
586+
`React context consumer to ${displayName} in connect options.`,
587587
)
588588
}
589589

@@ -609,7 +609,7 @@ function connect<
609609
// connected to the store via props shouldn't use subscription from context, or vice versa.
610610
const subscription = createSubscription(
611611
store,
612-
didStoreComeFromProps ? undefined : contextValue!.subscription
612+
didStoreComeFromProps ? undefined : contextValue!.subscription,
613613
)
614614

615615
// `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
@@ -703,7 +703,7 @@ function connect<
703703
isMounted,
704704
childPropsFromStoreUpdate,
705705
notifyNestedSubs,
706-
reactListener
706+
reactListener,
707707
)
708708
}
709709

@@ -730,10 +730,11 @@ function connect<
730730
actualChildPropsSelector,
731731
getServerState
732732
? () => childPropsSelector(getServerState(), wrapperProps)
733-
: actualChildPropsSelector
733+
: actualChildPropsSelector,
734734
)
735735
} catch (err) {
736736
if (latestSubscriptionCallbackError.current) {
737+
// eslint-disable-next-line no-extra-semi
737738
;(
738739
err as Error
739740
).message += `\nThe error may be correlated with this previous error:\n${latestSubscriptionCallbackError.current.stack}\n\n`
@@ -797,7 +798,7 @@ function connect<
797798
if (forwardRef) {
798799
const _forwarded = React.forwardRef(function forwardConnectRef(
799800
props,
800-
ref
801+
ref,
801802
) {
802803
// @ts-ignore
803804
return <Connect {...props} reactReduxForwardedRef={ref} />

src/connect/invalidArgFactory.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import type { Action, Dispatch } from 'redux'
33
export function createInvalidArgFactory(arg: unknown, name: string) {
44
return (
55
dispatch: Dispatch<Action<string>>,
6-
options: { readonly wrappedComponentName: string }
6+
options: { readonly wrappedComponentName: string },
77
) => {
88
throw new Error(
99
`Invalid value of type ${typeof arg} for ${name} argument when connecting component ${
1010
options.wrappedComponentName
11-
}.`
11+
}.`,
1212
)
1313
}
1414
}

src/connect/mapDispatchToProps.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import type { MapDispatchToPropsParam } from './selectorFactory'
77
export function mapDispatchToPropsFactory<TDispatchProps, TOwnProps>(
88
mapDispatchToProps:
99
| MapDispatchToPropsParam<TDispatchProps, TOwnProps>
10-
| undefined
10+
| undefined,
1111
) {
1212
return mapDispatchToProps && typeof mapDispatchToProps === 'object'
1313
? wrapMapToPropsConstant((dispatch: Dispatch<Action<string>>) =>
1414
// @ts-ignore
15-
bindActionCreators(mapDispatchToProps, dispatch)
15+
bindActionCreators(mapDispatchToProps, dispatch),
1616
)
1717
: !mapDispatchToProps
1818
? wrapMapToPropsConstant((dispatch: Dispatch<Action<string>>) => ({

src/connect/mapStateToProps.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createInvalidArgFactory } from './invalidArgFactory'
33
import type { MapStateToPropsParam } from './selectorFactory'
44

55
export function mapStateToPropsFactory<TStateProps, TOwnProps, State>(
6-
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>
6+
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
77
) {
88
return !mapStateToProps
99
? wrapMapToPropsConstant(() => ({}))

src/connect/mergeProps.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function defaultMergeProps<
1212
>(
1313
stateProps: TStateProps,
1414
dispatchProps: TDispatchProps,
15-
ownProps: TOwnProps
15+
ownProps: TOwnProps,
1616
): TMergedProps {
1717
// @ts-ignore
1818
return { ...ownProps, ...stateProps, ...dispatchProps }
@@ -24,7 +24,7 @@ export function wrapMergePropsFunc<
2424
TOwnProps,
2525
TMergedProps
2626
>(
27-
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>
27+
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
2828
): (
2929
dispatch: Dispatch<Action<string>>,
3030
options: {
@@ -34,15 +34,15 @@ export function wrapMergePropsFunc<
3434
) => MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps> {
3535
return function initMergePropsProxy(
3636
dispatch,
37-
{ displayName, areMergedPropsEqual }
37+
{ displayName, areMergedPropsEqual },
3838
) {
3939
let hasRunOnce = false
4040
let mergedProps: TMergedProps
4141

4242
return function mergePropsProxy(
4343
stateProps: TStateProps,
4444
dispatchProps: TDispatchProps,
45-
ownProps: TOwnProps
45+
ownProps: TOwnProps,
4646
) {
4747
const nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps)
4848

@@ -68,7 +68,7 @@ export function mergePropsFactory<
6868
TOwnProps,
6969
TMergedProps
7070
>(
71-
mergeProps?: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>
71+
mergeProps?: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
7272
) {
7373
return !mergeProps
7474
? () => defaultMergeProps

src/connect/selectorFactory.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function pureFinalPropsSelectorFactory<
7979
areStatesEqual,
8080
areOwnPropsEqual,
8181
areStatePropsEqual,
82-
}: PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State>
82+
}: PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State>,
8383
) {
8484
let hasRunAtLeastOnce = false
8585
let state: State
@@ -136,7 +136,7 @@ export function pureFinalPropsSelectorFactory<
136136
nextState,
137137
state,
138138
nextOwnProps,
139-
ownProps
139+
ownProps,
140140
)
141141
state = nextState
142142
ownProps = nextOwnProps
@@ -149,7 +149,7 @@ export function pureFinalPropsSelectorFactory<
149149

150150
return function pureFinalPropsSelector(
151151
nextState: State,
152-
nextOwnProps: TOwnProps
152+
nextOwnProps: TOwnProps,
153153
) {
154154
return hasRunAtLeastOnce
155155
? handleSubsequentCalls(nextState, nextOwnProps)
@@ -222,7 +222,7 @@ export default function finalPropsSelectorFactory<
222222
TDispatchProps,
223223
TMergedProps,
224224
State
225-
>
225+
>,
226226
) {
227227
const mapStateToProps = initMapStateToProps(dispatch, options)
228228
const mapDispatchToProps = initMapDispatchToProps(dispatch, options)

src/connect/verifySubselectors.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function verify(selector: unknown, methodName: string): void {
99
) {
1010
if (!Object.prototype.hasOwnProperty.call(selector, 'dependsOnOwnProps')) {
1111
warning(
12-
`The selector for ${methodName} of connect did not specify a value for dependsOnOwnProps.`
12+
`The selector for ${methodName} of connect did not specify a value for dependsOnOwnProps.`,
1313
)
1414
}
1515
}
@@ -18,7 +18,7 @@ function verify(selector: unknown, methodName: string): void {
1818
export default function verifySubselectors(
1919
mapStateToProps: unknown,
2020
mapDispatchToProps: unknown,
21-
mergeProps: unknown
21+
mergeProps: unknown,
2222
): void {
2323
verify(mapStateToProps, 'mapStateToProps')
2424
verify(mapDispatchToProps, 'mapDispatchToProps')

src/connect/wrapMapToProps.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function wrapMapToPropsConstant(
2626
dependsOnOwnProps?: boolean
2727
}
2828
| ActionCreatorsMapObject
29-
| ActionCreator<any>
29+
| ActionCreator<any>,
3030
) {
3131
return function initConstantSelector(dispatch: Dispatch) {
3232
const constant = getConstant(dispatch)
@@ -67,15 +67,15 @@ export function getDependsOnOwnProps(mapToProps: MapToProps) {
6767
//
6868
export function wrapMapToPropsFunc<P extends AnyProps = AnyProps>(
6969
mapToProps: MapToProps,
70-
methodName: string
70+
methodName: string,
7171
) {
7272
return function initProxySelector(
7373
dispatch: Dispatch,
74-
{ displayName }: { displayName: string }
74+
{ displayName }: { displayName: string },
7575
) {
7676
const proxy = function mapToPropsProxy(
7777
stateOrDispatch: StateOrDispatch,
78-
ownProps?: P
78+
ownProps?: P,
7979
): MapToProps {
8080
return proxy.dependsOnOwnProps
8181
? proxy.mapToProps(stateOrDispatch, ownProps)
@@ -87,7 +87,7 @@ export function wrapMapToPropsFunc<P extends AnyProps = AnyProps>(
8787

8888
proxy.mapToProps = function detectFactoryAndVerify(
8989
stateOrDispatch: StateOrDispatch,
90-
ownProps?: P
90+
ownProps?: P,
9191
): MapToProps {
9292
proxy.mapToProps = mapToProps
9393
proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps)

src/hooks/useReduxContext.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function createReduxContextHook(context = ReactReduxContext) {
1515

1616
if (process.env.NODE_ENV !== 'production' && !contextValue) {
1717
throw new Error(
18-
'could not find react-redux context value; please ensure the component is wrapped in a <Provider>'
18+
'could not find react-redux context value; please ensure the component is wrapped in a <Provider>',
1919
)
2020
}
2121

0 commit comments

Comments
 (0)