Skip to content

Commit f8fe2b5

Browse files
committed
Remove unused ESLint disable directives
1 parent 1960419 commit f8fe2b5

17 files changed

+31
-44
lines changed

packages/toolkit/src/createAsyncThunk.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,6 @@ export const createAsyncThunk = /* @__PURE__ */ (() => {
601601
}
602602

603603
if (conditionResult === false || abortController.signal.aborted) {
604-
// eslint-disable-next-line no-throw-literal
605604
throw {
606605
name: 'ConditionError',
607606
message: 'Aborted due to condition callback returning false.',

packages/toolkit/src/createSlice.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,10 @@ export type SliceCaseReducers<State> =
437437
/**
438438
* The type describing a slice's `selectors` option.
439439
*/
440-
export type SliceSelectors<State> = {
441-
[K: string]: (sliceState: State, ...args: any[]) => any
442-
}
440+
export type SliceSelectors<State> = Record<
441+
string,
442+
(sliceState: State, ...args: any[]) => any
443+
>
443444

444445
type SliceActionType<
445446
SliceName extends string,

packages/toolkit/src/entities/tests/sorted_state_adapter.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ describe('Sorted State Adapter', () => {
2121
let state: EntityState<BookModel, string>
2222

2323
beforeAll(() => {
24-
//eslint-disable-next-line
2524
Object.defineProperty(Array.prototype, 'unwantedField', {
2625
enumerable: true,
2726
configurable: true,

packages/toolkit/src/entities/tests/unsorted_state_adapter.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ describe('Unsorted State Adapter', () => {
1414
let state: EntityState<BookModel, string>
1515

1616
beforeAll(() => {
17-
//eslint-disable-next-line
1817
Object.defineProperty(Array.prototype, 'unwantedField', {
1918
enumerable: true,
2019
configurable: true,

packages/toolkit/src/entities/unsorted_state_adapter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function createUnsortedStateAdapter<T, Id extends EntityId>(
102102
}
103103

104104
function takeNewKey(
105-
keys: { [id: string]: Id },
105+
keys: Record<string, Id>,
106106
update: Update<T, Id>,
107107
state: R,
108108
): boolean {
@@ -132,9 +132,9 @@ export function createUnsortedStateAdapter<T, Id extends EntityId>(
132132
updates: ReadonlyArray<Update<T, Id>>,
133133
state: R,
134134
): void {
135-
const newKeys: { [id: string]: Id } = {}
135+
const newKeys: Record<string, Id> = {}
136136

137-
const updatesPerEntity: { [id: string]: Update<T, Id> } = {}
137+
const updatesPerEntity: Record<string, Update<T, Id>> = {}
138138

139139
updates.forEach((update) => {
140140
// Only apply updates to entities that currently exist

packages/toolkit/src/immutableStateInvariantMiddleware.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ function trackProperties(
3535
isImmutable: IsImmutableFunc,
3636
ignorePaths: IgnorePaths = [],
3737
obj: Record<string, any>,
38-
path: string = '',
39-
checkedObjects: Set<Record<string, any>> = new Set(),
38+
path = '',
39+
checkedObjects = new Set<Record<string, any>>(),
4040
) {
4141
const tracked: Partial<TrackedProperty> = { value: obj }
4242

@@ -66,8 +66,8 @@ function detectMutations(
6666
ignoredPaths: IgnorePaths = [],
6767
trackedProperty: TrackedProperty,
6868
obj: any,
69-
sameParentRef: boolean = false,
70-
path: string = '',
69+
sameParentRef = false,
70+
path = '',
7171
): { wasMutated: boolean; path?: string } {
7272
const prevObj = trackedProperty ? trackedProperty.value : undefined
7373

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export type SubscriptionOptions = {
108108
*/
109109
refetchOnFocus?: boolean
110110
}
111-
export type Subscribers = { [requestId: string]: SubscriptionOptions }
111+
export type Subscribers = Record<string, SubscriptionOptions>
112112
export type QueryKeys<Definitions extends EndpointDefinitions> = {
113113
[K in keyof Definitions]: Definitions[K] extends QueryDefinition<
114114
any,
@@ -245,13 +245,12 @@ export type InvalidationState<TagTypes extends string> = {
245245
}
246246
}
247247

248-
export type QueryState<D extends EndpointDefinitions> = {
249-
[queryCacheKey: string]: QuerySubState<D[string]> | undefined
250-
}
248+
export type QueryState<D extends EndpointDefinitions> = Record<
249+
string,
250+
QuerySubState<D[string]> | undefined
251+
>
251252

252-
export type SubscriptionState = {
253-
[queryCacheKey: string]: Subscribers | undefined
254-
}
253+
export type SubscriptionState = Record<string, Subscribers | undefined>
255254

256255
export type ConfigState<ReducerPath> = RefetchConfigOptions & {
257256
reducerPath: ReducerPath
@@ -265,9 +264,10 @@ export type ModifiableConfigState = {
265264
invalidationBehavior: 'delayed' | 'immediately'
266265
} & RefetchConfigOptions
267266

268-
export type MutationState<D extends EndpointDefinitions> = {
269-
[requestId: string]: MutationSubState<D[string]> | undefined
270-
}
267+
export type MutationState<D extends EndpointDefinitions> = Record<
268+
string,
269+
MutationSubState<D[string]> | undefined
270+
>
271271

272272
export type RootState<
273273
Definitions extends EndpointDefinitions,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ export function buildInitiate({
199199
api: Api<any, EndpointDefinitions, any, any>
200200
context: ApiContext<EndpointDefinitions>
201201
}) {
202-
const runningQueries: Map<
202+
const runningQueries = new Map<
203203
Dispatch,
204204
Record<string, QueryActionCreatorResult<any> | undefined>
205-
> = new Map()
206-
const runningMutations: Map<
205+
>()
206+
const runningMutations = new Map<
207207
Dispatch,
208208
Record<string, MutationActionCreatorResult<any> | undefined>
209-
> = new Map()
209+
>()
210210

211211
const {
212212
unsubscribeQueryResult,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ In the case of an unhandled error, no tags will be "provided" or "invalidated".`
604604
const force = hasTheForce(options) && options.force
605605
const maxAge = hasMaxAge(options) && options.ifOlderThan
606606

607-
const queryAction = (force: boolean = true) => {
607+
const queryAction = (force = true) => {
608608
const options = { forceRefetch: force, isPrefetch: true }
609609
return (
610610
api.endpoints[endpointName] as ApiEndpointQuery<any, any>

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export type CoreModule =
8585
export type ThunkWithReturnValue<T> = ThunkAction<T, any, any, UnknownAction>
8686

8787
export interface ApiModules<
88-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8988
BaseQuery extends BaseQueryFn,
9089
Definitions extends EndpointDefinitions,
9190
ReducerPath extends string,
@@ -396,9 +395,7 @@ export interface ApiModules<
396395
}
397396

398397
export interface ApiEndpointQuery<
399-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
400398
Definition extends QueryDefinition<any, any, any, any, any>,
401-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
402399
Definitions extends EndpointDefinitions,
403400
> extends BuildThunksApiEndpointQuery<Definition>,
404401
BuildInitiateApiEndpointQuery<Definition>,
@@ -410,11 +407,8 @@ export interface ApiEndpointQuery<
410407
Types: NonNullable<Definition['Types']>
411408
}
412409

413-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
414410
export interface ApiEndpointMutation<
415-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
416411
Definition extends MutationDefinition<any, any, any, any, any>,
417-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
418412
Definitions extends EndpointDefinitions,
419413
> extends BuildThunksApiEndpointMutation<Definition>,
420414
BuildInitiateApiEndpointMutation<Definition>,

0 commit comments

Comments
 (0)