Skip to content

Commit

Permalink
Merge branch 'alpha' into feature/use-client
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo authored Jun 5, 2023
2 parents 48ffbe2 + 97e1a83 commit d26dc74
Show file tree
Hide file tree
Showing 290 changed files with 3,057 additions and 3,714 deletions.
8 changes: 7 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"installCommand": "install:csb",
"sandboxes": ["/examples/react/basic-typescript", "/examples/solid/basic-typescript", "/examples/svelte/basic", "/examples/vue/basic"],
"buildCommand": "build:all",
"sandboxes": [
"/examples/react/basic-typescript",
"/examples/solid/basic-typescript",
"/examples/svelte/basic",
"/examples/vue/basic"
],
"packages": ["packages/**"],
"node": "16"
}
65 changes: 0 additions & 65 deletions .eslintrc

This file was deleted.

75 changes: 75 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// @ts-check

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'compat', 'import'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:compat/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'prettier',
],
env: {
browser: true,
es2020: true,
},
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json',
sourceType: 'module',
ecmaVersion: 2020,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: true,
},
react: {
version: 'detect',
},
},
rules: {
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-inferrable-types': [
'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/'] }],
'import/no-unused-modules': ['off', { unusedExports: true }],
'no-redeclare': 'off',
'no-shadow': 'error',
},
overrides: [
{
files: ['**/*.test.{ts,tsx}'],
rules: {
'@typescript-eslint/no-unnecessary-condition': 'off',
},
},
],
}

module.exports = config
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: ci
concurrency:
group: publish-${{ github.github.base_ref }}
cancel-in-progress: true

on:
workflow_dispatch:
inputs:
Expand All @@ -13,9 +11,15 @@ on:
- 'main'
- 'alpha'
- 'beta'

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

env:
NX_DAEMON: false
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}

jobs:
test-and-publish:
if: github.repository == 'TanStack/query' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta')
Expand All @@ -38,7 +42,7 @@ jobs:
- name: Run Tests
uses: nick-fields/[email protected]
with:
command: pnpm run test:ci --base=${{ github.event.before || 'origin/main' }}
command: pnpm run test:ci
timeout_minutes: 10
max_attempts: 3
- name: Publish
Expand Down
94 changes: 52 additions & 42 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,96 @@
name: pr

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

env:
NX_DAEMON: false
NX_CLOUD_DISTRIBUTED_EXECUTION: true
NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: 3
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}

jobs:
agent:
name: 'Nx Cloud Agents'
main:
name: Nx Cloud - Main Job
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
agent: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: pnpm/[email protected]
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- name: Start Nx Agent ${{ matrix.agent }}
run: npx nx-cloud start-agent
orchestrator:
name: 'Nx Cloud Orchestrator'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v3
- name: Get appropriate base and head commits for `nx affected` commands
uses: nrwl/nx-set-shas@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
main-branch-name: 'alpha'
- run: |
echo "BASE: ${{ env.NX_BASE }}"
echo "HEAD: ${{ env.NX_HEAD }}"
- name: Start CI Orchestrator
run: npx nx-cloud start-ci-run
- name: Run All Checks
- name: Run Tests
uses: nick-fields/[email protected]
env:
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
with:
timeout_minutes: 5
max_attempts: 3
command: npx nx affected --targets=test:eslint,test:types,test:build,test:lib --base=${{ github.event.pull_request.base.sha }}
command: npx nx affected --targets=test:eslint,test:lib,test:types,test:build
- name: Stop Agents
run: npx nx-cloud stop-all-agents
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
agents:
name: Nx Cloud - Agents
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
agent: [1, 2, 3]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- name: Start Nx Agent ${{ matrix.agent }}
run: npx nx-cloud start-agent
format:
name: 'Format'
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: pnpm/[email protected]
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- run: pnpm run test:format --base=${{ github.event.pull_request.base.sha }}
- name: Run prettier
run: pnpm run test:format
7 changes: 5 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/packages/svelte-query/.svelte-kit
/packages/react-query/build
**/.next
**/.svelte-kit
**/build
**/coverage
**/dist
/packages/codemods/**/__testfixtures__
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions babel.config.js → babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ module.exports = {
].filter(Boolean),
overrides: [
{
exclude: [
'./packages/solid-query/**',
'./packages/query-devtools/**',
'./packages/svelte-query/**',
'./packages/vue-query/**',
include: [
'./packages/react-query/**',
'./packages/react-query-devtools/**',
'./packages/react-query-persist-client/**',
],
presets: ['@babel/react'],
},
{
include: ['./packages/solid-query/**', './packages/query-devtools/**'],
include: ['./packages/query-devtools/**', './packages/solid-query/**'],
presets: ['babel-preset-solid'],
},
],
Expand Down
4 changes: 4 additions & 0 deletions docs/react/guides/migrating-to-v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ Custom loggers were already deprecated in 4 and have been removed in this versio

We have updated our browserslist to produce a more modern, performant and smaller bundle. You can read about the requirements [here](../installation#requirements).

### Supported Bundlers

We have removed the legacy `.esm.js` output, which was used by bundlers which didn't recognise the modern `.mjs` extension such as Webpack v4. If you are still using Webpack v4, you can continue to use TanStack Query v4, or upgrade to Webpack v5 or another bundler.

### Private class fields and methods

TanStack Query has always had private fields and methods on classes, but they weren't really private - they were just private in `TypeScript`. We now use [ECMAScript Private class features](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields), which means those fields are now truly private and can't be accessed from the outside at runtime.
Expand Down
Loading

0 comments on commit d26dc74

Please sign in to comment.