Skip to content

Commit fa40830

Browse files
committed
Fix @typescript-eslint/no-unused-expressions related issues
1 parent 9400722 commit fa40830

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packages/toolkit/src/immutableStateInvariantMiddleware.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Middleware } from 'redux'
2-
import type { AnyObject } from './tsHelpers'
32
import type { IgnorePaths } from './serializableStateInvariantMiddleware'
3+
import type { AnyObject } from './tsHelpers'
44
import { getTimeMeasureUtils } from './utils'
55

66
type EntryProcessor = (key: string, value: any) => any
@@ -189,8 +189,16 @@ export function createImmutableStateInvariantMiddleware(
189189
return function (this: any, key: string, value: any) {
190190
if (stack.length > 0) {
191191
const thisPos = stack.indexOf(this)
192-
~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
193-
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
192+
if (~thisPos) {
193+
stack.splice(thisPos + 1)
194+
} else {
195+
stack.push(this)
196+
}
197+
if (~thisPos) {
198+
keys.splice(thisPos, Infinity, key)
199+
} else {
200+
keys.push(key)
201+
}
194202
if (~stack.indexOf(value)) value = decycler!.call(this, key, value)
195203
} else stack.push(value)
196204

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ test(`query: handles large keepUnuseDataFor values over 32-bit ms`, async () =>
8686
expect(onCleanup).not.toHaveBeenCalled()
8787

8888
// _Should_ be called _wayyyy_ in the future (like 24.8 days from now)
89-
vi.advanceTimersByTime(THIRTY_TWO_BIT_MAX_TIMER_SECONDS * 1000),
90-
expect(onCleanup).toHaveBeenCalled()
89+
vi.advanceTimersByTime(THIRTY_TWO_BIT_MAX_TIMER_SECONDS * 1000)
90+
expect(onCleanup).toHaveBeenCalled()
9191
})
9292

9393
describe(`query: await cleanup, keepUnusedDataFor set`, () => {

0 commit comments

Comments
 (0)