Skip to content

Commit f401932

Browse files
committed
Fix lint problems and enable linting on CI
1 parent 4383544 commit f401932

File tree

13 files changed

+35
-28
lines changed

13 files changed

+35
-28
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
@@ -225,6 +225,14 @@ export const createListenerEntry: TypedCreateListenerEntry<unknown> = (
225225
return entry
226226
}
227227

228+
const cancelActiveListeners = (
229+
entry: ListenerEntry<unknown, Dispatch<AnyAction>>
230+
) => {
231+
entry.pending.forEach((controller) => {
232+
abortControllerWithReason(controller, listenerCancelled)
233+
})
234+
}
235+
228236
const createClearListenerMiddleware = (
229237
listenerMap: Map<string, ListenerEntry>
230238
) => {
@@ -281,14 +289,6 @@ const defaultErrorHandler: ListenerErrorHandler = (...args: unknown[]) => {
281289
console.error(`${alm}/error`, ...args)
282290
}
283291

284-
const cancelActiveListeners = (
285-
entry: ListenerEntry<unknown, Dispatch<AnyAction>>
286-
) => {
287-
entry.pending.forEach((controller) => {
288-
abortControllerWithReason(controller, listenerCancelled)
289-
})
290-
}
291-
292292
/**
293293
* @public
294294
*/

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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +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,
23-
ResultTypeFrom,
22+
ResultTypeFrom} from '../endpointDefinitions';
23+
import {
24+
isQueryDefinition
2425
} from '../endpointDefinitions'
2526
import { calculateProvidedBy } from '../endpointDefinitions'
2627
import type { AsyncThunkPayloadCreator, Draft } from '@reduxjs/toolkit'

packages/toolkit/src/query/createApi.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
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 type {
5+
SerializeQueryArgs} from './defaultSerializeQueryArgs';
46
import {
5-
defaultSerializeQueryArgs,
6-
SerializeQueryArgs,
7+
defaultSerializeQueryArgs
78
} from './defaultSerializeQueryArgs'
89
import type {
910
EndpointBuilder,

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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ 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 type {
29+
SerializedError} from '@reduxjs/toolkit';
2830
import {
2931
createListenerMiddleware,
30-
SerializedError,
3132
configureStore,
3233
} from '@reduxjs/toolkit'
3334
import { renderHook } from '@testing-library/react'

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

packages/toolkit/src/tests/autoBatchEnhancer.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { configureStore } from '../configureStore'
22
import { createSlice } from '../createSlice'
3+
import type {
4+
AutoBatchOptions} from '../autoBatchEnhancer';
35
import {
46
autoBatchEnhancer,
5-
prepareAutoBatched,
6-
AutoBatchOptions,
7+
prepareAutoBatched
78
} from '../autoBatchEnhancer'
89
import { delay } from '../utils'
910
import { debounce } from 'lodash'

packages/toolkit/src/tests/configureStore.typetest.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import type {
99
StoreEnhancer
1010
} from 'redux'
1111
import { applyMiddleware } from 'redux'
12-
import type { PayloadAction } from '@reduxjs/toolkit'
12+
import type { PayloadAction ,
13+
ConfigureStoreOptions} from '@reduxjs/toolkit'
1314
import {
1415
configureStore,
1516
getDefaultMiddleware,
16-
createSlice,
17-
ConfigureStoreOptions,
17+
createSlice
1818
} from '@reduxjs/toolkit'
1919
import type { ThunkMiddleware, ThunkAction, ThunkDispatch } from 'redux-thunk'
2020
import thunk from 'redux-thunk'

packages/toolkit/src/tests/injectableCombineReducers.example.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ export const rootReducer = combineSlices(sliceA, sliceB, {
3131
// fileC.ts
3232
// "naive" approach
3333

34-
import { rootReducer, RootState } from './reducer'
34+
import type { RootState } from './reducer';
35+
import { rootReducer } from './reducer'
3536
import { createSlice } from '@reduxjs/toolkit'
3637

3738
interface SliceCState {

0 commit comments

Comments
 (0)