Skip to content

Commit

Permalink
Merge branch 'main' into fix/error-management-on-set-data
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins authored Jul 21, 2024
2 parents 3277657 + 0edbc49 commit 1a0934f
Show file tree
Hide file tree
Showing 435 changed files with 9,707 additions and 8,538 deletions.
13 changes: 0 additions & 13 deletions .codesandbox/ci.json

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: autofix.ci # needed to securely identify the workflow

on:
pull_request:
push:
branches: [main, alpha, beta, rc, v4]

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

permissions:
contents: read

jobs:
autofix:
name: autofix
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Tools
uses: tanstack/config/.github/setup@629cd3152485cbe985f5a7e66d370c858132c517
- name: Fix formatting
run: pnpm prettier:write
- name: Apply fixes
uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
with:
commit-message: 'ci: apply automated fixes'
23 changes: 9 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: override release tag
required: false
push:
branches: ['main', 'alpha', 'beta', 'rc', 'v4']
branches: [main, alpha, beta, rc, v4]

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
Expand All @@ -16,6 +16,10 @@ concurrency:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

permissions:
contents: write
id-token: write

jobs:
test-and-publish:
name: Test & Publish
Expand All @@ -25,18 +29,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
fetch-depth: 0
- name: Start Nx Agents
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Setup Tools
uses: tanstack/config/.github/setup@629cd3152485cbe985f5a7e66d370c858132c517
- name: Run Tests
run: pnpm run test:ci --parallel=3
- name: Stop Nx Agents
Expand All @@ -49,10 +46,8 @@ jobs:
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
pnpm run cipublish
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
TAG: ${{ inputs.tag }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
38 changes: 24 additions & 14 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,27 @@ concurrency:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

permissions:
contents: read

jobs:
main:
name: Nx Cloud - Main Job
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Start Nx Agents
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Setup Tools
uses: tanstack/config/.github/setup@629cd3152485cbe985f5a7e66d370c858132c517
- name: Get base and head commits for `nx affected`
uses: nrwl/nx-set-shas@v3
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: 'main'
- name: Run Tests
main-branch-name: main
- name: Run Checks
run: pnpm run test:pr --parallel=3
- name: Stop Nx Agents
if: ${{ always() }}
Expand All @@ -47,3 +43,17 @@ jobs:
directory: packages
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
preview:
name: Preview
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Tools
uses: tanstack/config/.github/setup@629cd3152485cbe985f5a7e66d370c858132c517
- name: Build Packages
run: pnpm run build:all
- name: Publish Previews
run: pnpx pkg-pr-new publish --pnpm --compact './packages/*' --template './examples/*/*'
1 change: 0 additions & 1 deletion .husky/pre-commit

This file was deleted.

3 changes: 0 additions & 3 deletions .lintstagedrc

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
link-workspace-packages=true
prefer-workspace-packages=true
provenance=true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22.2.0
22.4.0
6 changes: 3 additions & 3 deletions .nx/workflows/dynamic-changesets.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distribute-on:
small-changeset: 8 linux-medium-js
medium-changeset: 10 linux-medium-js
large-changeset: 12 linux-medium-js
small-changeset: 3 linux-medium-js
medium-changeset: 6 linux-medium-js
large-changeset: 10 linux-medium-js
42 changes: 42 additions & 0 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function readPackage(pkg, context) {
// [email protected]
if (pkg.name === 'react-scripts' && pkg.version === '4.0.3') {
delete pkg.dependencies['@typescript-eslint/eslint-plugin']
delete pkg.dependencies['@typescript-eslint/parser']
delete pkg.dependencies['babel-eslint']
delete pkg.dependencies['babel-jest']
delete pkg.dependencies['eslint']
delete pkg.dependencies['eslint-config-react-app']
delete pkg.dependencies['eslint-plugin-flowtype']
delete pkg.dependencies['eslint-plugin-import']
delete pkg.dependencies['eslint-plugin-jest']
delete pkg.dependencies['eslint-plugin-jsx-a11y']
delete pkg.dependencies['eslint-plugin-react']
delete pkg.dependencies['eslint-plugin-react-hooks']
delete pkg.dependencies['eslint-plugin-testing-library']
delete pkg.dependencies['jest']
delete pkg.dependencies['jest-circus']
delete pkg.dependencies['jest-resolve']
delete pkg.dependencies['jest-watch-typeahead']
context.log('Removed unused dependencies from [email protected]')
}

// [email protected]
if (pkg.name === 'react-scripts' && pkg.version === '5.0.1') {
delete pkg.dependencies['babel-jest']
delete pkg.dependencies['eslint']
delete pkg.dependencies['eslint-config-react-app']
delete pkg.dependencies['jest']
delete pkg.dependencies['jest-resolve']
delete pkg.dependencies['jest-watch-typeahead']
context.log('Removed unused dependencies from [email protected]')
}

return pkg
}

module.exports = {
hooks: {
readPackage,
},
}
28 changes: 27 additions & 1 deletion docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,32 @@
"to": "framework/solid/reference/createQuery"
}
]
},
{
"label": "svelte",
"children": [
{
"label": "Svelte Reference",
"to": "framework/svelte/reference/index"
},
{
"label": "Functions / createQuery",
"to": "framework/svelte/reference/createQuery"
},
{
"label": "Functions / createMutation",
"to": "framework/svelte/reference/createMutation"
}
]
},
{
"label": "angular",
"children": [
{
"label": "Angular Reference",
"to": "framework/angular/reference/index"
}
]
}
]
},
Expand Down Expand Up @@ -903,7 +929,7 @@
},
{
"label": "Basic",
"to": "framework/solid/examples/basic-typescript"
"to": "framework/solid/examples/basic"
},
{
"label": "Basic w/ GraphQL-Request",
Expand Down
60 changes: 47 additions & 13 deletions docs/eslint/eslint-plugin-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,68 @@ $ yarn add -D @tanstack/eslint-plugin-query
$ bun add -D @tanstack/eslint-plugin-query
```

## Usage
## Flat Config (`eslint.config.js`)

To enable all of the recommended rules for our plugin, add `plugin:@tanstack/eslint-plugin-query/recommended` in extends:
### Recommended setup

```json
{
"extends": ["plugin:@tanstack/eslint-plugin-query/recommended"]
}
To enable all of the recommended rules for our plugin, add the following config:

```js
import pluginQuery from '@tanstack/eslint-plugin-query'

export default [
...pluginQuery.configs['flat/recommended'],
// Any other config...
]
```

### Custom setup

Alternatively, you can load the plugin and configure only the rules you want to use:

```js
import pluginQuery from '@tanstack/eslint-plugin-query'

export default [
{
plugins: {
'@tanstack/query': pluginQuery,
},
rules: {
'@tanstack/query/exhaustive-deps': 'error',
},
},
// Any other config...
]
```

### Alternative config
## Legacy Config (`.eslintrc`)

Alternatively, add `@tanstack/eslint-plugin-query` to the plugins section of your `.eslintrc` configuration file:
### Recommended setup

To enable all of the recommended rules for our plugin, add `plugin:@tanstack/eslint-plugin-query/recommended` in extends:

```json
{
"plugins": ["@tanstack/query"]
"extends": ["plugin:@tanstack/eslint-plugin-query/recommended"]
}
```

Then configure the rules you want to use under the rules section:
### Custom setup

Alternatively, add `@tanstack/eslint-plugin-query` to the plugins section, and configure the rules you want to use:

```json
{
"plugins": ["@tanstack/query"],
"rules": {
"@tanstack/query/exhaustive-deps": "error",
"@tanstack/query/no-rest-destructuring": "warn",
"@tanstack/query/stable-query-client": "error"
"@tanstack/query/exhaustive-deps": "error"
}
}
```

## Rules

- [@tanstack/query/exhaustive-deps](../exhaustive-deps)
- [@tanstack/query/no-rest-destructuring](../no-rest-destructuring)
- [@tanstack/query/stable-query-client](../stable-query-client)
2 changes: 1 addition & 1 deletion docs/framework/angular/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Floating Mode will mount the devtools as a fixed, floating element in your app a

Place the following code as high in your Angular app as you can. The closer it is to the root of the page, the better it will work!

```ts
```angular-ts
import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'
import { Component } from '@angular/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ref: docs/framework/react/guides/background-fetching-indicators.md

[//]: # 'Example'

```ts
```angular-ts
@Component({
selector: 'posts',
template: `
Expand Down Expand Up @@ -39,7 +39,7 @@ export class TodosComponent {
[//]: # 'Example'
[//]: # 'Example2'

```ts
```angular-ts
import { injectIsFetching } from '@tanstack/angular-query-experimental'
@Component({
Expand Down
6 changes: 3 additions & 3 deletions docs/framework/angular/guides/disabling-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replace: { 'useQuery': 'injectQuery' }

[//]: # 'Example'

```ts
```angular-ts
@Component({
selector: 'todos',
template: `<div>
Expand Down Expand Up @@ -44,7 +44,7 @@ export class TodosComponent {
[//]: # 'Example'
[//]: # 'Example2'

```ts
```angular-ts
@Component({
selector: 'todos',
template: `
Expand All @@ -69,7 +69,7 @@ export class TodosComponent {
[//]: # 'Example2'
[//]: # 'Example3'

```ts
```angular-ts
@Component({
selector: 'todos',
template: `
Expand Down
Loading

0 comments on commit 1a0934f

Please sign in to comment.