Skip to content

Commit c6d0b92

Browse files
Merge branch 'main' into svelte-5-adapter
2 parents c1e67ed + a242f98 commit c6d0b92

File tree

14 files changed

+474
-353
lines changed

14 files changed

+474
-353
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Release
33
on:
44
push:
55
branches: [main, alpha, beta, rc, v4]
6+
repository_dispatch:
7+
types: [release]
68

79
concurrency:
810
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
@@ -14,6 +16,7 @@ env:
1416
permissions:
1517
contents: write
1618
id-token: write
19+
pull-requests: write
1720

1821
jobs:
1922
release:
@@ -34,27 +37,37 @@ jobs:
3437
- name: Stop Nx Agents
3538
if: ${{ always() }}
3639
run: npx nx-cloud stop-all-agents
37-
- name: Version Packages
38-
run: pnpm run changeset:version
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
- name: Commit version files
40+
- name: Check for Changesets marked as major
41+
id: major
4242
run: |
43-
if [[ -n "$(git status --porcelain)" ]]; then
44-
git config --global user.name 'Tanner Linsley'
45-
git config --global user.email '[email protected]'
46-
git add -A
47-
git commit -m "ci: Version Packages"
48-
git push
49-
fi
43+
echo "found=false" >> $GITHUB_OUTPUT
44+
regex="(major)"
45+
shopt -s nullglob
46+
for file in .changeset/*.md; do
47+
if [[ $(cat $file) =~ $regex ]]; then
48+
echo "found=true" >> $GITHUB_OUTPUT
49+
fi
50+
done
51+
- name: Run Changesets (version or publish)
52+
id: changesets
53+
uses: changesets/[email protected]
54+
with:
55+
version: pnpm run changeset:version
56+
publish: pnpm run changeset:publish
57+
commit: 'ci: Version Packages'
58+
title: 'ci: Version Packages'
5059
env:
5160
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52-
- name: Publish Packages
61+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
62+
- name: Auto-merge Changesets PR
63+
if: steps.changesets.outputs.hasChangesets == 'true' && steps.major.outputs.found == 'false'
5364
run: |
54-
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
55-
pnpm run changeset:publish
65+
gh pr merge --squash "$PR_NUMBER"
66+
gh api --method POST /repos/$REPO/dispatches -f 'event_type=release'
5667
env:
57-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
REPO: ${{ github.repository }}
70+
PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }}
5871
- name: Upload coverage to Codecov
5972
uses: codecov/[email protected]
6073
with:

docs/eslint/eslint-plugin-query.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ Alternatively, add `@tanstack/query` to the plugins section, and configure the r
9999
- [@tanstack/query/no-unstable-deps](../no-unstable-deps.md)
100100
- [@tanstack/query/infinite-query-property-order](../infinite-query-property-order.md)
101101
- [@tanstack/query/no-void-query-fn](../no-void-query-fn.md)
102+
- [@tanstack/query/mutation-property-order](../mutation-property-order.md)
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
id: mutation-property-order
3+
title: Ensure correct order of inference-sensitive properties in useMutation()
4+
---
5+
6+
For the following functions, the property order of the passed in object matters due to type inference:
7+
8+
- `useMutation()`
9+
10+
The correct property order is as follows:
11+
12+
- `onMutate`
13+
- `onError`
14+
- `onSettled`
15+
16+
All other properties are insensitive to the order as they do not depend on type inference.
17+
18+
## Rule Details
19+
20+
Examples of **incorrect** code for this rule:
21+
22+
```tsx
23+
/* eslint "@tanstack/query/mutation-property-order": "warn" */
24+
import { useMutation } from '@tanstack/react-query'
25+
26+
const mutation = useMutation({
27+
mutationFn: () => Promise.resolve('success'),
28+
onSettled: () => {
29+
results.push('onSettled-promise')
30+
return Promise.resolve('also-ignored') // Promise<string> (should be ignored)
31+
},
32+
onMutate: async () => {
33+
results.push('onMutate-async')
34+
await sleep(1)
35+
return { backup: 'async-data' }
36+
},
37+
onError: async () => {
38+
results.push('onError-async-start')
39+
await sleep(1)
40+
results.push('onError-async-end')
41+
},
42+
})
43+
```
44+
45+
Examples of **correct** code for this rule:
46+
47+
```tsx
48+
/* eslint "@tanstack/query/mutation-property-order": "warn" */
49+
import { useMutation } from '@tanstack/react-query'
50+
51+
const mutation = useMutation({
52+
mutationFn: () => Promise.resolve('success'),
53+
onMutate: async () => {
54+
results.push('onMutate-async')
55+
await sleep(1)
56+
return { backup: 'async-data' }
57+
},
58+
onError: async () => {
59+
results.push('onError-async-start')
60+
await sleep(1)
61+
results.push('onError-async-end')
62+
},
63+
onSettled: () => {
64+
results.push('onSettled-promise')
65+
return Promise.resolve('also-ignored') // Promise<string> (should be ignored)
66+
},
67+
})
68+
```
69+
70+
## Attributes
71+
72+
- [x] ✅ Recommended
73+
- [x] 🔧 Fixable

examples/react/algolia/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"react-dom": "^19.0.0"
1616
},
1717
"devDependencies": {
18-
"@tanstack/eslint-plugin-query": "^5.90.2",
18+
"@tanstack/eslint-plugin-query": "^5.91.0",
1919
"@types/react": "^18.2.79",
2020
"@types/react-dom": "^18.2.25",
2121
"@vitejs/plugin-react": "^4.3.4",

examples/react/basic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"react-dom": "^19.0.0"
1818
},
1919
"devDependencies": {
20-
"@tanstack/eslint-plugin-query": "^5.90.2",
20+
"@tanstack/eslint-plugin-query": "^5.91.0",
2121
"@types/react": "^18.2.79",
2222
"@types/react-dom": "^18.2.25",
2323
"@vitejs/plugin-react": "^4.3.4",

examples/react/eslint-legacy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"react-dom": "^19.0.0"
1818
},
1919
"devDependencies": {
20-
"@tanstack/eslint-plugin-query": "^5.90.2",
20+
"@tanstack/eslint-plugin-query": "^5.91.0",
2121
"@types/react": "^18.2.79",
2222
"@types/react-dom": "^18.2.25",
2323
"@vitejs/plugin-react": "^4.3.4",

examples/solid/simple/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"solid-js": "^1.9.7"
1414
},
1515
"devDependencies": {
16-
"@tanstack/eslint-plugin-query": "^5.90.2",
16+
"@tanstack/eslint-plugin-query": "^5.91.0",
1717
"typescript": "5.8.3",
1818
"vite": "^6.3.6",
1919
"vite-plugin-solid": "^2.11.6"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"@arethetypeswrong/cli": "^0.15.3",
4444
"@changesets/cli": "^2.29.5",
4545
"@cspell/eslint-plugin": "^9.2.1",
46-
"@eslint-react/eslint-plugin": "^1.53.1",
46+
"@eslint-react/eslint-plugin": "^2.0.1",
4747
"@svitejs/changesets-changelog-github-compact": "^1.2.0",
4848
"@tanstack/config": "^0.20.2",
4949
"@testing-library/jest-dom": "^6.8.0",

packages/eslint-plugin-query/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @tanstack/eslint-plugin-query
22

3+
## 5.91.0
4+
5+
### Minor Changes
6+
7+
- feat: improve type of exported plugin ([#9700](https://github.com/TanStack/query/pull/9700))
8+
39
## 5.90.2
410

511
### Patch Changes

packages/eslint-plugin-query/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tanstack/eslint-plugin-query",
3-
"version": "5.90.2",
3+
"version": "5.91.0",
44
"description": "ESLint plugin for TanStack Query",
55
"author": "Eliya Cohen",
66
"license": "MIT",
@@ -59,11 +59,11 @@
5959
"!src/__tests__"
6060
],
6161
"dependencies": {
62-
"@typescript-eslint/utils": "^8.44.0"
62+
"@typescript-eslint/utils": "^8.44.1"
6363
},
6464
"devDependencies": {
65-
"@typescript-eslint/parser": "^8.44.0",
66-
"@typescript-eslint/rule-tester": "^8.44.0",
65+
"@typescript-eslint/parser": "^8.44.1",
66+
"@typescript-eslint/rule-tester": "^8.44.1",
6767
"combinate": "^1.1.11",
6868
"eslint": "^9.36.0",
6969
"npm-run-all2": "^5.0.0"

0 commit comments

Comments
 (0)