Skip to content

Commit 0678c2e

Browse files
authored
Merge pull request #2992 from thorn0/lint1
2 parents d9374c7 + e33dfb7 commit 0678c2e

File tree

13 files changed

+55
-49
lines changed

13 files changed

+55
-49
lines changed

packages/toolkit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@
7777
"yargs": "^15.3.1"
7878
},
7979
"scripts": {
80-
"build-ci": "yarn rimraf dist && yarn tsc && node scripts/cli.js --skipExtraction",
80+
"build-ci": "yarn rimraf dist && yarn tsc && yarn lint && node scripts/cli.js --skipExtraction",
8181
"build-prepare": "npm run build-ci",
8282
"build": "yarn rimraf dist && yarn tsc && node scripts/cli.js --local --skipExtraction",
8383
"build-only": "yarn rimraf dist && yarn tsc && node scripts/cli.js --skipExtraction",
8484
"format": "prettier --write \"(src|examples)/**/*.{ts,tsx}\" \"**/*.md\"",
8585
"format:check": "prettier --list-different \"(src|examples)/**/*.{ts,tsx}\" \"docs/*/**.md\"",
86-
"lint": "eslint src examples",
86+
"lint": "eslint src",
8787
"test": "jest --runInBand",
8888
"type-tests": "yarn tsc -p src/tests/tsconfig.typetests.json && yarn tsc -p src/query/tests/tsconfig.typetests.json",
8989
"prepack": "npm run build-prepare"

packages/toolkit/src/listenerMiddleware/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,14 @@ export const createListenerEntry: TypedCreateListenerEntry<unknown> = (
228228
return entry
229229
}
230230

231+
const cancelActiveListeners = (
232+
entry: ListenerEntry<unknown, Dispatch<AnyAction>>
233+
) => {
234+
entry.pending.forEach((controller) => {
235+
abortControllerWithReason(controller, listenerCancelled)
236+
})
237+
}
238+
231239
const createClearListenerMiddleware = (
232240
listenerMap: Map<string, ListenerEntry>
233241
) => {
@@ -284,14 +292,6 @@ const defaultErrorHandler: ListenerErrorHandler = (...args: unknown[]) => {
284292
console.error(`${alm}/error`, ...args)
285293
}
286294

287-
const cancelActiveListeners = (
288-
entry: ListenerEntry<unknown, Dispatch<AnyAction>>
289-
) => {
290-
entry.pending.forEach((controller) => {
291-
abortControllerWithReason(controller, listenerCancelled)
292-
})
293-
}
294-
295295
/**
296296
* @public
297297
*/

packages/toolkit/src/query/core/buildMiddleware/batchActions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import type {
66
Subscribers,
77
} from '../apiState'
88
import { produceWithPatches } from 'immer'
9-
import { createSlice, PayloadAction, AnyAction } from '@reduxjs/toolkit'
9+
import type { AnyAction } from '@reduxjs/toolkit';
10+
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
1011

1112
// Copied from https://github.com/feross/queue-microtask
1213
let promise: Promise<any>

packages/toolkit/src/query/core/buildThunks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ import type {
1212
QueryActionCreatorResult,
1313
} from './buildInitiate'
1414
import { forceQueryFnSymbol, isUpsertQuery } from './buildInitiate'
15-
import {
15+
import type {
1616
AssertTagTypes,
1717
EndpointDefinition,
1818
EndpointDefinitions,
19-
isQueryDefinition,
2019
MutationDefinition,
2120
QueryArgFrom,
2221
QueryDefinition,
2322
ResultTypeFrom,
2423
} from '../endpointDefinitions'
24+
import { isQueryDefinition } from '../endpointDefinitions'
2525
import { calculateProvidedBy } from '../endpointDefinitions'
2626
import type { AsyncThunkPayloadCreator, Draft } from '@reduxjs/toolkit'
2727
import {

packages/toolkit/src/query/createApi.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import type { Api, ApiContext, Module, ModuleName } from './apiTypes'
22
import type { CombinedState } from './core/apiState'
33
import type { BaseQueryArg, BaseQueryFn } from './baseQueryTypes'
4-
import {
5-
defaultSerializeQueryArgs,
6-
SerializeQueryArgs,
7-
} from './defaultSerializeQueryArgs'
4+
import type { SerializeQueryArgs } from './defaultSerializeQueryArgs'
5+
import { defaultSerializeQueryArgs } from './defaultSerializeQueryArgs'
86
import type {
97
EndpointBuilder,
108
EndpointDefinitions,

packages/toolkit/src/query/endpointDefinitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { AnyAction, ThunkDispatch } from '@reduxjs/toolkit'
2-
import { SerializeQueryArgs } from './defaultSerializeQueryArgs'
2+
import type { SerializeQueryArgs } from './defaultSerializeQueryArgs'
33
import type { QuerySubState, RootState } from './core/apiState'
44
import type {
55
BaseQueryExtraOptions,

packages/toolkit/src/query/react/ApiProvider.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { configureStore } from '@reduxjs/toolkit'
2-
import { Context, useEffect } from 'react'
2+
import type { Context } from 'react'
3+
import { useEffect } from 'react'
34
import React from 'react'
45
import type { ReactReduxContextValue } from 'react-redux'
56
import { Provider } from 'react-redux'
@@ -50,7 +51,7 @@ export function ApiProvider<A extends Api<any, {}, any, any>>(props: {
5051
props.setupListeners === false
5152
? undefined
5253
: setupListeners(store.dispatch, props.setupListeners),
53-
[props.setupListeners]
54+
[props.setupListeners, store.dispatch]
5455
)
5556

5657
return (

packages/toolkit/src/query/retry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
BaseQueryExtraOptions,
66
BaseQueryFn,
77
} from './baseQueryTypes'
8-
import { FetchBaseQueryError } from './fetchBaseQuery'
8+
import type { FetchBaseQueryError } from './fetchBaseQuery'
99
import { HandledError } from './HandledError'
1010

1111
/**

packages/toolkit/src/query/tests/buildHooks.test.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ import {
2525
import { server } from './mocks/server'
2626
import type { AnyAction } from 'redux'
2727
import type { SubscriptionOptions } from '@reduxjs/toolkit/dist/query/core/apiState'
28-
import {
29-
createListenerMiddleware,
30-
SerializedError,
31-
configureStore,
32-
} from '@reduxjs/toolkit'
28+
import type { SerializedError } from '@reduxjs/toolkit'
29+
import { createListenerMiddleware, configureStore } from '@reduxjs/toolkit'
3330
import { renderHook } from '@testing-library/react'
3431
import { delay } from '../../utils'
3532

packages/toolkit/src/query/tests/createApi.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from './helpers'
1818
import { server } from './mocks/server'
1919
import { rest } from 'msw'
20-
import { SerializeQueryArgs } from '../defaultSerializeQueryArgs'
20+
import type { SerializeQueryArgs } from '../defaultSerializeQueryArgs'
2121
import { string } from 'yargs'
2222

2323
const originalEnv = process.env.NODE_ENV

0 commit comments

Comments
 (0)