Skip to content
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
5 changes: 5 additions & 0 deletions docs/community-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ others:
url: 'https://github.com/rametta/rapini',
description: '🥬 OpenAPI to React Query (or SWR) & Axios',
},
{
title: 'React Query Visualizer',
url: 'https://marketplace.visualstudio.com/items?itemName=fe-dudu.react-query-visualizer',
description: 'VS Code extension for TanStack Query (React Query): visualize query keys, cache invalidation/refetch flows, and file impact graph',
},
{
title: 'Tanstack Query Visualizer',
url: 'https://tanstack-query-visualizer.sofi.coop/',
Expand Down
4 changes: 2 additions & 2 deletions examples/angular/auto-refetching/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
4 changes: 2 additions & 2 deletions examples/angular/basic-persister/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
4 changes: 2 additions & 2 deletions examples/angular/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
4 changes: 2 additions & 2 deletions examples/angular/devtools-panel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
4 changes: 2 additions & 2 deletions examples/angular/infinite-query-with-max-pages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
4 changes: 2 additions & 2 deletions examples/angular/optimistic-updates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
4 changes: 2 additions & 2 deletions examples/angular/pagination/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
4 changes: 2 additions & 2 deletions examples/angular/query-options-from-a-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
4 changes: 2 additions & 2 deletions examples/angular/router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
4 changes: 2 additions & 2 deletions examples/angular/rxjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
4 changes: 2 additions & 2 deletions examples/angular/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run this example:

- `npm install` or `yarn` or `pnpm i` or `bun i`
- `npm run start` or `yarn start` or `pnpm start` or `bun start`
- `pnpm install`
- `pnpm start`
114 changes: 114 additions & 0 deletions packages/eslint-plugin-query/src/__tests__/no-void-query-fn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,58 @@ ruleTester.run('no-void-query-fn', rule, {
})
`,
},
{
name: 'prefetchQuery queryFn returns a value',
code: normalizeIndent`
import { QueryClient } from '@tanstack/react-query'

const queryClient = new QueryClient()
queryClient.prefetchQuery({
queryKey: ['test'],
queryFn: () => fetch('/api/test').then((r) => r.json()),
})
`,
},
{
name: 'prefetchInfiniteQuery queryFn returns a value',
code: normalizeIndent`
import { QueryClient } from '@tanstack/react-query'

const queryClient = new QueryClient()
queryClient.prefetchInfiniteQuery({
queryKey: ['test'],
queryFn: ({ pageParam }: { pageParam: number }) =>
fetch(\`/api/test?page=\${pageParam}\`).then((r) => r.json()),
initialPageParam: 0,
})
`,
},
{
name: 'ensureQueryData queryFn returns a value',
code: normalizeIndent`
import { QueryClient } from '@tanstack/react-query'

const queryClient = new QueryClient()
queryClient.ensureQueryData({
queryKey: ['test'],
queryFn: () => fetch('/api/test').then((r) => r.json()),
})
`,
},
{
name: 'ensureInfiniteQueryData queryFn returns a value',
code: normalizeIndent`
import { QueryClient } from '@tanstack/react-query'

const queryClient = new QueryClient()
queryClient.ensureInfiniteQueryData({
queryKey: ['test'],
queryFn: ({ pageParam }: { pageParam: number }) =>
fetch(\`/api/test?page=\${pageParam}\`).then((r) => r.json()),
initialPageParam: 0,
})
`,
},
],
invalid: [
{
Expand Down Expand Up @@ -439,5 +491,67 @@ ruleTester.run('no-void-query-fn', rule, {
`,
errors: [{ messageId: 'noVoidReturn' }],
},
{
name: 'prefetchQuery queryFn returns void',
code: normalizeIndent`
import { QueryClient } from '@tanstack/react-query'

const queryClient = new QueryClient()
queryClient.prefetchQuery({
queryKey: ['test'],
queryFn: async () => {
await fetch('/api/test')
},
})
`,
errors: [{ messageId: 'noVoidReturn' }],
},
{
name: 'prefetchInfiniteQuery queryFn returns void',
code: normalizeIndent`
import { QueryClient } from '@tanstack/react-query'

const queryClient = new QueryClient()
queryClient.prefetchInfiniteQuery({
queryKey: ['test'],
queryFn: async ({ pageParam }: { pageParam: number }) => {
await fetch(\`/api/test?page=\${pageParam}\`)
},
initialPageParam: 0,
})
`,
errors: [{ messageId: 'noVoidReturn' }],
},
{
name: 'ensureQueryData queryFn returns void',
code: normalizeIndent`
import { QueryClient } from '@tanstack/react-query'

const queryClient = new QueryClient()
queryClient.ensureQueryData({
queryKey: ['test'],
queryFn: async () => {
await fetch('/api/test')
},
})
`,
errors: [{ messageId: 'noVoidReturn' }],
},
{
name: 'ensureInfiniteQueryData queryFn returns void',
code: normalizeIndent`
import { QueryClient } from '@tanstack/react-query'

const queryClient = new QueryClient()
queryClient.ensureInfiniteQueryData({
queryKey: ['test'],
queryFn: async ({ pageParam }: { pageParam: number }) => {
await fetch(\`/api/test?page=\${pageParam}\`)
},
initialPageParam: 0,
})
`,
errors: [{ messageId: 'noVoidReturn' }],
},
],
})
Loading