diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index e55f97ca723..1579e59404e 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -1,6 +1,11 @@ { "installCommand": "install:csb", - "sandboxes": ["/examples/react/basic-typescript", "/examples/solid/basic-typescript", "/examples/svelte/basic", "/examples/vue/basic"], + "sandboxes": [ + "/examples/react/basic-typescript", + "/examples/solid/basic-typescript", + "/examples/svelte/basic", + "/examples/vue/basic" + ], "packages": ["packages/**"], "node": "16" } diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 574da2aebee..a732b82fdeb 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,7 +1,7 @@ // @ts-check /** @type {import('eslint').Linter.Config} */ -module.exports = { +const config = { root: true, parser: '@typescript-eslint/parser', plugins: ['@typescript-eslint', 'import'], @@ -36,7 +36,8 @@ module.exports = { '@typescript-eslint/ban-types': 'off', '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/consistent-type-imports': [ - 'error', { prefer: 'type-imports' } + 'error', + { prefer: 'type-imports' }, ], '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-empty-interface': 'off', @@ -45,10 +46,12 @@ module.exports = { '@typescript-eslint/no-unnecessary-condition': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/no-inferrable-types': [ - 'error', { ignoreParameters: true }, + 'error', + { ignoreParameters: true }, ], 'import/default': 'off', 'import/export': 'off', + 'import/newline-after-import': 'error', 'import/no-cycle': 'error', 'import/no-duplicates': 'off', 'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }], @@ -65,3 +68,5 @@ module.exports = { }, ], } + +module.exports = config diff --git a/.prettierignore b/.prettierignore index 33552c173e9..addf185fd73 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,5 @@ -/packages/svelte-query/.svelte-kit -/packages/react-query/build +**/.next +**/.svelte-kit +**/build +**/dist /packages/codemods/**/__testfixtures__ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb15bae9204..b810dd59495 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,14 +27,17 @@ If you have been assigned to fix an issue or develop a new feature, please follo - Submit PR for review. ### Running examples + - Make sure you've installed the dependencies by running `$ pnpm install` in the repo's root directory. - If you want to run the example against your local changes, run `pnpm run watch` in the repo's root directory. Otherwise, it will be run against the latest TanStack Query release. - Run `pnpm run dev` in the selected examples' directory. #### Note on `examples/react-native` + React Native example requires Expo to work. Please follow the instructions from example's README.md file to learn more. #### Note on standalone execution + If you want to run an example without installing dependencies for the whole repo, just follow instructions from the example's README.md file. It will be then run against the latest TanStack Query release. ## Online one-click setup diff --git a/examples/react/algolia/tsconfig.json b/examples/react/algolia/tsconfig.json index ba028c590e8..1bccf6db010 100644 --- a/examples/react/algolia/tsconfig.json +++ b/examples/react/algolia/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "ES2020", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, @@ -20,7 +16,5 @@ "noEmit": true, "jsx": "react-jsx" }, - "include": [ - "src" - ] + "include": ["src"] } diff --git a/examples/react/auto-refetching/pages/api/data.js b/examples/react/auto-refetching/pages/api/data.js index 1d05eedc936..9c0cb358972 100755 --- a/examples/react/auto-refetching/pages/api/data.js +++ b/examples/react/auto-refetching/pages/api/data.js @@ -10,7 +10,7 @@ export default async (req, res) => { list = [] } - await new Promise(r => setTimeout(r, 100)) + await new Promise((r) => setTimeout(r, 100)) res.json(list) } diff --git a/examples/react/basic-typescript/tsconfig.json b/examples/react/basic-typescript/tsconfig.json index ba028c590e8..1bccf6db010 100644 --- a/examples/react/basic-typescript/tsconfig.json +++ b/examples/react/basic-typescript/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "ES2020", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, @@ -20,7 +16,5 @@ "noEmit": true, "jsx": "react-jsx" }, - "include": [ - "src" - ] + "include": ["src"] } diff --git a/examples/react/basic-typescript/vite.config.ts b/examples/react/basic-typescript/vite.config.ts index b1b5f91e5ff..9cc50ead1c0 100644 --- a/examples/react/basic-typescript/vite.config.ts +++ b/examples/react/basic-typescript/vite.config.ts @@ -1,7 +1,7 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react()] -}) + plugins: [react()], +}); diff --git a/examples/react/load-more-infinite-scroll/pages/about.js b/examples/react/load-more-infinite-scroll/pages/about.js index 9b74a26f207..e0a7edf0541 100755 --- a/examples/react/load-more-infinite-scroll/pages/about.js +++ b/examples/react/load-more-infinite-scroll/pages/about.js @@ -2,7 +2,7 @@ export default () => { return ( { + onClick={(e) => { window.history.back() e.preventDefault() }} diff --git a/examples/react/load-more-infinite-scroll/pages/index.js b/examples/react/load-more-infinite-scroll/pages/index.js index 782a3aa75fe..e06e50796f3 100755 --- a/examples/react/load-more-infinite-scroll/pages/index.js +++ b/examples/react/load-more-infinite-scroll/pages/index.js @@ -109,9 +109,7 @@ function Example() { )}
- - Go to another page - + Go to another page ) diff --git a/examples/react/nextjs/components/Header/index.js b/examples/react/nextjs/components/Header/index.js index cdd1d701a48..dca3216946f 100644 --- a/examples/react/nextjs/components/Header/index.js +++ b/examples/react/nextjs/components/Header/index.js @@ -10,7 +10,10 @@ export const Header = () => { Home - + Client-Only