@tanstack/eslint-plugin-query 5.104.1 → 5.104.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/build/legacy/index.cjs +1 -1
  2. package/build/legacy/index.cjs.map +1 -1
  3. package/build/legacy/index.d.cts +11 -0
  4. package/build/legacy/index.d.cts.map +1 -1
  5. package/build/legacy/index.d.ts +11 -0
  6. package/build/legacy/index.d.ts.map +1 -1
  7. package/build/legacy/index.js +1 -1
  8. package/build/legacy/index.js.map +1 -1
  9. package/build/legacy/{rules-Bv1SB3jU.js → rules-CLqlFYyw.js} +218 -3
  10. package/build/legacy/rules-CLqlFYyw.js.map +1 -0
  11. package/build/legacy/{rules-ChMfhjqW.cjs → rules-CzcCSM4O.cjs} +218 -3
  12. package/build/legacy/rules-CzcCSM4O.cjs.map +1 -0
  13. package/build/legacy/rules.cjs +1 -1
  14. package/build/legacy/rules.js +1 -1
  15. package/build/legacy/types.d.cts +8 -0
  16. package/build/legacy/types.d.cts.map +1 -1
  17. package/build/legacy/types.d.ts +8 -0
  18. package/build/legacy/types.d.ts.map +1 -1
  19. package/build/modern/index.cjs +1 -1
  20. package/build/modern/index.cjs.map +1 -1
  21. package/build/modern/index.d.cts +11 -0
  22. package/build/modern/index.d.cts.map +1 -1
  23. package/build/modern/index.d.ts +11 -0
  24. package/build/modern/index.d.ts.map +1 -1
  25. package/build/modern/index.js +1 -1
  26. package/build/modern/index.js.map +1 -1
  27. package/build/modern/{rules-B1yVUvLh.cjs → rules-D_RuMaj7.cjs} +218 -3
  28. package/build/modern/rules-D_RuMaj7.cjs.map +1 -0
  29. package/build/modern/{rules-DzixDjO7.js → rules-w_lOoMmF.js} +218 -3
  30. package/build/modern/rules-w_lOoMmF.js.map +1 -0
  31. package/build/modern/rules.cjs +1 -1
  32. package/build/modern/rules.js +1 -1
  33. package/build/modern/types.d.cts +8 -0
  34. package/build/modern/types.d.cts.map +1 -1
  35. package/build/modern/types.d.ts +8 -0
  36. package/build/modern/types.d.ts.map +1 -1
  37. package/package.json +6 -6
  38. package/src/index.ts +11 -0
  39. package/src/rules/exhaustive-deps/exhaustive-deps.rule.ts +12 -0
  40. package/src/rules/exhaustive-deps/exhaustive-deps.utils.ts +45 -2
  41. package/src/rules/infinite-query-property-order/constants.ts +6 -0
  42. package/src/rules/mutation-property-order/constants.ts +6 -0
  43. package/src/rules/no-rest-destructuring/no-rest-destructuring.utils.ts +5 -0
  44. package/src/rules/no-unstable-deps/no-unstable-deps.rule.ts +46 -0
  45. package/src/rules/no-void-query-fn/no-void-query-fn.rule.ts +7 -0
  46. package/src/rules/prefer-query-options/prefer-query-options.rule.ts +62 -0
  47. package/src/rules/stable-query-client/stable-query-client.rule.ts +1 -1
  48. package/src/types.ts +8 -0
  49. package/src/utils/ast-utils.ts +2 -2
  50. package/src/utils/create-property-order-rule.ts +14 -0
  51. package/src/utils/detect-react-query-imports.ts +7 -1
  52. package/src/utils/get-docs-url.ts +5 -0
  53. package/src/utils/sort-data-by-order.ts +9 -0
  54. package/src/utils/unique-by.ts +6 -0
  55. package/build/legacy/rules-Bv1SB3jU.js.map +0 -1
  56. package/build/legacy/rules-ChMfhjqW.cjs.map +0 -1
  57. package/build/modern/rules-B1yVUvLh.cjs.map +0 -1
  58. package/build/modern/rules-DzixDjO7.js.map +0 -1
