From 95266b04efaa37dae24cb245d87d209270ab183a Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 28 May 2023 21:23:35 +1000 Subject: [PATCH 01/13] Broken ts-check --- .eslintrc.cjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 574da2aebe..343e5ec288 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'], @@ -65,3 +65,5 @@ module.exports = { }, ], } + +module.exports = config; From 2c3ff1bd3f6bbe03fade2e9c1158c6f4c5604138 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 28 May 2023 22:03:07 +1000 Subject: [PATCH 02/13] newline-after-import --- .eslintrc.cjs | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 343e5ec288..0b38919e18 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -49,6 +49,7 @@ const config = { ], '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/'] }], From 5b949c5cf3a1a15e91ee1091fdc8613474c4daff Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Tue, 30 May 2023 07:55:43 +1000 Subject: [PATCH 03/13] Update chalk --- package.json | 10 ++-------- pnpm-lock.yaml | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index c7b6b8587a..84b0088022 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "query", "repository": "https://github.com/tanstack/query.git", "packageManager": "pnpm@8.5.1", + "namespace": "@tanstack", "scripts": { "clean": "pnpm --filter \"./packages/**\" run clean", "preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...'); process.exit(1)}\" || npx -y only-allow pnpm", @@ -22,13 +23,6 @@ "cipublish": "node scripts/publish.mjs", "validatePackages": "node scripts/validate-packages.mjs" }, - "nx": { - "includedScripts": [ - "test:format", - "test:build" - ] - }, - "namespace": "@tanstack", "devDependencies": { "@babel/core": "^7.21.8", "@babel/preset-env": "^7.21.5", @@ -58,7 +52,7 @@ "axios": "^1.4.0", "babel-preset-solid": "^1.6.10", "bundlewatch": "^0.3.3", - "chalk": "^4.1.2", + "chalk": "^5.2.0", "concurrently": "^8.0.1", "cpy-cli": "^4.2.0", "current-git-branch": "^1.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 47ab0f355f..3ee16374fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -94,8 +94,8 @@ importers: specifier: ^0.3.3 version: 0.3.3 chalk: - specifier: ^4.1.2 - version: 4.1.2 + specifier: ^5.2.0 + version: 5.2.0 concurrently: specifier: ^8.0.1 version: 8.0.1 From 308302631af9c7c8a75fb1c54e65dcaf7f8b1d7d Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Tue, 30 May 2023 08:03:15 +1000 Subject: [PATCH 04/13] Broaden prettier --- .codesandbox/ci.json | 7 +- .eslintrc.cjs | 10 +- .prettierignore | 4 +- CONTRIBUTING.md | 3 + examples/react/algolia/tsconfig.json | 10 +- .../react/auto-refetching/pages/api/data.js | 2 +- examples/react/basic-typescript/tsconfig.json | 10 +- .../react/basic-typescript/vite.config.ts | 8 +- .../load-more-infinite-scroll/pages/about.js | 2 +- .../load-more-infinite-scroll/pages/index.js | 4 +- .../react/nextjs/components/Header/index.js | 5 +- .../react/offline/public/mockServiceWorker.js | 242 +++++++++--------- .../pages/api/data.js | 2 +- .../tsconfig.json | 13 +- .../react/pagination/pages/api/projects.js | 2 +- .../react/prefetching/pages/[user]/[repo].js | 4 +- examples/react/prefetching/pages/api/data.js | 4 +- examples/react/react-native/babel.config.js | 2 +- .../solid-start-streaming/vite.config.ts | 6 +- .../svelte/auto-refetching/svelte.config.js | 12 +- .../svelte/auto-refetching/vite.config.ts | 8 +- examples/svelte/basic/svelte.config.js | 12 +- examples/svelte/basic/vite.config.ts | 8 +- .../svelte.config.js | 12 +- .../load-more-infinite-scroll/vite.config.ts | 8 +- .../svelte.config.js | 12 +- .../vite.config.ts | 8 +- examples/svelte/playground/svelte.config.js | 12 +- examples/svelte/playground/vite.config.ts | 8 +- examples/svelte/simple/svelte.config.js | 2 +- examples/svelte/simple/vite.config.ts | 2 +- examples/svelte/ssr/svelte.config.js | 12 +- examples/svelte/ssr/vite.config.ts | 8 +- examples/svelte/star-wars/postcss.config.cjs | 4 +- examples/svelte/star-wars/svelte.config.js | 12 +- examples/svelte/star-wars/tailwind.config.cjs | 10 +- examples/svelte/star-wars/vite.config.ts | 8 +- examples/vue/basic/vite.config.ts | 8 +- examples/vue/dependent-queries/vite.config.ts | 8 +- examples/vue/nuxt3/app.vue | 12 +- examples/vue/nuxt3/nuxt.config.ts | 4 +- examples/vue/nuxt3/plugins/vue-query.ts | 36 ++- examples/vue/persister/vite.config.ts | 8 +- nx.json | 4 +- package.json | 2 +- .../rollup.config.mjs | 2 +- .../rollup.config.mjs | 2 +- packages/query-core/rollup.config.mjs | 18 +- packages/query-devtools/rollup.config.mjs | 6 +- .../rollup.config.mjs | 2 +- .../rollup.config.mjs | 2 +- packages/react-query-devtools/.eslintrc.cjs | 7 +- .../react-query-devtools/rollup.config.mjs | 2 +- .../react-query-persist-client/.eslintrc.cjs | 7 +- .../rollup.config.mjs | 2 +- .../react-query-persist-client/test-setup.ts | 2 +- packages/react-query/.eslintrc.cjs | 7 +- packages/react-query/rollup.config.mjs | 2 +- packages/solid-query/rollup.config.mjs | 6 +- packages/svelte-query-devtools/tsconfig.json | 8 +- packages/svelte-query-devtools/vite.config.ts | 23 +- packages/svelte-query/svelte.config.js | 6 +- packages/svelte-query/tsconfig.json | 8 +- packages/svelte-query/vite.config.ts | 16 +- packages/svelte-query/vitest.setup.ts | 6 +- packages/vue-query/README.md | 32 ++- packages/vue-query/rollup.config.mjs | 2 +- scripts/config.mjs | 4 +- scripts/getRollupConfig.mjs | 52 ++-- scripts/publish.mjs | 16 +- scripts/validate-packages.mjs | 10 +- 71 files changed, 416 insertions(+), 414 deletions(-) diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index e55f97ca72..1579e59404 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 0b38919e18..a732b82fde 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -36,7 +36,8 @@ const config = { '@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,11 +46,12 @@ const config = { '@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/newline-after-import': 'error', 'import/no-cycle': 'error', 'import/no-duplicates': 'off', 'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }], @@ -67,4 +69,4 @@ const config = { ], } -module.exports = config; +module.exports = config diff --git a/.prettierignore b/.prettierignore index 33552c173e..69355327d8 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,3 @@ -/packages/svelte-query/.svelte-kit -/packages/react-query/build +**/.svelte-kit +**/build /packages/codemods/**/__testfixtures__ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb15bae920..b810dd5949 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 ba028c590e..1bccf6db01 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 1d05eedc93..9c0cb35897 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 ba028c590e..1bccf6db01 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 b1b5f91e5f..9cc50ead1c 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 9b74a26f20..e0a7edf054 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 782a3aa75f..e06e50796f 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 cdd1d701a4..dca3216946 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