Skip to content
Closed
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
6 changes: 6 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: latest
- name: Run Biome
run: biome ci .
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"*": ["prettier --write"]
"*": ["biome check --apply --no-errors-on-unmatched"]
}
10 changes: 0 additions & 10 deletions .prettierignore

This file was deleted.

51 changes: 51 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
"files": {
"ignore": [
"**/.next",
"**/.nx/cache",
"**/.svelte-kit",
"**/.output",
"**/.vinxi",
"**/build",
"**/coverage",
"**/dist",
"**/query-codemods/**/__testfixtures__",
"**/pnpm-lock.yaml",
"packages/**/tsup.config.bundled*.mjs",
"packages/**/vite.config.ts.*.mjs",
"**/tsconfig.vitest-temp.json"
],
"ignoreUnknown": true
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto"
},
"organizeImports": { "enabled": false },
"linter": { "enabled": false },
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingComma": "all",
"semicolons": "asNeeded",
"arrowParentheses": "always",
"bracketSpacing": true,
"bracketSameLine": false,
"quoteStyle": "single",
"attributePosition": "auto"
}
},
"json": {
"parser": {
"allowComments": true
}
},
"overrides": [{ "include": ["*.svelte"] }]
}
6 changes: 1 addition & 5 deletions examples/react/algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
6 changes: 1 addition & 5 deletions examples/react/basic-graphql-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
6 changes: 1 addition & 5 deletions examples/react/basic-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
6 changes: 1 addition & 5 deletions examples/react/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
6 changes: 1 addition & 5 deletions examples/react/default-query-function/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
10 changes: 2 additions & 8 deletions examples/react/offline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,14 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"msw": {
"workerDirectory": [
"public"
]
"workerDirectory": ["public"]
}
}
6 changes: 1 addition & 5 deletions examples/react/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
6 changes: 1 addition & 5 deletions examples/react/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
4 changes: 1 addition & 3 deletions examples/react/react-router/src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ export default function Index() {
This is a demo for integrating React Router with React Query.
<br />
Check out{' '}
<a href="https://reactrouter.com/">
the docs at reactrouter.com
</a> and{' '}
<a href="https://reactrouter.com/">the docs at reactrouter.com</a> and{' '}
<a href="https://tanstack.com/query/v5/docs/">the docs at tanstack.com</a>
.
</p>
Expand Down
6 changes: 1 addition & 5 deletions examples/react/rick-morty/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
6 changes: 1 addition & 5 deletions examples/react/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
6 changes: 1 addition & 5 deletions examples/react/star-wars/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
"vite": "^5.1.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
7 changes: 1 addition & 6 deletions examples/react/suspense/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,5 @@
"build": "vite build",
"preview": "vite preview"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
"browserslist": [">0.2%", "not dead", "not ie <= 11", "not op_mini all"]
}
5 changes: 2 additions & 3 deletions examples/solid/astro/src/layouts/MainLayout.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
import { SolidApp } from "../components/SolidApp";
const { id } = Astro.props;

import { SolidApp } from '../components/SolidApp'
const { id } = Astro.props
---

<html lang="en">
Expand Down
4 changes: 2 additions & 2 deletions examples/solid/astro/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import MainLayout from '../layouts/MainLayout.astro';
import MainLayout from '../layouts/MainLayout.astro'

const id = Astro.url.searchParams.get('id') || '';
const id = Astro.url.searchParams.get('id') || ''
---

<MainLayout id={id} />
20 changes: 10 additions & 10 deletions examples/svelte/auto-refetching/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<script lang="ts">
import '../app.css'
import { browser } from '$app/environment'
import { QueryClientProvider, QueryClient } from '@tanstack/svelte-query'
import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
import '../app.css'
import { browser } from '$app/environment'
import { QueryClientProvider, QueryClient } from '@tanstack/svelte-query'
import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'

const queryClient = new QueryClient({
defaultOptions: {
queries: {
enabled: browser,
},
const queryClient = new QueryClient({
defaultOptions: {
queries: {
enabled: browser,
},
})
},
})
</script>

<QueryClientProvider client={queryClient}>
Expand Down
48 changes: 24 additions & 24 deletions examples/svelte/auto-refetching/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<script lang="ts">
import {
useQueryClient,
createQuery,
createMutation,
} from '@tanstack/svelte-query'
import {
useQueryClient,
createQuery,
createMutation,
} from '@tanstack/svelte-query'

let intervalMs = 1000
let value: string
let intervalMs = 1000
let value: string

const client = useQueryClient()
const client = useQueryClient()

const endpoint = 'http://localhost:5173/api/data'
const endpoint = 'http://localhost:5173/api/data'

$: todos = createQuery<{ items: string[] }>({
queryKey: ['refetch'],
queryFn: async () => await fetch(endpoint).then((r) => r.json()),
// Refetch the data every second
refetchInterval: intervalMs,
})
$: todos = createQuery<{ items: string[] }>({
queryKey: ['refetch'],
queryFn: async () => await fetch(endpoint).then((r) => r.json()),
// Refetch the data every second
refetchInterval: intervalMs,
})

const addMutation = createMutation({
mutationFn: (value: string) =>
fetch(`${endpoint}?add=${value}`).then((r) => r.json()),
onSuccess: () => client.invalidateQueries({ queryKey: ['refetch'] }),
})
const addMutation = createMutation({
mutationFn: (value: string) =>
fetch(`${endpoint}?add=${value}`).then((r) => r.json()),
onSuccess: () => client.invalidateQueries({ queryKey: ['refetch'] }),
})

const clearMutation = createMutation({
mutationFn: () => fetch(`${endpoint}?clear=1`).then((r) => r.json()),
onSuccess: () => client.invalidateQueries({ queryKey: ['refetch'] }),
})
const clearMutation = createMutation({
mutationFn: () => fetch(`${endpoint}?clear=1`).then((r) => r.json()),
onSuccess: () => client.invalidateQueries({ queryKey: ['refetch'] }),
})
</script>

<h1>Auto Refetch with stale-time set to 1s</h1>
Expand Down
16 changes: 8 additions & 8 deletions examples/svelte/basic/src/lib/Post.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts">
import { createQuery } from '@tanstack/svelte-query'
import { getPostById } from './data'
import type { Post } from './types'
import { createQuery } from '@tanstack/svelte-query'
import { getPostById } from './data'
import type { Post } from './types'

export let postId: number
export let postId: number

const post = createQuery<Post>({
queryKey: ['post', postId],
queryFn: () => getPostById(postId),
})
const post = createQuery<Post>({
queryKey: ['post', postId],
queryFn: () => getPostById(postId),
})
</script>

<div>
Expand Down
Loading