Skip to content

chore: Update @tanstack/config to v0.11.0 #7795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export default [
},
},
],
'ts/ban-types': 'off',
'ts/no-empty-function': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'no-case-declarations': 'off',
},
},
Expand Down
1 change: 0 additions & 1 deletion examples/react/offline/public/mockServiceWorker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
/* tslint:disable */

/**
* Mock Service Worker (2.1.7).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */

import type { CreateQueryResult } from '@tanstack/solid-query'
import type { JSX } from 'solid-js'
import { ErrorBoundary, Match, Suspense, Switch, children } from 'solid-js'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@cspell/eslint-plugin": "^8.9.1",
"@eslint-react/eslint-plugin": "^1.5.16",
"@solidjs/testing-library": "^0.8.8",
"@tanstack/config": "^0.10.0",
"@tanstack/config": "^0.11.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@types/eslint": "^8.56.10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function createNoopInjectionToken<
type TReturn = TMulti extends true ? Array<TValue> : TValue

const token =
// eslint-disable-next-line ts/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
(options as CreateInjectionTokenOptions<() => void, []>)?.token ||
new InjectionToken<TReturn>(description)
return [
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin-query/src/utils/ast-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ export const ASTUtils = {
const { node, context } = params

// we need the fallbacks for backwards compat with eslint < 8.37.0
// eslint-disable-next-line ts/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const sourceCode = context.sourceCode ?? context.getSourceCode()
// eslint-disable-next-line ts/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const scope = context.sourceCode.getScope(node)
? sourceCode.getScope(node)
: context.getScope()
Expand Down
2 changes: 1 addition & 1 deletion packages/query-codemods/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default [
{
rules: {
'cspell/spellchecker': 'off',
'ts/no-unnecessary-condition': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'import/no-duplicates': 'off',
'import/no-unresolved': 'off',
'import/order': 'off',
Expand Down
4 changes: 2 additions & 2 deletions packages/query-core/src/__tests__/notifyManager.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ describe('notifyManager', () => {
// we define some fn with its signature:
const fn: (a: string, b: number) => string = (a, b) => a + b

//now someFn expect to be called with args [a: string, b: number]
// now someFn expect to be called with args [a: string, b: number]
const someFn = notifyManagerTest.batchCalls(fn)

someFn('im happy', 4)

//@ts-expect-error
// @ts-expect-error
someFn('im not happy', false)
})
})
2 changes: 1 addition & 1 deletion packages/query-core/src/__tests__/onlineManager.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('onlineManager', () => {
const navigatorSpy = vi.spyOn(globalThis, 'navigator', 'get')

// Force navigator to be undefined
//@ts-expect-error
// @ts-expect-error
navigatorSpy.mockImplementation(() => undefined)
expect(onlineManager.isOnline()).toBeTruthy()

Expand Down
14 changes: 7 additions & 7 deletions packages/query-core/src/__tests__/queryObserver.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('queryObserver', () => {

queryClient.invalidateQueries({ queryKey: key, refetchType: 'all' })

//So we still expect it to not have fetched and not be fetching
// So we still expect it to not have fetched and not be fetching
expect(count).toBe(0)
expect(observer.getCurrentResult()).toMatchObject({
status: 'pending',
Expand All @@ -113,7 +113,7 @@ describe('queryObserver', () => {

expect(enabled).toBe(false)

//Not the same with explicit refetch, this will override enabled and trigger a fetch anyway
// Not the same with explicit refetch, this will override enabled and trigger a fetch anyway
observer.refetch()

expect(observer.getCurrentResult()).toMatchObject({
Expand Down Expand Up @@ -201,18 +201,18 @@ describe('queryObserver', () => {

queryClient.invalidateQueries({ queryKey: key, refetchType: 'inactive' })

//should not refetch since it was active and we only refetch inactive
// should not refetch since it was active and we only refetch inactive
await waitFor(() => expect(count).toBe(0))

queryClient.invalidateQueries({ queryKey: key, refetchType: 'active' })

//should refetch since it was active and we refetch active
// should refetch since it was active and we refetch active
await waitFor(() => expect(count).toBe(1))

// Toggle enabled
enabled = false

//should not refetch since it is not active and we only refetch active
// should not refetch since it is not active and we only refetch active
queryClient.invalidateQueries({ queryKey: key, refetchType: 'active' })

await waitFor(() => expect(count).toBe(1))
Expand Down Expand Up @@ -792,7 +792,7 @@ describe('queryObserver', () => {
new QueryObserver(queryClient, {
queryKey: key,
queryFn: () => 'data',
//@ts-expect-error
// @ts-expect-error
enabled: null,
}),
).toThrowError('Expected enabled to be a boolean')
Expand Down Expand Up @@ -947,7 +947,7 @@ describe('queryObserver', () => {
observer.setOptions({
queryKey: key,
queryFn: () => data,
//@ts-expect-error
// @ts-expect-error
select: () => undefined,
placeholderData: placeholderData2,
})
Expand Down
4 changes: 2 additions & 2 deletions packages/query-core/src/focusManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class FocusManager extends Subscribable<Listener> {
super()
this.#setup = (onFocus) => {
// addEventListener does not exist in React Native, but window does
// eslint-disable-next-line ts/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!isServer && window.addEventListener) {
const listener = () => onFocus()
// Listen to visibilitychange
Expand Down Expand Up @@ -78,7 +78,7 @@ export class FocusManager extends Subscribable<Listener> {
}

// document global can be unavailable in react native
// eslint-disable-next-line ts/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
return globalThis.document?.visibilityState !== 'hidden'
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/query-core/src/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ export function hydrate(
client.getDefaultOptions().hydrate?.deserializeData ??
defaultTransformerFn

// eslint-disable-next-line ts/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const mutations = (dehydratedState as DehydratedState).mutations || []
// eslint-disable-next-line ts/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const queries = (dehydratedState as DehydratedState).queries || []

mutations.forEach(({ state, ...mutationOptions }) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/onlineManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class OnlineManager extends Subscribable<Listener> {
super()
this.#setup = (onOnline) => {
// addEventListener does not exist in React Native, but window does
// eslint-disable-next-line ts/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!isServer && window.addEventListener) {
const onlineListener = () => onOnline(true)
const offlineListener = () => onOnline(false)
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default [
{
files: ['**/__tests__/**'],
rules: {
'ts/no-unnecessary-condition': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'react-compiler/react-compiler': 'off',
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query/src/HydrationBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const HydrationBoundary = ({
}

const queryCache = client.getQueryCache()
// eslint-disable-next-line ts/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const queries = (state as DehydratedState).queries || []

const newQueries: DehydratedState['queries'] = []
Expand Down
4 changes: 2 additions & 2 deletions packages/react-query/src/__tests__/useQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4034,7 +4034,7 @@ describe('useQuery', () => {
const query = useQuery({
queryKey: key,
queryFn: () => 'fetched data',
gcTime: 1000 * 60 * 10, //10 Minutes
gcTime: 1000 * 60 * 10, // 10 Minutes
})
return <div>{query.data}</div>
}
Expand Down Expand Up @@ -4216,7 +4216,7 @@ describe('useQuery', () => {

await waitFor(() => rendered.getByText('count: 1'))

await sleep(10) //extra sleep to make sure we're not re-fetching
await sleep(10) // extra sleep to make sure we're not re-fetching

expect(states.length).toEqual(2)

Expand Down
6 changes: 3 additions & 3 deletions packages/solid-query/src/__tests__/createQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3842,7 +3842,7 @@ describe('createQuery', () => {
const query = createQuery(() => ({
queryKey: key,
queryFn: () => 'fetched data',
gcTime: 1000 * 60 * 10, //10 Minutes
gcTime: 1000 * 60 * 10, // 10 Minutes
}))
return <div>{query.data}</div>
}
Expand Down Expand Up @@ -4047,7 +4047,7 @@ describe('createQuery', () => {

await waitFor(() => rendered.getByText('count: 1'))

await sleep(10) //extra sleep to make sure we're not re-fetching
await sleep(10) // extra sleep to make sure we're not re-fetching

expect(states.length).toEqual(2)

Expand Down Expand Up @@ -4560,7 +4560,7 @@ describe('createQuery', () => {
readonly [typeof key, number]
> = async (ctx) => {
const [, limit] = ctx.queryKey
// eslint-disable-next-line ts/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const value = limit % 2 && ctx.signal ? 'abort' : `data ${limit}`
await sleep(25)
return value
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-query/src/useBaseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export function useBaseQuery<
return new Promise<QueryObserverResult<TData, TError>>(
(resolve, reject) => {
let stopWatch = () => {
//noop
// noop
}
const run = () => {
if (defaultedOptions.value.enabled !== false) {
Expand Down
Loading
Loading