@@ -44,6 +44,12 @@ export const rule = createRule({
44
44
  depsArray: TSESTree.ArrayExpression
45
45
  }> = []
46
46
 
47
+ /**
48
+ * Returns the name of the React hook a call expression calls, if it is one: a known hook, an
49
+ * alias of one, or `React.<hook>`.
50
+ * @param node - The call expression.
51
+ * @returns The hook name, or `undefined` if the call is not a React hook.
52
+ */
47
53
  function getReactHook(node: TSESTree.CallExpression): string | undefined {
48
54
  if (node.callee.type === 'Identifier') {
49
55
  const calleeName = node.callee.name
@@ -64,6 +70,13 @@ export const rule = createRule({
64
70
  return undefined
65
71
  }
66
72
 
73
+ /**
74
+ * Tracks the variables bound to a query hook's result, so they can be reported when used as
75
+ * dependencies.
76
+ * @param pattern - The binding: an identifier, or an array pattern whose elements and rest
77
+ * element are tracked.
78
+ * @param queryHook - The name of the query hook the result comes from.
79
+ */
67
80
  function collectVariableNames(
68
81
  pattern: TSESTree.BindingName,
69
82
  queryHook: string,
@@ -87,10 +100,20 @@ export const rule = createRule({
87
100
  }
88
101
  }
89
102
 
103
+ /**
104
+ * Checks whether a name follows the custom hook naming convention.
105
+ * @param hookName - The name to check.
106
+ * @returns `true` if the name starts with `use` followed by an uppercase letter or a digit.
107
+ */
90
108
  function isCustomHookName(hookName: string): boolean {
91
109
  return /^use[A-Z0-9]/.test(hookName)
92
110
  }
93
111
 
112
+ /**
113
+ * Checks whether a call passes an object literal with a `combine` property as its first argument.
114
+ * @param callExpression - The call expression to check.
115
+ * @returns `true` if the first argument has a `combine` property.
116
+ */
94
117
  function hasCombineProperty(
95
118
  callExpression: TSESTree.CallExpression,
96
119
  ): boolean {
@@ -108,6 +131,12 @@ export const rule = createRule({
108
131
  )
109
132
  }
110
133
 
134
+ /**
135
+ * Returns the name of the TanStack Query hook a call expression calls directly. `useQueries` and
136
+ * `useSuspenseQueries` with `combine` are ignored, since their result can be stable.
137
+ * @param callExpression - The call to check.
138
+ * @returns The hook name, or `undefined` if the call is not a tracked query hook.
139
+ */
111
140
  function getDirectQueryHook(
112
141
  callExpression: TSESTree.CallExpression,
113
142
  ): string | undefined {
@@ -130,6 +159,12 @@ export const rule = createRule({
130
159
  return callExpression.callee.name
131
160
  }
132
161
 
162
+ /**
163
+ * Returns the query hook behind a call expression: a direct query hook call, or a custom hook that
164
+ * returns one.
165
+ * @param callExpression - The call to check.
166
+ * @returns The query hook name, or `undefined` if there is none.
167
+ */
133
168
  function getTrackedQueryHook(
134
169
  callExpression: TSESTree.CallExpression,
135
170
  ): string | undefined {
@@ -145,6 +180,12 @@ export const rule = createRule({
145
180
  return undefined
146
181
  }
147
182
 
183
+ /**
184
+ * Returns the query hook that a custom hook's body returns: either an expression body that calls
185
+ * one, or a block with a single `return` of such a call.
186
+ * @param body - The body of the custom hook.
187
+ * @returns The query hook name, or `undefined` if the body doesn't return one.
188
+ */
148
189
  function getReturnedQueryHook(
149
190
  body:
150
191
  | TSESTree.FunctionExpression['body']
@@ -174,6 +215,11 @@ export const rule = createRule({
174
215
  return undefined
175
216
  }
176
217
 
218
+ /**
219
+ * Reports the tracked query results used in a React hook's dependency array.
220
+ * @param reactHook - The name of the React hook.
221
+ * @param depsArray - The dependency array to check.
222
+ */
177
223
  function checkDependencyArray(
178
224
  reactHook: string,
179
225
  depsArray: TSESTree.ArrayExpression,
@@ -73,6 +73,13 @@ type Program = ParserServicesWithTypeInformation['program']
73
73
  type TypeChecker = ReturnType<Program['getTypeChecker']>
74
74
  type Type = ReturnType<TypeChecker['getTypeAtLocation']>
75
75
 
76
+ /**
77
+ * Checks whether a query function's return type resolves to `void` or `undefined`, including in any
78
+ * member of a union.
79
+ * @param checker - The TypeScript type checker.
80
+ * @param type - The return type of the query function.
81
+ * @returns `true` if the awaited type, or a member of it, is `void` or `undefined`.
82
+ */
76
83
  function isIllegalReturn(checker: TypeChecker, type: Type): boolean {
77
84
  const awaited = checker.getAwaitedType(type)
78
85
 
@@ -75,6 +75,10 @@ export const rule = createRule({
75
75
  defaultOptions: [],
76
76
 
77
77
  create: detectTanstackQueryImports((context, _, helpers) => {
78
+ /**
79
+ * Reports an object literal passed as query options that defines `queryKey` or `queryFn` inline.
80
+ * @param node - The argument passed as query options.
81
+ */
78
82
  function reportInlineQueryOptions(node: TSESTree.Node): void {
79
83
  if (ASTUtils.isObjectExpression(node) && hasInlineQueryOptions(node)) {
80
84
  context.report({
@@ -84,6 +88,10 @@ export const rule = createRule({
84
88
  }
85
89
  }
86
90
 
91
+ /**
92
+ * Reports an object literal passed as query filters whose `queryKey` is an inline array.
93
+ * @param node - The filters node.
94
+ */
87
95
  function reportInlineFilterQueryKey(node: TSESTree.Node): void {
88
96
  if (ASTUtils.isObjectExpression(node) && hasInlineFilterQueryKey(node)) {
89
97
  context.report({
@@ -185,6 +193,11 @@ export const rule = createRule({
185
193
  }),
186
194
  })
187
195
 
196
+ /**
197
+ * Checks whether an object literal defines `queryKey` or `queryFn` inline.
198
+ * @param node - The object literal.
199
+ * @returns `true` if it has a `queryKey` or `queryFn` property.
200
+ */
188
201
  function hasInlineQueryOptions(node: TSESTree.ObjectExpression): boolean {
189
202
  return (
190
203
  ASTUtils.findPropertyWithIdentifierKey(node.properties, 'queryKey') !==
@@ -194,6 +207,11 @@ function hasInlineQueryOptions(node: TSESTree.ObjectExpression): boolean {
194
207
  )
195
208
  }
196
209
 
210
+ /**
211
+ * Checks whether an object literal has a `queryKey` written as an inline array.
212
+ * @param node - The object literal.
213
+ * @returns `true` if its `queryKey` is an array literal, ignoring type assertions.
214
+ */
197
215
  function hasInlineFilterQueryKey(node: TSESTree.ObjectExpression): boolean {
198
216
  const queryKey = ASTUtils.findPropertyWithIdentifierKey(
199
217
  node.properties,
@@ -203,10 +221,21 @@ function hasInlineFilterQueryKey(node: TSESTree.ObjectExpression): boolean {
203
221
  return queryKey !== undefined && isInlineArrayExpression(queryKey)
204
222
  }
205
223
 
224
+ /**
225
+ * Checks whether a node is an array literal, ignoring type assertions.
226
+ * @param node - The node to check.
227
+ * @returns `true` if the node is an array literal.
228
+ */
206
229
  function isInlineArrayExpression(node: TSESTree.Node): boolean {
207
230
  return unwrapTypeAssertions(node).type === AST_NODE_TYPES.ArrayExpression
208
231
  }
209
232
 
233
+ /**
234
+ * Collects the object literals a node can evaluate to, following function bodies, `return`
235
+ * statements, and conditional, logical, and sequence expressions.
236
+ * @param node - The node to collect from.
237
+ * @returns The object literals the node can evaluate to.
238
+ */
210
239
  function getReturnedObjectExpressions(
211
240
  node: TSESTree.Node,
212
241
  ): Array<TSESTree.ObjectExpression> {
@@ -257,6 +286,12 @@ function getReturnedObjectExpressions(
257
286
  return []
258
287
  }
259
288
 
289
+ /**
290
+ * Collects the query option objects of a `queries` array: the object literals in an array literal,
291
+ * or those returned by the callback of a `.map()` call.
292
+ * @param node - The `queries` value.
293
+ * @returns The query option object literals.
294
+ */
260
295
  function getQueryObjects(
261
296
  node: TSESTree.Node,
262
297
  ): Array<TSESTree.ObjectExpression> {
@@ -288,6 +323,14 @@ function getQueryObjects(
288
323
  return []
289
324
  }
290
325
 
326
+ /**
327
+ * Checks whether a node refers to a TanStack Query client, created with `useQueryClient()` or
328
+ * `new QueryClient()`.
329
+ * @param node - The node to check.
330
+ * @param context - The rule context, used to resolve variables.
331
+ * @param helpers - The helpers that check TanStack Query imports.
332
+ * @returns `true` if the node comes from `useQueryClient()` or `new QueryClient()`.
333
+ */
291
334
  function isTanstackQueryClient(
292
335
  node: TSESTree.Node,
293
336
  context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>,
@@ -317,6 +360,13 @@ function isTanstackQueryClient(
317
360
  return false
318
361
  }
319
362
 
363
+ /**
364
+ * Returns the name an identifier was imported under from TanStack Query.
365
+ * @param context - The rule context.
366
+ * @param helpers - The helpers that check TanStack Query imports.
367
+ * @param node - The identifier.
368
+ * @returns The imported name, or `null` if the identifier isn't a named TanStack Query import.
369
+ */
320
370
  function getTanstackImportName(
321
371
  context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>,
322
372
  helpers: Helpers,
@@ -341,6 +391,13 @@ function getTanstackImportName(
341
391
  return definition.imported.name
342
392
  }
343
393
 
394
+ /**
395
+ * Follows variable references, optional chains, and type assertions from a node to the expression it
396
+ * comes from.
397
+ * @param node - The node to start from.
398
+ * @param context - The rule context, used to resolve variables.
399
+ * @returns The innermost node that can't be resolved further.
400
+ */
344
401
  function resolveQueryClientSource(
345
402
  node: TSESTree.Node,
346
403
  context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>,
@@ -376,6 +433,11 @@ function resolveQueryClientSource(
376
433
  return node
377
434
  }
378
435
 
436
+ /**
437
+ * Removes `as`, `satisfies`, and angle-bracket type assertions around a node.
438
+ * @param node - The node to unwrap.
439
+ * @returns The node inside the type assertions.
440
+ */
379
441
  function unwrapTypeAssertions(node: TSESTree.Node): TSESTree.Node {
380
442
  while (
381
443
  node.type === AST_NODE_TYPES.TSAsExpression ||
@@ -69,7 +69,7 @@ export const rule = createRule({
69
69
  }
70
70
 
71
71
  // we need the fallbacks for backwards compat with eslint < 8.37.0
72
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
72
+ // oxlint-disable-next-line typescript/no-unnecessary-condition
73
73
  const sourceCode = context.sourceCode ?? context.getSourceCode()
74
74
  const nodeText = sourceCode.getText(node)
75
75
  const variableName = parent.id.name
package/src/types.ts CHANGED
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Extra fields in a rule's `meta.docs`: `recommended` is the rule's severity in the recommended
3
+ * configs, or `'strict'` if it is only enabled in the strict ones.
4
+ */
1
5
  export type ExtraRuleDocs = {
6
+ /**
7
+ * The rule's severity in the recommended configs, or `'strict'` if it is only enabled in the
8
+ * strict ones.
9
+ */
2
10
  recommended: 'strict' | 'error' | 'warn'
3
11
  }
@@ -194,9 +194,9 @@ export const ASTUtils = {
194
194
  const { node, context } = params
195
195
 
196
196
  // we need the fallbacks for backwards compat with eslint < 8.37.0
197
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
197
+ // oxlint-disable-next-line typescript/no-unnecessary-condition
198
198
  const sourceCode = context.sourceCode ?? context.getSourceCode()
199
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
199
+ // oxlint-disable-next-line typescript/no-unnecessary-condition
200
200
  const scope = context.sourceCode.getScope(node)
201
201
  ? sourceCode.getScope(node)
202
202
  : context.getScope()
@@ -7,6 +7,15 @@ import type { ExtraRuleDocs } from '../types'
7
7
 
8
8
  const createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)
9
9
 
10
+ /**
11
+ * Creates a rule that reports when the properties of the options object passed to the target
12
+ * functions are not in the required order.
13
+ * @param options - The rule's metadata, such as `name`, `meta`, and `defaultOptions`.
14
+ * @param targetFunctions - The names of the functions whose first argument is checked.
15
+ * @param orderRules - Pairs of property groups: the properties of the first group must come before
16
+ * those of the second.
17
+ * @returns An ESLint rule that reports out-of-order properties and fixes them.
18
+ */
10
19
  export function createPropertyOrderRule<
11
20
  TFunc extends string,
12
21
  TProp extends string,
@@ -18,6 +27,11 @@ export function createPropertyOrderRule<
18
27
  >,
19
28
  ) {
20
29
  const targetFunctionSet = new Set(targetFunctions)
30
+ /**
31
+ * Checks whether a function name is one of the target functions.
32
+ * @param node - The function name.
33
+ * @returns `true` if the name is a target function.
34
+ */
21
35
  function isTargetFunction(node: any): node is TFunc {
22
36
  return targetFunctionSet.has(node)
23
37
  }
@@ -21,6 +21,12 @@ type EnhancedCreate = (
21
21
  helpers: Helpers,
22
22
  ) => ReturnType<Create>
23
23
 
24
+ /**
25
+ * Wraps a rule's `create` function to track the identifiers imported from TanStack Query packages,
26
+ * and passes helpers that check them.
27
+ * @param create - The rule's `create` function, which also receives the helpers.
28
+ * @returns The wrapped `create` function.
29
+ */
24
30
  export function detectTanstackQueryImports(create: EnhancedCreate): Create {
25
31
  return (context, optionsWithDefault) => {
26
32
  const tanstackQueryImportSpecifiers: Array<TSESTree.ImportClause> = []
@@ -55,7 +61,7 @@ export function detectTanstackQueryImports(create: EnhancedCreate): Create {
55
61
  ImportDeclaration(node) {
56
62
  if (
57
63
  node.specifiers.length > 0 &&
58
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
64
+ // oxlint-disable-next-line typescript/no-unnecessary-condition
59
65
  (node.importKind === 'value' || node.importKind === undefined) &&
60
66
  node.source.value.startsWith('@tanstack/') &&
61
67
  node.source.value.endsWith('-query')
@@ -1,2 +1,7 @@
1
+ /**
2
+ * Builds the URL of a rule's documentation page.
3
+ * @param ruleName - The rule's name, e.g. `exhaustive-deps`.
4
+ * @returns The URL of the rule's page in the ESLint plugin docs.
5
+ */
1
6
  export const getDocsUrl = (ruleName: string): string =>
2
7
  `https://tanstack.com/query/latest/docs/eslint/${ruleName}`
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Sorts the items covered by the order rules into the required order, keeping the other items in
3
+ * place.
4
+ * @param data - The items to sort.
5
+ * @param orderRules - Pairs of groups: items whose `key` is in the first group must come before
6
+ * those in the second.
7
+ * @param key - The property of each item to compare against the groups.
8
+ * @returns The sorted items, or `null` if they were already in order.
9
+ */
1
10
  export function sortDataByOrder<T, TKey extends keyof T>(
2
11
  data: Array<T> | ReadonlyArray<T>,
3
12
  orderRules: ReadonlyArray<
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Removes duplicate items, keeping the first item for each key.
3
+ * @param arr - The items.
4
+ * @param fn - Returns the key that identifies an item.
5
+ * @returns The items with unique keys, in their original order.
6
+ */
1
7
  export function uniqueBy<T>(arr: Array<T>, fn: (x: T) => unknown): Array<T> {
2
8
  return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i)
3
9
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"rules-Bv1SB3jU.js","names":["name","createRule","rule","name","createRule","rule","name","queryHooks","createRule","rule","name","createRule","rule","createRule","sortRules","name","rule","sortRules","name","createRule","rule","name","rule","exhaustiveDeps.name","exhaustiveDeps.rule","stableQueryClient.name","stableQueryClient.rule","noRestDestructuring.name","noRestDestructuring.rule","noUnstableDeps.name","noUnstableDeps.rule","infiniteQueryPropertyOrder.name","infiniteQueryPropertyOrder.rule","noVoidQueryFn.name","noVoidQueryFn.rule","mutationPropertyOrder.name","mutationPropertyOrder.rule","preferQueryOptions.name","preferQueryOptions.rule"],"sources":["../../src/utils/unique-by.ts","../../src/utils/ast-utils.ts","../../src/utils/get-docs-url.ts","../../src/utils/detect-react-query-imports.ts","../../src/rules/exhaustive-deps/exhaustive-deps.utils.ts","../../src/rules/exhaustive-deps/exhaustive-deps.rule.ts","../../src/rules/stable-query-client/stable-query-client.rule.ts","../../src/rules/no-rest-destructuring/no-rest-destructuring.utils.ts","../../src/rules/no-rest-destructuring/no-rest-destructuring.rule.ts","../../src/rules/no-unstable-deps/no-unstable-deps.rule.ts","../../src/utils/sort-data-by-order.ts","../../src/utils/create-property-order-rule.ts","../../src/rules/infinite-query-property-order/constants.ts","../../src/rules/infinite-query-property-order/infinite-query-property-order.rule.ts","../../src/rules/no-void-query-fn/no-void-query-fn.rule.ts","../../src/rules/mutation-property-order/constants.ts","../../src/rules/mutation-property-order/mutation-property-order.rule.ts","../../src/rules/prefer-query-options/prefer-query-options.rule.ts","../../src/rules.ts"],"sourcesContent":["export function uniqueBy<T>(arr: Array<T>, fn: (x: T) => unknown): Array<T> {\n return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i)\n}\n","import { AST_NODE_TYPES } from '@typescript-eslint/utils'\nimport { uniqueBy } from './unique-by'\nimport type { TSESLint, TSESTree } from '@typescript-eslint/utils'\n\nexport const ASTUtils = {\n isNodeOfOneOf<T extends AST_NODE_TYPES>(\n node: TSESTree.Node,\n types: ReadonlyArray<T>,\n ): node is TSESTree.Node & { type: T } {\n return types.includes(node.type as T)\n },\n isIdentifier(node: TSESTree.Node): node is TSESTree.Identifier {\n return node.type === AST_NODE_TYPES.Identifier\n },\n isIdentifierWithName(\n node: TSESTree.Node,\n name: string,\n ): node is TSESTree.Identifier {\n return ASTUtils.isIdentifier(node) && node.name === name\n },\n isIdentifierWithOneOfNames<T extends Array<string>>(\n node: TSESTree.Node,\n name: T,\n ): node is TSESTree.Identifier & { name: T[number] } {\n return ASTUtils.isIdentifier(node) && name.includes(node.name)\n },\n isProperty(node: TSESTree.Node): node is TSESTree.Property {\n return node.type === AST_NODE_TYPES.Property\n },\n isObjectExpression(node: TSESTree.Node): node is TSESTree.ObjectExpression {\n return node.type === AST_NODE_TYPES.ObjectExpression\n },\n isPropertyWithIdentifierKey(\n node: TSESTree.Node,\n key: string,\n ): node is TSESTree.Property {\n return (\n ASTUtils.isProperty(node) && ASTUtils.isIdentifierWithName(node.key, key)\n )\n },\n findPropertyWithIdentifierKey(\n properties: Array<TSESTree.ObjectLiteralElement>,\n key: string,\n ): TSESTree.Property | undefined {\n return properties.find((x): x is TSESTree.Property =>\n ASTUtils.isPropertyWithIdentifierKey(x, key),\n )\n },\n traverseUpOnly(\n identifier: TSESTree.Node,\n allowedNodeTypes: Array<AST_NODE_TYPES>,\n ): TSESTree.Node {\n const parent = identifier.parent\n\n if (parent !== undefined && allowedNodeTypes.includes(parent.type)) {\n return ASTUtils.traverseUpOnly(parent, allowedNodeTypes)\n }\n\n return identifier\n },\n traverseUpMemberExpression(node: TSESTree.Node): TSESTree.Node {\n const parent = node.parent\n\n if (\n parent !== undefined &&\n ((parent.type === AST_NODE_TYPES.MemberExpression &&\n parent.object === node) ||\n parent.type === AST_NODE_TYPES.ChainExpression ||\n parent.type === AST_NODE_TYPES.TSNonNullExpression)\n ) {\n return ASTUtils.traverseUpMemberExpression(parent)\n }\n\n return node\n },\n isDeclaredInNode(params: {\n functionNode: TSESTree.Node\n reference: TSESLint.Scope.Reference\n scopeManager: TSESLint.Scope.ScopeManager\n }) {\n const { functionNode, reference, scopeManager } = params\n const scope = scopeManager.acquire(functionNode)\n\n if (scope === null) {\n return false\n }\n\n return scope.set.has(reference.identifier.name)\n },\n getExternalRefs(params: {\n scopeManager: TSESLint.Scope.ScopeManager\n sourceCode: Readonly<TSESLint.SourceCode>\n node: TSESTree.Node\n }): Array<TSESLint.Scope.Reference> {\n const { scopeManager, sourceCode, node } = params\n const scope = scopeManager.acquire(node)\n\n if (scope === null) {\n return []\n }\n\n const collectReferences = (\n currentScope: TSESLint.Scope.Scope,\n ): Array<TSESLint.Scope.Reference> => {\n const references = [...currentScope.references]\n\n for (const childScope of currentScope.childScopes) {\n references.push(...collectReferences(childScope))\n }\n\n return references\n }\n\n const references = collectReferences(scope)\n .filter((x) => x.isRead() && !scope.set.has(x.identifier.name))\n .map((x) => {\n const memberPath = ASTUtils.traverseUpMemberExpression(x.identifier)\n const memberExpression = memberPath.parent\n const isComputedCallProperty =\n memberExpression !== undefined &&\n memberExpression.type === AST_NODE_TYPES.MemberExpression &&\n memberExpression.computed &&\n memberExpression.property === memberPath &&\n memberExpression.parent.type === AST_NODE_TYPES.CallExpression &&\n memberExpression.parent.callee === memberExpression\n\n const referenceNode = isComputedCallProperty\n ? memberPath\n : ASTUtils.traverseUpOnly(x.identifier, [\n AST_NODE_TYPES.MemberExpression,\n AST_NODE_TYPES.Identifier,\n ])\n\n return {\n variable: x,\n node: referenceNode,\n text: sourceCode.getText(referenceNode),\n }\n })\n\n const localRefIds = new Set(\n [...scope.set.values()].map((x) => sourceCode.getText(x.identifiers[0])),\n )\n\n const externalRefs = references.filter(\n (x) => x.variable.resolved === null || !localRefIds.has(x.text),\n )\n\n return uniqueBy(externalRefs, (x) => x.text).map((x) => x.variable)\n },\n isValidReactComponentOrHookName(\n identifier: TSESTree.Identifier | null | undefined,\n ) {\n return (\n identifier !== null &&\n identifier !== undefined &&\n /^(use|[A-Z])/.test(identifier.name)\n )\n },\n getFunctionAncestor(\n sourceCode: Readonly<TSESLint.SourceCode>,\n node: TSESTree.Node,\n ) {\n for (const ancestor of sourceCode.getAncestors(node)) {\n if (\n ASTUtils.isNodeOfOneOf(ancestor, [\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n ])\n ) {\n return ancestor\n }\n\n if (\n ancestor.parent?.type === AST_NODE_TYPES.VariableDeclarator &&\n ancestor.parent.id.type === AST_NODE_TYPES.Identifier &&\n ASTUtils.isNodeOfOneOf(ancestor, [\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n ])\n ) {\n return ancestor\n }\n }\n\n return undefined\n },\n getReferencedExpressionByIdentifier(params: {\n node: TSESTree.Node\n context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>\n }) {\n const { node, context } = params\n\n // we need the fallbacks for backwards compat with eslint < 8.37.0\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const sourceCode = context.sourceCode ?? context.getSourceCode()\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const scope = context.sourceCode.getScope(node)\n ? sourceCode.getScope(node)\n : context.getScope()\n\n const resolvedNode = scope.references.find((ref) => ref.identifier === node)\n ?.resolved?.defs[0]?.node\n\n if (resolvedNode?.type !== AST_NODE_TYPES.VariableDeclarator) {\n return null\n }\n\n return resolvedNode.init\n },\n}\n","export const getDocsUrl = (ruleName: string): string =>\n `https://tanstack.com/query/latest/docs/eslint/${ruleName}`\n","import { TSESTree } from '@typescript-eslint/utils'\nimport type { ESLintUtils, TSESLint } from '@typescript-eslint/utils'\n\ntype Create = Parameters<\n ReturnType<typeof ESLintUtils.RuleCreator>\n>[0]['create']\n\ntype Context = Parameters<Create>[0]\ntype Options = Parameters<Create>[1]\ntype Helpers = {\n isSpecificTanstackQueryImport: (\n node: TSESTree.Identifier,\n source: string,\n ) => boolean\n isTanstackQueryImport: (node: TSESTree.Identifier) => boolean\n}\n\ntype EnhancedCreate = (\n context: Context,\n options: Options,\n helpers: Helpers,\n) => ReturnType<Create>\n\nexport function detectTanstackQueryImports(create: EnhancedCreate): Create {\n return (context, optionsWithDefault) => {\n const tanstackQueryImportSpecifiers: Array<TSESTree.ImportClause> = []\n\n const helpers: Helpers = {\n isSpecificTanstackQueryImport(node, source) {\n return !!tanstackQueryImportSpecifiers.find((specifier) => {\n if (\n specifier.type === TSESTree.AST_NODE_TYPES.ImportSpecifier &&\n specifier.parent.type ===\n TSESTree.AST_NODE_TYPES.ImportDeclaration &&\n specifier.parent.source.value === source\n ) {\n return node.name === specifier.local.name\n }\n\n return false\n })\n },\n isTanstackQueryImport(node) {\n return !!tanstackQueryImportSpecifiers.find((specifier) => {\n if (specifier.type === TSESTree.AST_NODE_TYPES.ImportSpecifier) {\n return node.name === specifier.local.name\n }\n\n return false\n })\n },\n }\n\n const detectionInstructions: TSESLint.RuleListener = {\n ImportDeclaration(node) {\n if (\n node.specifiers.length > 0 &&\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n (node.importKind === 'value' || node.importKind === undefined) &&\n node.source.value.startsWith('@tanstack/') &&\n node.source.value.endsWith('-query')\n ) {\n tanstackQueryImportSpecifiers.push(...node.specifiers)\n }\n },\n }\n\n // Call original rule definition\n const ruleInstructions = create(context, optionsWithDefault, helpers)\n const enhancedRuleInstructions: TSESLint.RuleListener = {}\n\n const allKeys = new Set(\n Object.keys(detectionInstructions).concat(Object.keys(ruleInstructions)),\n )\n\n // Iterate over ALL instructions keys so we can override original rule instructions\n // to prevent their execution if conditions to report errors are not met.\n allKeys.forEach((instruction) => {\n enhancedRuleInstructions[instruction] = (node) => {\n if (instruction in detectionInstructions) {\n detectionInstructions[instruction]?.(node)\n }\n\n const ruleInstruction = ruleInstructions[instruction]\n\n // TODO: canReportErrors()\n if (ruleInstruction) {\n return ruleInstruction(node)\n }\n\n return undefined\n }\n })\n\n return enhancedRuleInstructions\n }\n}\n","import { AST_NODE_TYPES } from '@typescript-eslint/utils'\nimport { ASTUtils } from '../../utils/ast-utils'\nimport type { TSESLint, TSESTree } from '@typescript-eslint/utils'\n\nexport const ExhaustiveDepsUtils = {\n isRelevantReference(params: {\n sourceCode: Readonly<TSESLint.SourceCode>\n reference: TSESLint.Scope.Reference\n scopeManager: TSESLint.Scope.ScopeManager\n node: TSESTree.Node\n filename: string\n }) {\n const { sourceCode, reference, scopeManager, node, filename } = params\n const component = ASTUtils.getFunctionAncestor(sourceCode, node)\n const queryFnScope = scopeManager.acquire(node)\n\n if (queryFnScope === null || reference.isValueReference === false) {\n return false\n }\n\n let currentScope = reference.resolved?.scope ?? null\n while (currentScope !== null) {\n if (currentScope === queryFnScope) {\n return false\n }\n\n currentScope = currentScope.upper\n }\n\n if (component !== undefined) {\n if (\n !ASTUtils.isDeclaredInNode({\n scopeManager,\n reference,\n functionNode: component,\n })\n ) {\n return false\n }\n } else {\n const isVueFile = filename.endsWith('.vue')\n\n if (!isVueFile) {\n return false\n }\n\n const definition = reference.resolved?.defs[0]\n const isGlobalVariable = definition === undefined\n const isImport = definition?.type === 'ImportBinding'\n\n if (isGlobalVariable || isImport) {\n return false\n }\n }\n\n return (\n reference.identifier.name !== 'undefined' &&\n !ExhaustiveDepsUtils.isFunctionCallTarget(reference.identifier) &&\n reference.identifier.parent.type !== AST_NODE_TYPES.NewExpression &&\n !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent)\n )\n },\n\n isFunctionCallTarget(\n identifier: TSESTree.Identifier | TSESTree.JSXIdentifier,\n ): boolean {\n const callee = ASTUtils.traverseUpMemberExpression(identifier)\n\n return (\n callee.parent !== undefined &&\n callee.parent.type === AST_NODE_TYPES.CallExpression &&\n callee.parent.callee === callee\n )\n },\n\n /**\n * Given required refs and existing queryKey entries, compute missing dependency paths\n * respecting allowlisted variables and types.\n */\n computeFilteredMissingPaths(params: {\n requiredRefs: Array<{\n path: string\n root: string\n allowlistedByType: boolean\n }>\n allowlistedVariables: Set<string>\n existingRootIdentifiers: Set<string>\n existingFullPaths: Set<string>\n }): Array<string> {\n const {\n requiredRefs,\n allowlistedVariables,\n existingRootIdentifiers,\n existingFullPaths,\n } = params\n\n const missingPaths = new Set<string>()\n\n for (const { root, path, allowlistedByType } of requiredRefs) {\n // If root itself is present in the key, it covers all members\n if (existingRootIdentifiers.has(root)) continue\n if (allowlistedVariables.has(root)) continue\n if (existingFullPaths.has(path)) continue\n if (allowlistedByType) continue\n\n missingPaths.add(path)\n }\n\n // Collapse descendants: if a root is already missing, drop deeper paths\n for (const path of missingPaths) {\n const root = path.split('.')[0]\n if (root !== path && root !== undefined && missingPaths.has(root)) {\n missingPaths.delete(path)\n }\n }\n\n return Array.from(missingPaths)\n },\n\n /**\n * Extract existing queryKey deps as root identifiers and full member paths.\n */\n collectQueryKeyDeps(params: {\n sourceCode: Readonly<TSESLint.SourceCode>\n scopeManager: TSESLint.Scope.ScopeManager\n queryKeyNode: TSESTree.Node\n }): { roots: Set<string>; paths: Set<string> } {\n const { sourceCode, scopeManager, queryKeyNode } = params\n const roots = new Set<string>()\n const paths = new Set<string>()\n const visitorKeys = sourceCode.visitorKeys\n\n function addRoot(name: string) {\n const cleaned = ExhaustiveDepsUtils.normalizeChain(name)\n roots.add(cleaned)\n paths.add(cleaned)\n }\n function addFull(text: string) {\n const cleaned = ExhaustiveDepsUtils.normalizeChain(text)\n paths.add(cleaned)\n }\n function addRefPath(\n refPath: {\n path: string\n root: string\n coversRootMembers: boolean\n } | null,\n ) {\n if (!refPath) return\n\n if (refPath.coversRootMembers) {\n addRoot(refPath.root)\n return\n }\n\n addFull(refPath.path)\n }\n\n function visitChildren(node: TSESTree.Node): void {\n const keys = (visitorKeys[node.type] ?? []) as ReadonlyArray<\n keyof TSESTree.Node\n >\n\n for (const key of keys) {\n const value = node[key]\n\n if (Array.isArray(value)) {\n for (const item of value) {\n if (ExhaustiveDepsUtils.isNode(item)) {\n visit(item)\n }\n }\n continue\n }\n\n if (ExhaustiveDepsUtils.isNode(value)) {\n visit(value)\n }\n }\n }\n\n function visit(node: TSESTree.Node | null | undefined): void {\n if (!node) return\n\n switch (node.type) {\n case AST_NODE_TYPES.Identifier: {\n addRefPath(\n ExhaustiveDepsUtils.computeRefPath({\n identifier: node,\n sourceCode: sourceCode,\n }),\n )\n return\n }\n case AST_NODE_TYPES.ArrowFunctionExpression:\n case AST_NODE_TYPES.FunctionExpression:\n for (const reference of ExhaustiveDepsUtils.collectExternalRefsInFunction(\n {\n functionNode: node,\n scopeManager: scopeManager,\n },\n )) {\n if (reference.identifier.type !== AST_NODE_TYPES.Identifier) {\n continue\n }\n\n addRefPath(\n ExhaustiveDepsUtils.computeRefPath({\n identifier: reference.identifier,\n sourceCode: sourceCode,\n }),\n )\n }\n return\n case AST_NODE_TYPES.Property:\n visit(node.value)\n return\n case AST_NODE_TYPES.MemberExpression:\n if (\n node.parent.type === AST_NODE_TYPES.CallExpression &&\n node.parent.callee === node &&\n node.object.type === AST_NODE_TYPES.Identifier\n ) {\n addRoot(node.object.name)\n } else {\n visit(node.object)\n }\n return\n case AST_NODE_TYPES.CallExpression:\n node.arguments.forEach((argument) => visit(argument))\n switch (node.callee.type) {\n case AST_NODE_TYPES.Identifier:\n case AST_NODE_TYPES.MemberExpression:\n case AST_NODE_TYPES.ChainExpression:\n case AST_NODE_TYPES.TSNonNullExpression:\n visit(node.callee)\n break\n }\n return\n }\n\n visitChildren(node)\n }\n\n visit(queryKeyNode)\n\n return { roots, paths }\n },\n\n isNode(value: unknown): value is TSESTree.Node {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'type' in value &&\n typeof value.type === 'string'\n )\n },\n\n /**\n * Checks whether the resolved variable is allowlisted by its type annotation\n */\n variableIsAllowlistedByType(params: {\n allowlistedTypes: Set<string>\n variable: TSESLint.Scope.Variable | null\n }): boolean {\n const { allowlistedTypes, variable } = params\n if (allowlistedTypes.size === 0) return false\n if (!variable) return false\n\n for (const id of variable.identifiers) {\n if (id.typeAnnotation) {\n const typeIdentifiers = new Set<string>()\n ExhaustiveDepsUtils.collectTypeIdentifiers(\n id.typeAnnotation.typeAnnotation,\n typeIdentifiers,\n )\n for (const typeIdentifier of typeIdentifiers) {\n if (allowlistedTypes.has(typeIdentifier)) return true\n }\n }\n }\n\n return false\n },\n isInstanceOfKind(node: TSESTree.Node) {\n return (\n node.type === AST_NODE_TYPES.BinaryExpression &&\n (node as TSESTree.SymmetricBinaryExpression).operator === 'instanceof'\n )\n },\n\n /**\n * Normalizes a chain by removing optional chaining operators\n *\n * Example: `a?.b.c!` -> `a.b.c`\n */\n normalizeChain(text: string): string {\n return text.replace(/(?:\\?(\\.)|!)/g, '$1').replace(/\\s+/g, '')\n },\n\n /**\n * Computes the reference path for an identifier\n *\n * Example: `a.b.c!` -> `{ path: 'a.b.c', root: 'a' }`\n */\n computeRefPath(params: {\n identifier: TSESTree.Identifier\n sourceCode: Readonly<TSESLint.SourceCode>\n }): { path: string; root: string; coversRootMembers: boolean } | null {\n const { identifier, sourceCode } = params\n\n const fullChainNode = ASTUtils.traverseUpMemberExpression(identifier)\n\n const fullText = ExhaustiveDepsUtils.normalizeChain(\n sourceCode.getText(fullChainNode),\n )\n\n const parent = fullChainNode.parent\n let dependencyPath = fullText\n let coversRootMembers = fullText === identifier.name\n\n if (\n parent &&\n parent.type === AST_NODE_TYPES.CallExpression &&\n parent.callee === fullChainNode\n ) {\n const segments = fullText.split('.')\n if (segments.length > 1) {\n dependencyPath = segments.slice(0, -1).join('.')\n }\n\n coversRootMembers = false\n }\n\n dependencyPath =\n dependencyPath.split('.')[0] === '' ? identifier.name : dependencyPath\n const root = dependencyPath.split('.')[0]\n\n return {\n path: dependencyPath,\n root: root ?? identifier.name,\n coversRootMembers: coversRootMembers && dependencyPath === root,\n }\n },\n\n collectExternalRefsInFunction(params: {\n functionNode: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression\n scopeManager: TSESLint.Scope.ScopeManager\n }): Array<TSESLint.Scope.Reference> {\n const { functionNode, scopeManager } = params\n const functionScope = scopeManager.acquire(functionNode)\n\n if (functionScope === null) {\n return []\n }\n\n const externalRefs: Array<TSESLint.Scope.Reference> = []\n\n function collect(scope: TSESLint.Scope.Scope) {\n for (const reference of scope.references) {\n if (!reference.isRead() || reference.resolved === null) {\n continue\n }\n\n let currentScope: TSESLint.Scope.Scope | null = reference.resolved.scope\n let declaredInsideFunction = false\n\n while (currentScope !== null) {\n if (currentScope === functionScope) {\n declaredInsideFunction = true\n break\n }\n\n currentScope = currentScope.upper\n }\n\n if (!declaredInsideFunction) {\n externalRefs.push(reference)\n }\n }\n\n for (const childScope of scope.childScopes) {\n collect(childScope)\n }\n }\n\n collect(functionScope)\n\n return externalRefs\n },\n\n /**\n * Recursively collects type identifiers from a type annotation\n */\n collectTypeIdentifiers(typeNode: TSESTree.TypeNode, out: Set<string>): void {\n switch (typeNode.type) {\n case AST_NODE_TYPES.TSTypeReference: {\n if (typeNode.typeName.type === AST_NODE_TYPES.Identifier) {\n out.add(typeNode.typeName.name)\n }\n break\n }\n case AST_NODE_TYPES.TSUnionType:\n case AST_NODE_TYPES.TSIntersectionType: {\n typeNode.types.forEach((t) =>\n ExhaustiveDepsUtils.collectTypeIdentifiers(t, out),\n )\n break\n }\n case AST_NODE_TYPES.TSArrayType: {\n ExhaustiveDepsUtils.collectTypeIdentifiers(typeNode.elementType, out)\n break\n }\n case AST_NODE_TYPES.TSTupleType: {\n typeNode.elementTypes.forEach((et) =>\n ExhaustiveDepsUtils.collectTypeIdentifiers(et, out),\n )\n break\n }\n }\n },\n\n /**\n * Gets the function expression nodes from a queryFn property, handling conditional expressions.\n * When neither branch is skipToken, returns both branches so all deps are scanned.\n */\n getQueryFnNodes(queryFn: TSESTree.Property): Array<TSESTree.Node> {\n if (queryFn.value.type !== AST_NODE_TYPES.ConditionalExpression) {\n return [queryFn.value]\n }\n\n if (\n queryFn.value.consequent.type === AST_NODE_TYPES.Identifier &&\n queryFn.value.consequent.name === 'skipToken'\n ) {\n return [queryFn.value.alternate]\n }\n\n if (\n queryFn.value.alternate.type === AST_NODE_TYPES.Identifier &&\n queryFn.value.alternate.name === 'skipToken'\n ) {\n return [queryFn.value.consequent]\n }\n\n return [queryFn.value.consequent, queryFn.value.alternate]\n },\n}\n","import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'\nimport { ASTUtils } from '../../utils/ast-utils'\nimport { getDocsUrl } from '../../utils/get-docs-url'\nimport { detectTanstackQueryImports } from '../../utils/detect-react-query-imports'\nimport { ExhaustiveDepsUtils } from './exhaustive-deps.utils'\nimport type { TSESLint, TSESTree } from '@typescript-eslint/utils'\nimport type { ExtraRuleDocs } from '../../types'\n\nconst QUERY_KEY = 'queryKey'\nconst QUERY_FN = 'queryFn'\n\nexport const name = 'exhaustive-deps'\n\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\n\ntype RuleOption = {\n allowlist?: {\n variables?: Array<string>\n types?: Array<string>\n }\n}\n\nexport const rule = createRule({\n name,\n meta: {\n type: 'problem',\n docs: {\n description: 'Exhaustive deps rule for useQuery',\n recommended: 'error',\n },\n messages: {\n missingDeps: `The following dependencies are missing in your queryKey: {{deps}}`,\n fixTo: 'Fix to {{result}}',\n },\n hasSuggestions: true,\n fixable: 'code',\n schema: [\n {\n type: 'object',\n properties: {\n allowlist: {\n type: 'object',\n properties: {\n variables: { type: 'array', items: { type: 'string' } },\n types: { type: 'array', items: { type: 'string' } },\n },\n additionalProperties: false,\n },\n },\n additionalProperties: false,\n },\n ],\n },\n defaultOptions: [],\n\n create: detectTanstackQueryImports((context) => {\n return {\n ObjectExpression: (node: TSESTree.ObjectExpression) => {\n const scopeManager = context.sourceCode.scopeManager\n\n const queryKey = ASTUtils.findPropertyWithIdentifierKey(\n node.properties,\n QUERY_KEY,\n )\n const queryFn = ASTUtils.findPropertyWithIdentifierKey(\n node.properties,\n QUERY_FN,\n )\n\n if (\n scopeManager === null ||\n queryKey === undefined ||\n queryFn === undefined ||\n !ASTUtils.isNodeOfOneOf(queryFn.value, [\n AST_NODE_TYPES.ArrowFunctionExpression,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ConditionalExpression,\n ])\n ) {\n return\n }\n\n const queryKeyNode = dereferenceVariablesAndTypeAssertions(\n queryKey.value,\n context,\n )\n\n const queryFnNodes = ExhaustiveDepsUtils.getQueryFnNodes(queryFn)\n\n const externalRefs = queryFnNodes.flatMap((fnNode) =>\n ASTUtils.getExternalRefs({\n scopeManager,\n sourceCode: context.sourceCode,\n node: fnNode,\n }),\n )\n\n const relevantRefs = externalRefs.filter((reference) =>\n queryFnNodes.some((fnNode) =>\n ExhaustiveDepsUtils.isRelevantReference({\n sourceCode: context.sourceCode,\n reference,\n scopeManager,\n node: fnNode,\n filename: context.filename,\n }),\n ),\n )\n\n const ruleOptions = context.options.at(0) as RuleOption | undefined\n const allowlistedVariables = new Set(\n ruleOptions?.allowlist?.variables ?? [],\n )\n const allowlistedTypes = new Set(ruleOptions?.allowlist?.types ?? [])\n\n const requiredRefs = relevantRefs.flatMap((ref) => {\n if (ref.identifier.type !== AST_NODE_TYPES.Identifier) return []\n\n const refPath = ExhaustiveDepsUtils.computeRefPath({\n identifier: ref.identifier,\n sourceCode: context.sourceCode,\n })\n\n if (refPath === null) return []\n\n return [\n {\n ...refPath,\n allowlistedByType:\n ExhaustiveDepsUtils.variableIsAllowlistedByType({\n allowlistedTypes,\n variable: ref.resolved ?? null,\n }),\n },\n ]\n })\n\n if (requiredRefs.length === 0) return\n\n const queryKeyDeps = ExhaustiveDepsUtils.collectQueryKeyDeps({\n sourceCode: context.sourceCode,\n scopeManager: scopeManager,\n queryKeyNode: queryKeyNode,\n })\n\n const missingPaths = ExhaustiveDepsUtils.computeFilteredMissingPaths({\n requiredRefs: requiredRefs,\n allowlistedVariables: allowlistedVariables,\n existingRootIdentifiers: queryKeyDeps.roots,\n existingFullPaths: queryKeyDeps.paths,\n })\n\n if (missingPaths.length === 0) return\n\n const missingAsText = missingPaths.join(', ')\n const suggestions = buildSuggestions({\n queryKeyNode,\n missingPaths,\n missingAsText,\n sourceCode: context.sourceCode,\n })\n\n context.report({\n node,\n messageId: 'missingDeps',\n data: { deps: missingAsText },\n suggest: suggestions,\n })\n },\n }\n }),\n})\n\nfunction buildSuggestions(params: {\n queryKeyNode: TSESTree.Node\n missingPaths: Array<string>\n missingAsText: string\n sourceCode: Readonly<TSESLint.SourceCode>\n}): TSESLint.ReportSuggestionArray<string> {\n const { queryKeyNode, missingPaths, missingAsText, sourceCode } = params\n\n if (queryKeyNode.type !== AST_NODE_TYPES.ArrayExpression) {\n return []\n }\n\n const closingBracket = sourceCode.getLastToken(queryKeyNode)\n if (!closingBracket) return []\n\n const existingElements = queryKeyNode.elements\n .filter((el): el is NonNullable<typeof el> => el !== null)\n .map((el) => sourceCode.getText(el))\n\n const resultText = `[${[...existingElements, ...missingPaths].join(', ')}]`\n\n if (queryKeyNode.elements.length === 0) {\n return [\n {\n messageId: 'fixTo',\n data: { result: resultText },\n fix: (fixer) => fixer.replaceText(queryKeyNode, resultText),\n },\n ]\n }\n\n const tokenBefore = sourceCode.getTokenBefore(closingBracket)\n const separator = tokenBefore?.value === ',' ? ' ' : ', '\n\n return [\n {\n messageId: 'fixTo',\n data: { result: resultText },\n fix: (fixer) =>\n fixer.insertTextBefore(closingBracket, `${separator}${missingAsText}`),\n },\n ]\n}\n\nfunction dereferenceVariablesAndTypeAssertions(\n queryKeyNode: TSESTree.Node,\n context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>,\n) {\n const visitedNodes = new Set<TSESTree.Node>()\n\n for (let i = 0; i < 1 << 8; ++i) {\n if (visitedNodes.has(queryKeyNode)) {\n return queryKeyNode\n }\n visitedNodes.add(queryKeyNode)\n\n switch (queryKeyNode.type) {\n case AST_NODE_TYPES.TSAsExpression:\n queryKeyNode = queryKeyNode.expression\n break\n case AST_NODE_TYPES.Identifier: {\n const expression = ASTUtils.getReferencedExpressionByIdentifier({\n context,\n node: queryKeyNode,\n })\n\n if (expression == null) {\n return queryKeyNode\n }\n queryKeyNode = expression\n break\n }\n default:\n return queryKeyNode\n }\n }\n return queryKeyNode\n}\n","import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'\nimport { ASTUtils } from '../../utils/ast-utils'\nimport { getDocsUrl } from '../../utils/get-docs-url'\nimport { detectTanstackQueryImports } from '../../utils/detect-react-query-imports'\nimport type { TSESLint } from '@typescript-eslint/utils'\nimport type { ExtraRuleDocs } from '../../types'\n\nexport const name = 'stable-query-client'\n\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\n\nexport const rule = createRule({\n name,\n meta: {\n type: 'problem',\n docs: {\n description: 'Makes sure that QueryClient is stable',\n recommended: 'error',\n },\n messages: {\n unstable: [\n 'QueryClient is not stable. It should be either extracted from the component or wrapped in React.useState.',\n 'See https://tkdodo.eu/blog/react-query-fa-qs#2-the-queryclient-is-not-stable',\n ].join('\\n'),\n fixTo: 'Fix to {{result}}',\n },\n hasSuggestions: true,\n fixable: 'code',\n schema: [],\n },\n defaultOptions: [],\n\n create: detectTanstackQueryImports((context, _, helpers) => {\n return {\n NewExpression: (node) => {\n if (\n node.callee.type !== AST_NODE_TYPES.Identifier ||\n node.callee.name !== 'QueryClient' ||\n node.parent.type !== AST_NODE_TYPES.VariableDeclarator ||\n !helpers.isSpecificTanstackQueryImport(\n node.callee,\n '@tanstack/react-query',\n )\n ) {\n return\n }\n\n const fnAncestor = ASTUtils.getFunctionAncestor(\n context.sourceCode,\n node,\n )\n const isReactServerComponent = fnAncestor?.async === true\n\n if (\n !ASTUtils.isValidReactComponentOrHookName(fnAncestor?.id) ||\n isReactServerComponent\n ) {\n return\n }\n\n context.report({\n node: node.parent,\n messageId: 'unstable',\n fix: (() => {\n const { parent } = node\n\n if (parent.id.type !== AST_NODE_TYPES.Identifier) {\n return\n }\n\n // we need the fallbacks for backwards compat with eslint < 8.37.0\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const sourceCode = context.sourceCode ?? context.getSourceCode()\n const nodeText = sourceCode.getText(node)\n const variableName = parent.id.name\n\n return (fixer: TSESLint.RuleFixer) => {\n return fixer.replaceTextRange(\n [parent.range[0], parent.range[1]],\n `[${variableName}] = React.useState(() => ${nodeText})`,\n )\n }\n })(),\n })\n },\n }\n }),\n})\n","import { AST_NODE_TYPES } from '@typescript-eslint/utils'\nimport type {\n ParserServices,\n ParserServicesWithTypeInformation,\n TSESTree,\n} from '@typescript-eslint/utils'\n\ntype TypeChecker = ReturnType<\n ParserServicesWithTypeInformation['program']['getTypeChecker']\n>\ntype Type = ReturnType<TypeChecker['getTypeAtLocation']>\n\nconst QUERY_RESULT_TYPE_NAMES = new Set([\n 'UseBaseQueryResult',\n 'UseQueryResult',\n 'UseSuspenseQueryResult',\n 'DefinedUseQueryResult',\n 'UseInfiniteQueryResult',\n 'UseSuspenseInfiniteQueryResult',\n 'DefinedUseInfiniteQueryResult',\n 'QueryObserverResult',\n 'InfiniteQueryObserverResult',\n])\n\nfunction isQueryResultType(type: Type): boolean {\n if (type.aliasSymbol && QUERY_RESULT_TYPE_NAMES.has(type.aliasSymbol.name)) {\n return true\n }\n const symbol = type.getSymbol()\n if (symbol && QUERY_RESULT_TYPE_NAMES.has(symbol.name)) {\n return true\n }\n return type.isUnion() && type.types.some(isQueryResultType)\n}\n\nexport const NoRestDestructuringUtils = {\n isObjectRestDestructuring(node: TSESTree.Node): boolean {\n if (node.type !== AST_NODE_TYPES.ObjectPattern) {\n return false\n }\n return node.properties.some((p) => p.type === AST_NODE_TYPES.RestElement)\n },\n isQueryResultCall(\n node: TSESTree.CallExpression,\n parserServices: Partial<ParserServices> | null | undefined,\n ): boolean {\n if (!parserServices?.program || !parserServices.esTreeNodeToTSNodeMap) {\n return false\n }\n const checker = parserServices.program.getTypeChecker()\n const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node.callee)\n const signatures = checker.getTypeAtLocation(tsNode).getCallSignatures()\n return signatures.some((sig) => isQueryResultType(sig.getReturnType()))\n },\n}\n","import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'\nimport { getDocsUrl } from '../../utils/get-docs-url'\nimport { ASTUtils } from '../../utils/ast-utils'\nimport { detectTanstackQueryImports } from '../../utils/detect-react-query-imports'\nimport { NoRestDestructuringUtils } from './no-rest-destructuring.utils'\nimport type { ExtraRuleDocs } from '../../types'\n\nexport const name = 'no-rest-destructuring'\n\nconst queryHooks = [\n 'useQuery',\n 'useQueries',\n 'useInfiniteQuery',\n 'useSuspenseQuery',\n 'useSuspenseQueries',\n 'useSuspenseInfiniteQuery',\n]\n\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\n\nexport const rule = createRule({\n name,\n meta: {\n type: 'problem',\n docs: {\n description: 'Disallows rest destructuring in queries',\n recommended: 'warn',\n },\n messages: {\n objectRestDestructure: `Object rest destructuring on a query will observe all changes to the query, leading to excessive re-renders.`,\n },\n schema: [],\n },\n defaultOptions: [],\n\n create: detectTanstackQueryImports((context, _, helpers) => {\n const queryResultVariables = new Set<string>()\n\n return {\n CallExpression: (node) => {\n if (node.parent.type !== AST_NODE_TYPES.VariableDeclarator) {\n return\n }\n\n const returnValue = node.parent.id\n\n const isDirectHook =\n ASTUtils.isIdentifierWithOneOfNames(node.callee, queryHooks) &&\n helpers.isTanstackQueryImport(node.callee)\n\n if (!isDirectHook) {\n // The type-aware path can only report when the result is rest\n // destructured or assigned to an identifier that may later be\n // spread. Skip the expensive type lookup for any other binding.\n const canReportQueryResult =\n returnValue.type === AST_NODE_TYPES.Identifier ||\n NoRestDestructuringUtils.isObjectRestDestructuring(returnValue)\n\n if (\n !canReportQueryResult ||\n !NoRestDestructuringUtils.isQueryResultCall(\n node,\n context.sourceCode.parserServices,\n )\n ) {\n return\n }\n }\n\n const calleeName = ASTUtils.isIdentifier(node.callee)\n ? node.callee.name\n : null\n\n if (\n calleeName !== 'useQueries' &&\n calleeName !== 'useSuspenseQueries'\n ) {\n if (NoRestDestructuringUtils.isObjectRestDestructuring(returnValue)) {\n return context.report({\n node: node.parent,\n messageId: 'objectRestDestructure',\n })\n }\n\n if (returnValue.type === AST_NODE_TYPES.Identifier) {\n queryResultVariables.add(returnValue.name)\n }\n\n return\n }\n\n if (returnValue.type !== AST_NODE_TYPES.ArrayPattern) {\n if (returnValue.type === AST_NODE_TYPES.Identifier) {\n queryResultVariables.add(returnValue.name)\n }\n return\n }\n\n returnValue.elements.forEach((queryResult) => {\n if (queryResult === null) {\n return\n }\n if (NoRestDestructuringUtils.isObjectRestDestructuring(queryResult)) {\n context.report({\n node: queryResult,\n messageId: 'objectRestDestructure',\n })\n }\n })\n },\n\n VariableDeclarator: (node) => {\n if (\n node.init?.type === AST_NODE_TYPES.Identifier &&\n queryResultVariables.has(node.init.name) &&\n NoRestDestructuringUtils.isObjectRestDestructuring(node.id)\n ) {\n context.report({\n node,\n messageId: 'objectRestDestructure',\n })\n }\n },\n\n SpreadElement: (node) => {\n if (\n node.argument.type === AST_NODE_TYPES.Identifier &&\n queryResultVariables.has(node.argument.name)\n ) {\n context.report({\n node,\n messageId: 'objectRestDestructure',\n })\n }\n },\n }\n }),\n})\n","import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'\nimport { getDocsUrl } from '../../utils/get-docs-url'\nimport { detectTanstackQueryImports } from '../../utils/detect-react-query-imports'\nimport type { TSESTree } from '@typescript-eslint/utils'\nimport type { ExtraRuleDocs } from '../../types'\n\nexport const name = 'no-unstable-deps'\n\nexport const reactHookNames = ['useEffect', 'useCallback', 'useMemo']\nexport const useQueryHookNames = [\n 'useQuery',\n 'useSuspenseQuery',\n 'useQueries',\n 'useSuspenseQueries',\n 'useInfiniteQuery',\n 'useSuspenseInfiniteQuery',\n]\nconst allHookNames = ['useMutation', ...useQueryHookNames]\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\n\nexport const rule = createRule({\n name,\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Disallow putting the result of query hooks directly in a React hook dependency array',\n recommended: 'error',\n },\n messages: {\n noUnstableDeps: `The result of {{queryHook}} is not referentially stable, so don't pass it directly into the dependencies array of {{reactHook}}. Instead, destructure the return value of {{queryHook}} and pass the destructured values into the dependency array of {{reactHook}}.`,\n },\n schema: [],\n },\n defaultOptions: [],\n\n create: detectTanstackQueryImports((context, _options, helpers) => {\n const trackedVariables: Record<string, string> = Object.create(null)\n const trackedCustomHooks: Record<string, string> = Object.create(null)\n const hookAliasMap: Record<string, string> = Object.create(null)\n const pendingVariableDeclarators: Array<TSESTree.VariableDeclarator> = []\n const pendingDependencyChecks: Array<{\n reactHook: string\n depsArray: TSESTree.ArrayExpression\n }> = []\n\n function getReactHook(node: TSESTree.CallExpression): string | undefined {\n if (node.callee.type === 'Identifier') {\n const calleeName = node.callee.name\n // Check if the identifier is a known React hook or an alias\n if (reactHookNames.includes(calleeName) || calleeName in hookAliasMap) {\n return calleeName\n }\n } else if (\n node.callee.type === 'MemberExpression' &&\n node.callee.object.type === 'Identifier' &&\n node.callee.object.name === 'React' &&\n node.callee.property.type === 'Identifier' &&\n reactHookNames.includes(node.callee.property.name)\n ) {\n // Member expression case: `React.useCallback`\n return node.callee.property.name\n }\n return undefined\n }\n\n function collectVariableNames(\n pattern: TSESTree.BindingName,\n queryHook: string,\n ) {\n if (pattern.type === AST_NODE_TYPES.Identifier) {\n trackedVariables[pattern.name] = queryHook\n } else if (pattern.type === AST_NODE_TYPES.ArrayPattern) {\n for (const element of pattern.elements) {\n if (element === null) {\n continue\n }\n if (element.type === AST_NODE_TYPES.Identifier) {\n trackedVariables[element.name] = queryHook\n } else if (\n element.type === AST_NODE_TYPES.RestElement &&\n element.argument.type === AST_NODE_TYPES.Identifier\n ) {\n trackedVariables[element.argument.name] = queryHook\n }\n }\n }\n }\n\n function isCustomHookName(hookName: string): boolean {\n return /^use[A-Z0-9]/.test(hookName)\n }\n\n function hasCombineProperty(\n callExpression: TSESTree.CallExpression,\n ): boolean {\n if (callExpression.arguments.length === 0) return false\n\n const firstArg = callExpression.arguments[0]\n if (!firstArg || firstArg.type !== AST_NODE_TYPES.ObjectExpression)\n return false\n\n return firstArg.properties.some(\n (prop) =>\n prop.type === AST_NODE_TYPES.Property &&\n prop.key.type === AST_NODE_TYPES.Identifier &&\n prop.key.name === 'combine',\n )\n }\n\n function getDirectQueryHook(\n callExpression: TSESTree.CallExpression,\n ): string | undefined {\n if (\n callExpression.callee.type !== AST_NODE_TYPES.Identifier ||\n !allHookNames.includes(callExpression.callee.name) ||\n !helpers.isTanstackQueryImport(callExpression.callee)\n ) {\n return undefined\n }\n\n if (\n (callExpression.callee.name === 'useQueries' ||\n callExpression.callee.name === 'useSuspenseQueries') &&\n hasCombineProperty(callExpression)\n ) {\n return undefined\n }\n\n return callExpression.callee.name\n }\n\n function getTrackedQueryHook(\n callExpression: TSESTree.CallExpression,\n ): string | undefined {\n const directQueryHook = getDirectQueryHook(callExpression)\n if (directQueryHook !== undefined) {\n return directQueryHook\n }\n\n if (callExpression.callee.type === AST_NODE_TYPES.Identifier) {\n return trackedCustomHooks[callExpression.callee.name]\n }\n\n return undefined\n }\n\n function getReturnedQueryHook(\n body:\n | TSESTree.FunctionExpression['body']\n | TSESTree.ArrowFunctionExpression['body'],\n ): string | undefined {\n if (body.type === AST_NODE_TYPES.CallExpression) {\n return getDirectQueryHook(body)\n }\n\n if (body.type !== AST_NODE_TYPES.BlockStatement) {\n return undefined\n }\n\n const returnStatements = body.body.filter(\n (statement): statement is TSESTree.ReturnStatement =>\n statement.type === AST_NODE_TYPES.ReturnStatement,\n )\n if (returnStatements.length !== 1) {\n return undefined\n }\n\n const returnArgument = returnStatements[0]?.argument\n if (returnArgument?.type === AST_NODE_TYPES.CallExpression) {\n return getDirectQueryHook(returnArgument)\n }\n\n return undefined\n }\n\n function checkDependencyArray(\n reactHook: string,\n depsArray: TSESTree.ArrayExpression,\n ) {\n depsArray.elements.forEach((dep) => {\n if (\n dep !== null &&\n dep.type === AST_NODE_TYPES.Identifier &&\n trackedVariables[dep.name] !== undefined\n ) {\n const queryHook = trackedVariables[dep.name]\n context.report({\n node: dep,\n messageId: 'noUnstableDeps',\n data: {\n queryHook,\n reactHook,\n },\n })\n }\n })\n }\n\n return {\n ImportDeclaration(node: TSESTree.ImportDeclaration) {\n if (\n node.specifiers.length > 0 &&\n node.importKind === 'value' &&\n node.source.value === 'React'\n ) {\n node.specifiers.forEach((specifier) => {\n if (\n specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n specifier.imported.type === AST_NODE_TYPES.Identifier &&\n reactHookNames.includes(specifier.imported.name)\n ) {\n // Track alias or direct import\n hookAliasMap[specifier.local.name] = specifier.imported.name\n }\n })\n }\n },\n\n FunctionDeclaration(node) {\n if (node.id === null || !isCustomHookName(node.id.name)) {\n return\n }\n\n const queryHook = getReturnedQueryHook(node.body)\n if (queryHook !== undefined) {\n trackedCustomHooks[node.id.name] = queryHook\n }\n },\n\n VariableDeclarator(node) {\n if (\n node.id.type === AST_NODE_TYPES.Identifier &&\n isCustomHookName(node.id.name) &&\n node.init !== null &&\n (node.init.type === AST_NODE_TYPES.ArrowFunctionExpression ||\n node.init.type === AST_NODE_TYPES.FunctionExpression)\n ) {\n const queryHook = getReturnedQueryHook(node.init.body)\n if (queryHook !== undefined) {\n trackedCustomHooks[node.id.name] = queryHook\n }\n }\n\n if (\n node.init !== null &&\n node.init.type === AST_NODE_TYPES.CallExpression\n ) {\n pendingVariableDeclarators.push(node)\n }\n },\n CallExpression: (node) => {\n const reactHook = getReactHook(node)\n if (\n reactHook !== undefined &&\n node.arguments.length > 1 &&\n node.arguments[1]?.type === AST_NODE_TYPES.ArrayExpression\n ) {\n pendingDependencyChecks.push({\n reactHook,\n depsArray: node.arguments[1],\n })\n }\n },\n 'Program:exit'() {\n pendingVariableDeclarators.forEach((node) => {\n if (node.init?.type !== AST_NODE_TYPES.CallExpression) {\n return\n }\n\n const queryHook = getTrackedQueryHook(node.init)\n if (queryHook !== undefined) {\n collectVariableNames(node.id, queryHook)\n }\n })\n\n pendingDependencyChecks.forEach(({ reactHook, depsArray }) => {\n checkDependencyArray(reactHook, depsArray)\n })\n },\n }\n }),\n})\n","export function sortDataByOrder<T, TKey extends keyof T>(\n data: Array<T> | ReadonlyArray<T>,\n orderRules: ReadonlyArray<\n Readonly<[ReadonlyArray<T[TKey]>, ReadonlyArray<T[TKey]>]>\n >,\n key: TKey,\n): Array<T> | null {\n const getSubsetIndex = (\n item: T[TKey],\n subsets: ReadonlyArray<ReadonlyArray<T[TKey]> | Array<T[TKey]>>,\n ): number | null => {\n for (let i = 0; i < subsets.length; i++) {\n if (subsets[i]?.includes(item)) {\n return i\n }\n }\n return null\n }\n\n const orderSets = orderRules.reduce(\n (sets, [A, B]) => [...sets, A, B],\n [] as Array<ReadonlyArray<T[TKey]> | Array<T[TKey]>>,\n )\n\n const inOrderArray = data.filter(\n (item) => getSubsetIndex(item[key], orderSets) !== null,\n )\n\n let wasResorted = false as boolean\n\n // Sort by the relative order defined by the rules\n const sortedArray = inOrderArray.sort((a, b) => {\n const aKey = a[key],\n bKey = b[key]\n const aSubsetIndex = getSubsetIndex(aKey, orderSets)\n const bSubsetIndex = getSubsetIndex(bKey, orderSets)\n\n // If both items belong to different subsets, sort by their subset order\n if (\n aSubsetIndex !== null &&\n bSubsetIndex !== null &&\n aSubsetIndex !== bSubsetIndex\n ) {\n return aSubsetIndex - bSubsetIndex\n }\n\n // If both items belong to the same subset or neither is in the subset, keep their relative order\n return 0\n })\n\n const inOrderIterator = sortedArray.values()\n const result = data.map((item) => {\n if (getSubsetIndex(item[key], orderSets) !== null) {\n const sortedItem = inOrderIterator.next().value!\n if (sortedItem[key] !== item[key]) {\n wasResorted = true\n }\n return sortedItem\n }\n return item\n })\n\n if (!wasResorted) {\n return null\n }\n return result\n}\n","import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'\n\nimport { getDocsUrl } from './get-docs-url'\nimport { detectTanstackQueryImports } from './detect-react-query-imports'\nimport { sortDataByOrder } from './sort-data-by-order'\nimport type { ExtraRuleDocs } from '../types'\n\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\n\nexport function createPropertyOrderRule<\n TFunc extends string,\n TProp extends string,\n>(\n options: Omit<Parameters<typeof createRule>[0], 'create'>,\n targetFunctions: ReadonlyArray<TFunc> | Array<TFunc>,\n orderRules: ReadonlyArray<\n Readonly<[ReadonlyArray<TProp>, ReadonlyArray<TProp>]>\n >,\n) {\n const targetFunctionSet = new Set(targetFunctions)\n function isTargetFunction(node: any): node is TFunc {\n return targetFunctionSet.has(node)\n }\n\n return createRule({\n ...options,\n create: detectTanstackQueryImports((context) => {\n return {\n CallExpression(node) {\n if (node.callee.type !== AST_NODE_TYPES.Identifier) {\n return\n }\n const functions = node.callee.name\n if (!isTargetFunction(functions)) {\n return\n }\n const argument = node.arguments[0]\n if (argument === undefined || argument.type !== 'ObjectExpression') {\n return\n }\n\n const allProperties = argument.properties\n\n // no need to sort if there is at max 1 property\n if (allProperties.length < 2) {\n return\n }\n\n const properties = allProperties.flatMap((p, index) => {\n if (\n p.type === AST_NODE_TYPES.Property &&\n p.key.type === AST_NODE_TYPES.Identifier\n ) {\n return { name: p.key.name, property: p }\n } else return { name: `_property_${index}`, property: p }\n })\n\n const sortedProperties = sortDataByOrder(\n properties,\n orderRules,\n 'name',\n )\n if (sortedProperties === null) {\n return\n }\n\n context.report({\n node: argument,\n data: { function: node.callee.name },\n messageId: 'invalidOrder',\n fix(fixer) {\n const sourceCode = context.sourceCode\n\n const reorderedText = sortedProperties.reduce(\n (sourceText, specifier, index) => {\n let textBetweenProperties = ''\n if (index < allProperties.length - 1) {\n textBetweenProperties = sourceCode\n .getText()\n .slice(\n allProperties[index]!.range[1],\n allProperties[index + 1]!.range[0],\n )\n }\n return (\n sourceText +\n sourceCode.getText(specifier.property) +\n textBetweenProperties\n )\n },\n '',\n )\n return fixer.replaceTextRange(\n [allProperties[0]!.range[0], allProperties.at(-1)!.range[1]],\n reorderedText,\n )\n },\n })\n },\n }\n }),\n })\n}\n","export const infiniteQueryFunctions = [\n 'infiniteQueryOptions',\n 'useInfiniteQuery',\n 'useSuspenseInfiniteQuery',\n] as const\n\nexport type InfiniteQueryFunctions = (typeof infiniteQueryFunctions)[number]\n\nexport const checkedProperties = [\n 'queryFn',\n 'getPreviousPageParam',\n 'getNextPageParam',\n] as const\n\nexport type InfiniteQueryProperties = (typeof checkedProperties)[number]\n\nexport const sortRules = [\n [['queryFn'], ['getPreviousPageParam', 'getNextPageParam']],\n] as const\n","import { createPropertyOrderRule } from '../../utils/create-property-order-rule'\nimport { infiniteQueryFunctions, sortRules } from './constants'\nimport type {\n InfiniteQueryFunctions,\n InfiniteQueryProperties,\n} from './constants'\n\nexport const name = 'infinite-query-property-order'\n\nexport const rule = createPropertyOrderRule<\n InfiniteQueryFunctions,\n InfiniteQueryProperties\n>(\n {\n name,\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Ensure correct order of inference sensitive properties for infinite queries',\n recommended: 'error',\n },\n messages: {\n invalidOrder: 'Invalid order of properties for `{{function}}`.',\n },\n schema: [],\n hasSuggestions: true,\n fixable: 'code',\n },\n defaultOptions: [],\n },\n infiniteQueryFunctions,\n sortRules,\n)\n","import { ESLintUtils } from '@typescript-eslint/utils'\nimport { ASTUtils } from '../../utils/ast-utils'\nimport { detectTanstackQueryImports } from '../../utils/detect-react-query-imports'\nimport { getDocsUrl } from '../../utils/get-docs-url'\nimport type { ParserServicesWithTypeInformation } from '@typescript-eslint/utils'\nimport type { ExtraRuleDocs } from '../../types'\n\nexport const name = 'no-void-query-fn'\n\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\n\nexport const rule = createRule({\n name,\n meta: {\n type: 'problem',\n docs: {\n description: 'Ensures queryFn returns a non-undefined value',\n recommended: 'error',\n },\n messages: {\n noVoidReturn: 'queryFn must return a non-undefined value',\n },\n schema: [],\n },\n defaultOptions: [],\n\n create: detectTanstackQueryImports((context) => {\n return {\n Property(node) {\n if (\n !ASTUtils.isObjectExpression(node.parent) ||\n !ASTUtils.isIdentifierWithName(node.key, 'queryFn')\n ) {\n return\n }\n\n const parserServices = context.sourceCode.parserServices\n\n if (\n !parserServices ||\n !parserServices.esTreeNodeToTSNodeMap ||\n !parserServices.program\n ) {\n return\n }\n\n const checker = parserServices.program.getTypeChecker()\n const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node.value)\n const type = checker.getTypeAtLocation(tsNode)\n\n // Get the return type of the function\n if (type.getCallSignatures().length > 0) {\n const returnType = type.getCallSignatures()[0]?.getReturnType()\n\n if (!returnType) {\n return\n }\n\n // Check if return type is void or undefined\n if (isIllegalReturn(checker, returnType)) {\n context.report({\n node: node.value,\n messageId: 'noVoidReturn',\n })\n }\n }\n },\n }\n }),\n})\n\ntype Program = ParserServicesWithTypeInformation['program']\ntype TypeChecker = ReturnType<Program['getTypeChecker']>\ntype Type = ReturnType<TypeChecker['getTypeAtLocation']>\n\nfunction isIllegalReturn(checker: TypeChecker, type: Type): boolean {\n const awaited = checker.getAwaitedType(type)\n\n if (!awaited) return false\n\n if (awaited.isUnion()) {\n return awaited.types.some((t) => isIllegalReturn(checker, t))\n }\n\n const typeString = checker.typeToString(awaited)\n return typeString === 'void' || typeString === 'undefined'\n}\n","export const mutationFunctions = ['useMutation'] as const\n\nexport type MutationFunctions = (typeof mutationFunctions)[number]\n\nexport const checkedProperties = ['onMutate', 'onError', 'onSettled'] as const\n\nexport type MutationProperties = (typeof checkedProperties)[number]\n\nexport const sortRules = [[['onMutate'], ['onError', 'onSettled']]] as const\n","import { createPropertyOrderRule } from '../../utils/create-property-order-rule'\nimport { mutationFunctions, sortRules } from './constants'\nimport type { MutationFunctions, MutationProperties } from './constants'\n\nexport const name = 'mutation-property-order'\n\nexport const rule = createPropertyOrderRule<\n MutationFunctions,\n MutationProperties\n>(\n {\n name,\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Ensure correct order of inference-sensitive properties in useMutation()',\n recommended: 'error',\n },\n messages: {\n invalidOrder: 'Invalid order of properties for `{{function}}`.',\n },\n schema: [],\n hasSuggestions: true,\n fixable: 'code',\n },\n defaultOptions: [],\n },\n mutationFunctions,\n sortRules,\n)\n","import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'\nimport { ASTUtils } from '../../utils/ast-utils'\nimport { detectTanstackQueryImports } from '../../utils/detect-react-query-imports'\nimport { getDocsUrl } from '../../utils/get-docs-url'\nimport type { TSESLint, TSESTree } from '@typescript-eslint/utils'\nimport type { ExtraRuleDocs } from '../../types'\n\nexport const name = 'prefer-query-options'\n\nconst queryHooks = [\n 'useQuery',\n 'useInfiniteQuery',\n 'useSuspenseQuery',\n 'useSuspenseInfiniteQuery',\n 'usePrefetchQuery',\n 'usePrefetchInfiniteQuery',\n]\n\nconst queriesHooks = ['useQueries', 'useSuspenseQueries']\n\nconst filterHooks = ['useIsFetching']\n\nconst queryClientOptionMethods = [\n 'fetchQuery',\n 'prefetchQuery',\n 'fetchInfiniteQuery',\n 'prefetchInfiniteQuery',\n 'ensureQueryData',\n 'ensureInfiniteQueryData',\n]\n\nconst queryClientQueryKeyMethods = [\n 'getQueryData',\n 'setQueryData',\n 'getQueryState',\n 'setQueryDefaults',\n 'getQueryDefaults',\n]\n\nconst queryClientFilterMethods = [\n 'invalidateQueries',\n 'cancelQueries',\n 'refetchQueries',\n 'removeQueries',\n 'resetQueries',\n 'isFetching',\n 'getQueriesData',\n 'setQueriesData',\n]\n\nconst queryOptionsBuilders = ['queryOptions', 'infiniteQueryOptions']\n\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\ntype Helpers = {\n isTanstackQueryImport: (node: TSESTree.Identifier) => boolean\n}\n\nexport const rule = createRule({\n name,\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Prefer using queryOptions() to co-locate queryKey and queryFn',\n recommended: 'strict',\n },\n messages: {\n preferQueryOptions:\n 'Prefer using queryOptions() or infiniteQueryOptions() to co-locate queryKey and queryFn.',\n preferQueryOptionsQueryKey:\n 'Prefer referencing a queryKey from a queryOptions() result instead of typing it manually.',\n },\n schema: [],\n },\n defaultOptions: [],\n\n create: detectTanstackQueryImports((context, _, helpers) => {\n function reportInlineQueryOptions(node: TSESTree.Node): void {\n if (ASTUtils.isObjectExpression(node) && hasInlineQueryOptions(node)) {\n context.report({\n node,\n messageId: 'preferQueryOptions',\n })\n }\n }\n\n function reportInlineFilterQueryKey(node: TSESTree.Node): void {\n if (ASTUtils.isObjectExpression(node) && hasInlineFilterQueryKey(node)) {\n context.report({\n node,\n messageId: 'preferQueryOptionsQueryKey',\n })\n }\n }\n\n return {\n CallExpression: (node) => {\n if (ASTUtils.isIdentifier(node.callee)) {\n const importedName = getTanstackImportName(\n context,\n helpers,\n node.callee,\n )\n\n if (importedName === null) {\n return\n }\n\n if (queryOptionsBuilders.includes(importedName)) {\n return\n }\n\n const options = node.arguments[0]\n\n if (options === undefined) {\n return\n }\n\n if (queryHooks.includes(importedName)) {\n reportInlineQueryOptions(options)\n return\n }\n\n if (\n queriesHooks.includes(importedName) &&\n ASTUtils.isObjectExpression(options)\n ) {\n const queries = ASTUtils.findPropertyWithIdentifierKey(\n options.properties,\n 'queries',\n )?.value\n\n if (queries !== undefined) {\n getQueryObjects(queries).forEach((query) => {\n reportInlineQueryOptions(query)\n })\n }\n\n return\n }\n\n if (filterHooks.includes(importedName)) {\n reportInlineFilterQueryKey(options)\n }\n\n return\n }\n\n if (\n node.callee.type !== AST_NODE_TYPES.MemberExpression ||\n !ASTUtils.isIdentifier(node.callee.property) ||\n !isTanstackQueryClient(node.callee.object, context, helpers)\n ) {\n return\n }\n\n const method = node.callee.property.name\n const options = node.arguments[0]\n\n if (options === undefined) {\n return\n }\n\n if (queryClientOptionMethods.includes(method)) {\n reportInlineQueryOptions(options)\n return\n }\n\n if (\n queryClientQueryKeyMethods.includes(method) &&\n isInlineArrayExpression(options)\n ) {\n context.report({\n node: options,\n messageId: 'preferQueryOptionsQueryKey',\n })\n return\n }\n\n if (queryClientFilterMethods.includes(method)) {\n reportInlineFilterQueryKey(options)\n }\n },\n }\n }),\n})\n\nfunction hasInlineQueryOptions(node: TSESTree.ObjectExpression): boolean {\n return (\n ASTUtils.findPropertyWithIdentifierKey(node.properties, 'queryKey') !==\n undefined ||\n ASTUtils.findPropertyWithIdentifierKey(node.properties, 'queryFn') !==\n undefined\n )\n}\n\nfunction hasInlineFilterQueryKey(node: TSESTree.ObjectExpression): boolean {\n const queryKey = ASTUtils.findPropertyWithIdentifierKey(\n node.properties,\n 'queryKey',\n )?.value\n\n return queryKey !== undefined && isInlineArrayExpression(queryKey)\n}\n\nfunction isInlineArrayExpression(node: TSESTree.Node): boolean {\n return unwrapTypeAssertions(node).type === AST_NODE_TYPES.ArrayExpression\n}\n\nfunction getReturnedObjectExpressions(\n node: TSESTree.Node,\n): Array<TSESTree.ObjectExpression> {\n if (ASTUtils.isObjectExpression(node)) {\n return [node]\n }\n\n if (\n node.type === AST_NODE_TYPES.ArrowFunctionExpression ||\n node.type === AST_NODE_TYPES.FunctionExpression\n ) {\n return getReturnedObjectExpressions(node.body)\n }\n\n if (node.type === AST_NODE_TYPES.BlockStatement) {\n return node.body.flatMap((statement) => {\n if (\n statement.type === AST_NODE_TYPES.ReturnStatement &&\n statement.argument !== null\n ) {\n return getReturnedObjectExpressions(statement.argument)\n }\n\n return []\n })\n }\n\n if (node.type === AST_NODE_TYPES.ConditionalExpression) {\n return [\n ...getReturnedObjectExpressions(node.consequent),\n ...getReturnedObjectExpressions(node.alternate),\n ]\n }\n\n if (node.type === AST_NODE_TYPES.LogicalExpression) {\n return [\n ...getReturnedObjectExpressions(node.left),\n ...getReturnedObjectExpressions(node.right),\n ]\n }\n\n if (node.type === AST_NODE_TYPES.SequenceExpression) {\n return node.expressions.flatMap((expression) =>\n getReturnedObjectExpressions(expression),\n )\n }\n\n return []\n}\n\nfunction getQueryObjects(\n node: TSESTree.Node,\n): Array<TSESTree.ObjectExpression> {\n if (node.type === AST_NODE_TYPES.ArrayExpression) {\n return node.elements.flatMap((element) => {\n if (element !== null && ASTUtils.isObjectExpression(element)) {\n return [element]\n }\n\n return []\n })\n }\n\n if (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n ASTUtils.isIdentifierWithName(node.callee.property, 'map')\n ) {\n const mapper = node.arguments[0]\n\n if (\n mapper?.type === AST_NODE_TYPES.ArrowFunctionExpression ||\n mapper?.type === AST_NODE_TYPES.FunctionExpression\n ) {\n return getReturnedObjectExpressions(mapper)\n }\n }\n\n return []\n}\n\nfunction isTanstackQueryClient(\n node: TSESTree.Node,\n context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>,\n helpers: Helpers,\n): boolean {\n const source = resolveQueryClientSource(node, context)\n\n if (\n source.type === AST_NODE_TYPES.CallExpression &&\n ASTUtils.isIdentifier(source.callee)\n ) {\n return (\n getTanstackImportName(context, helpers, source.callee) ===\n 'useQueryClient'\n )\n }\n\n if (\n source.type === AST_NODE_TYPES.NewExpression &&\n ASTUtils.isIdentifier(source.callee)\n ) {\n return (\n getTanstackImportName(context, helpers, source.callee) === 'QueryClient'\n )\n }\n\n return false\n}\n\nfunction getTanstackImportName(\n context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>,\n helpers: Helpers,\n node: TSESTree.Identifier,\n): string | null {\n if (!helpers.isTanstackQueryImport(node)) {\n return null\n }\n\n const definition = context.sourceCode\n .getScope(node)\n .references.find((reference) => reference.identifier === node)?.resolved\n ?.defs[0]?.node\n\n if (\n definition?.type !== AST_NODE_TYPES.ImportSpecifier ||\n definition.imported.type !== AST_NODE_TYPES.Identifier\n ) {\n return null\n }\n\n return definition.imported.name\n}\n\nfunction resolveQueryClientSource(\n node: TSESTree.Node,\n context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>,\n): TSESTree.Node {\n const visitedNodes = new Set<TSESTree.Node>()\n\n while (!visitedNodes.has(node)) {\n visitedNodes.add(node)\n\n if (node.type === AST_NODE_TYPES.ChainExpression) {\n node = node.expression\n continue\n }\n\n node = unwrapTypeAssertions(node)\n\n if (node.type !== AST_NODE_TYPES.Identifier) {\n return node\n }\n\n const expression = ASTUtils.getReferencedExpressionByIdentifier({\n context,\n node,\n })\n\n if (expression === null) {\n return node\n }\n\n node = expression\n }\n\n return node\n}\n\nfunction unwrapTypeAssertions(node: TSESTree.Node): TSESTree.Node {\n while (\n node.type === AST_NODE_TYPES.TSAsExpression ||\n node.type === AST_NODE_TYPES.TSSatisfiesExpression ||\n node.type === AST_NODE_TYPES.TSTypeAssertion\n ) {\n node = node.expression\n }\n\n return node\n}\n","import * as exhaustiveDeps from './rules/exhaustive-deps/exhaustive-deps.rule'\nimport * as stableQueryClient from './rules/stable-query-client/stable-query-client.rule'\nimport * as noRestDestructuring from './rules/no-rest-destructuring/no-rest-destructuring.rule'\nimport * as noUnstableDeps from './rules/no-unstable-deps/no-unstable-deps.rule'\nimport * as infiniteQueryPropertyOrder from './rules/infinite-query-property-order/infinite-query-property-order.rule'\nimport * as noVoidQueryFn from './rules/no-void-query-fn/no-void-query-fn.rule'\nimport * as mutationPropertyOrder from './rules/mutation-property-order/mutation-property-order.rule'\nimport * as preferQueryOptions from './rules/prefer-query-options/prefer-query-options.rule'\nimport type { ESLintUtils } from '@typescript-eslint/utils'\nimport type { ExtraRuleDocs } from './types'\n\nexport const rules: Record<\n string,\n ESLintUtils.RuleModule<\n string,\n ReadonlyArray<unknown>,\n ExtraRuleDocs,\n ESLintUtils.RuleListener\n >\n> = {\n [exhaustiveDeps.name]: exhaustiveDeps.rule,\n [stableQueryClient.name]: stableQueryClient.rule,\n [noRestDestructuring.name]: noRestDestructuring.rule,\n [noUnstableDeps.name]: noUnstableDeps.rule,\n [infiniteQueryPropertyOrder.name]: infiniteQueryPropertyOrder.rule,\n [noVoidQueryFn.name]: noVoidQueryFn.rule,\n [mutationPropertyOrder.name]: mutationPropertyOrder.rule,\n [preferQueryOptions.name]: preferQueryOptions.rule,\n}\n"],"mappings":";;AAAA,SAAgB,SAAY,KAAe,IAAiC;CAC1E,OAAO,IAAI,QAAQ,GAAG,GAAG,MAAM,EAAE,WAAW,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;AAC1E;;;ACEA,MAAa,WAAW;CACtB,cACE,MACA,OACqC;EACrC,OAAO,MAAM,SAAS,KAAK,IAAS;CACtC;CACA,aAAa,MAAkD;EAC7D,OAAO,KAAK,SAAS,eAAe;CACtC;CACA,qBACE,MACA,MAC6B;EAC7B,OAAO,SAAS,aAAa,IAAI,KAAK,KAAK,SAAS;CACtD;CACA,2BACE,MACA,MACmD;EACnD,OAAO,SAAS,aAAa,IAAI,KAAK,KAAK,SAAS,KAAK,IAAI;CAC/D;CACA,WAAW,MAAgD;EACzD,OAAO,KAAK,SAAS,eAAe;CACtC;CACA,mB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