@r_masseater/oxlint-typed-rules 0.1.2 → 0.1.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 (36) hide show
  1. package/LICENSE +258 -0
  2. package/README.md +23 -0
  3. package/dist/config-rules-CIyMUUvG.mjs +6 -0
  4. package/dist/config-rules-CIyMUUvG.mjs.map +1 -0
  5. package/dist/drizzle.d.mts +5 -0
  6. package/dist/drizzle.mjs +232 -0
  7. package/dist/drizzle.mjs.map +1 -0
  8. package/dist/eslint-utils-DauzR3x9.mjs +489 -0
  9. package/dist/eslint-utils-DauzR3x9.mjs.map +1 -0
  10. package/dist/index.d.mts +12 -1
  11. package/dist/index.mjs +1 -1
  12. package/dist/react.d.mts +4 -2
  13. package/dist/react.mjs +9 -301
  14. package/dist/react.mjs.map +1 -1
  15. package/dist/rolldown-runtime-DQp2zzRu.mjs +41 -0
  16. package/dist/tanstack-query.d.mts +5 -0
  17. package/dist/tanstack-query.mjs +1379 -0
  18. package/dist/tanstack-query.mjs.map +1 -0
  19. package/dist/tanstack-router.d.mts +5 -0
  20. package/dist/tanstack-router.mjs +344 -0
  21. package/dist/tanstack-router.mjs.map +1 -0
  22. package/dist/tanstack-start.mjs +6 -4
  23. package/dist/tanstack-start.mjs.map +1 -1
  24. package/dist/ts-compat-kqrVqnFj.mjs +132 -0
  25. package/dist/ts-compat-kqrVqnFj.mjs.map +1 -0
  26. package/dist/{typed-rule-D8jasU_z.mjs → typed-rule-DsbM82SI.mjs} +20 -4
  27. package/dist/typed-rule-DsbM82SI.mjs.map +1 -0
  28. package/dist/typescript-eslint-utils-QnYasB-9.mjs +16 -0
  29. package/dist/typescript-eslint-utils-QnYasB-9.mjs.map +1 -0
  30. package/dist/upstream-plugin-DqJEA6iy.mjs +20 -0
  31. package/dist/upstream-plugin-DqJEA6iy.mjs.map +1 -0
  32. package/dist/upstream-plugin-xn91RvOJ.d.mts +15 -0
  33. package/package.json +43 -5
  34. package/dist/eslint-utils-CTNWAzIf.mjs +0 -352
  35. package/dist/eslint-utils-CTNWAzIf.mjs.map +0 -1
  36. package/dist/typed-rule-D8jasU_z.mjs.map +0 -1
@@ -0,0 +1,1379 @@
1
+ import { n as import_eslint_utils, r as init_typescript_eslint_utils, t as import_dist } from "./typescript-eslint-utils-QnYasB-9.mjs";
2
+ import { n as optionallyTypedRules } from "./typed-rule-DsbM82SI.mjs";
3
+ import { n as upstreamPlugin } from "./upstream-plugin-DqJEA6iy.mjs";
4
+ // ../../node_modules/.pnpm/@tanstack+eslint-plugin-query@5.105.3_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__su_d952cca362d1d08c5aa1aaa1487f168b/node_modules/@tanstack/eslint-plugin-query/build/modern/rules-D9GziSYo.js
5
+ init_typescript_eslint_utils();
6
+ /**
7
+ * Removes duplicate items, keeping the first item for each key.
8
+ * @param arr - The items.
9
+ * @param fn - Returns the key that identifies an item.
10
+ * @returns The items with unique keys, in their original order.
11
+ */
12
+ function uniqueBy(arr, fn) {
13
+ return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i);
14
+ }
15
+ const ASTUtils = {
16
+ isNodeOfOneOf(node, types) {
17
+ return types.includes(node.type);
18
+ },
19
+ isIdentifier(node) {
20
+ return node.type === import_dist.AST_NODE_TYPES.Identifier;
21
+ },
22
+ isIdentifierWithName(node, name) {
23
+ return ASTUtils.isIdentifier(node) && node.name === name;
24
+ },
25
+ isIdentifierWithOneOfNames(node, name) {
26
+ return ASTUtils.isIdentifier(node) && name.includes(node.name);
27
+ },
28
+ isProperty(node) {
29
+ return node.type === import_dist.AST_NODE_TYPES.Property;
30
+ },
31
+ isObjectExpression(node) {
32
+ return node.type === import_dist.AST_NODE_TYPES.ObjectExpression;
33
+ },
34
+ isPropertyWithIdentifierKey(node, key) {
35
+ return ASTUtils.isProperty(node) && ASTUtils.isIdentifierWithName(node.key, key);
36
+ },
37
+ findPropertyWithIdentifierKey(properties, key) {
38
+ return properties.find((x) => ASTUtils.isPropertyWithIdentifierKey(x, key));
39
+ },
40
+ traverseUpOnly(identifier, allowedNodeTypes) {
41
+ const parent = identifier.parent;
42
+ if (parent !== void 0 && allowedNodeTypes.includes(parent.type)) return ASTUtils.traverseUpOnly(parent, allowedNodeTypes);
43
+ return identifier;
44
+ },
45
+ traverseUpMemberExpression(node) {
46
+ const parent = node.parent;
47
+ if (parent !== void 0 && (parent.type === import_dist.AST_NODE_TYPES.MemberExpression && parent.object === node || parent.type === import_dist.AST_NODE_TYPES.ChainExpression || parent.type === import_dist.AST_NODE_TYPES.TSNonNullExpression)) return ASTUtils.traverseUpMemberExpression(parent);
48
+ return node;
49
+ },
50
+ isDeclaredInNode(params) {
51
+ const { functionNode, reference, scopeManager } = params;
52
+ const scope = scopeManager.acquire(functionNode);
53
+ if (scope === null) return false;
54
+ return scope.set.has(reference.identifier.name);
55
+ },
56
+ getExternalRefs(params) {
57
+ const { scopeManager, sourceCode, node } = params;
58
+ const scope = scopeManager.acquire(node);
59
+ if (scope === null) return [];
60
+ const collectReferences = (currentScope) => {
61
+ const references = [...currentScope.references];
62
+ for (const childScope of currentScope.childScopes) references.push(...collectReferences(childScope));
63
+ return references;
64
+ };
65
+ const references = collectReferences(scope).filter((x) => x.isRead() && !scope.set.has(x.identifier.name)).map((x) => {
66
+ const memberPath = ASTUtils.traverseUpMemberExpression(x.identifier);
67
+ const memberExpression = memberPath.parent;
68
+ const referenceNode = memberExpression !== void 0 && memberExpression.type === import_dist.AST_NODE_TYPES.MemberExpression && memberExpression.computed && memberExpression.property === memberPath && memberExpression.parent.type === import_dist.AST_NODE_TYPES.CallExpression && memberExpression.parent.callee === memberExpression ? memberPath : ASTUtils.traverseUpOnly(x.identifier, [import_dist.AST_NODE_TYPES.MemberExpression, import_dist.AST_NODE_TYPES.Identifier]);
69
+ return {
70
+ variable: x,
71
+ node: referenceNode,
72
+ text: sourceCode.getText(referenceNode)
73
+ };
74
+ });
75
+ const localRefIds = new Set([...scope.set.values()].map((x) => sourceCode.getText(x.identifiers[0])));
76
+ return uniqueBy(references.filter((x) => x.variable.resolved === null || !localRefIds.has(x.text)), (x) => x.text).map((x) => x.variable);
77
+ },
78
+ isValidReactComponentOrHookName(identifier) {
79
+ return identifier !== null && identifier !== void 0 && /^(use|[A-Z])/.test(identifier.name);
80
+ },
81
+ getFunctionAncestor(sourceCode, node) {
82
+ for (const ancestor of sourceCode.getAncestors(node)) {
83
+ if (ASTUtils.isNodeOfOneOf(ancestor, [
84
+ import_dist.AST_NODE_TYPES.FunctionDeclaration,
85
+ import_dist.AST_NODE_TYPES.FunctionExpression,
86
+ import_dist.AST_NODE_TYPES.ArrowFunctionExpression
87
+ ])) return ancestor;
88
+ if (ancestor.parent?.type === import_dist.AST_NODE_TYPES.VariableDeclarator && ancestor.parent.id.type === import_dist.AST_NODE_TYPES.Identifier && ASTUtils.isNodeOfOneOf(ancestor, [
89
+ import_dist.AST_NODE_TYPES.FunctionDeclaration,
90
+ import_dist.AST_NODE_TYPES.FunctionExpression,
91
+ import_dist.AST_NODE_TYPES.ArrowFunctionExpression
92
+ ])) return ancestor;
93
+ }
94
+ },
95
+ getReferencedExpressionByIdentifier(params) {
96
+ const { node, context } = params;
97
+ const sourceCode = context.sourceCode ?? context.getSourceCode();
98
+ const resolvedNode = (context.sourceCode.getScope(node) ? sourceCode.getScope(node) : context.getScope()).references.find((ref) => ref.identifier === node)?.resolved?.defs[0]?.node;
99
+ if (resolvedNode?.type !== import_dist.AST_NODE_TYPES.VariableDeclarator) return null;
100
+ return resolvedNode.init;
101
+ }
102
+ };
103
+ /**
104
+ * Builds the URL of a rule's documentation page.
105
+ * @param ruleName - The rule's name, e.g. `exhaustive-deps`.
106
+ * @returns The URL of the rule's page in the ESLint plugin docs.
107
+ */
108
+ const getDocsUrl = (ruleName) => `https://tanstack.com/query/latest/docs/eslint/${ruleName}`;
109
+ /**
110
+ * Wraps a rule's `create` function to track the identifiers imported from TanStack Query packages,
111
+ * and passes helpers that check them.
112
+ * @param create - The rule's `create` function, which also receives the helpers.
113
+ * @returns The wrapped `create` function.
114
+ */
115
+ function detectTanstackQueryImports(create) {
116
+ return (context, optionsWithDefault) => {
117
+ const tanstackQueryImportSpecifiers = [];
118
+ const helpers = {
119
+ isSpecificTanstackQueryImport(node, source) {
120
+ return !!tanstackQueryImportSpecifiers.find((specifier) => {
121
+ if (specifier.type === import_dist.TSESTree.AST_NODE_TYPES.ImportSpecifier && specifier.parent.type === import_dist.TSESTree.AST_NODE_TYPES.ImportDeclaration && specifier.parent.source.value === source) return node.name === specifier.local.name;
122
+ return false;
123
+ });
124
+ },
125
+ isTanstackQueryImport(node) {
126
+ return !!tanstackQueryImportSpecifiers.find((specifier) => {
127
+ if (specifier.type === import_dist.TSESTree.AST_NODE_TYPES.ImportSpecifier) return node.name === specifier.local.name;
128
+ return false;
129
+ });
130
+ }
131
+ };
132
+ const detectionInstructions = { ImportDeclaration(node) {
133
+ if (node.specifiers.length > 0 && (node.importKind === "value" || node.importKind === void 0) && node.source.value.startsWith("@tanstack/") && node.source.value.endsWith("-query")) tanstackQueryImportSpecifiers.push(...node.specifiers);
134
+ } };
135
+ const ruleInstructions = create(context, optionsWithDefault, helpers);
136
+ const enhancedRuleInstructions = {};
137
+ new Set(Object.keys(detectionInstructions).concat(Object.keys(ruleInstructions))).forEach((instruction) => {
138
+ enhancedRuleInstructions[instruction] = (node) => {
139
+ if (instruction in detectionInstructions) detectionInstructions[instruction]?.(node);
140
+ const ruleInstruction = ruleInstructions[instruction];
141
+ if (ruleInstruction) return ruleInstruction(node);
142
+ };
143
+ });
144
+ return enhancedRuleInstructions;
145
+ };
146
+ }
147
+ const ExhaustiveDepsUtils = {
148
+ isRelevantReference(params) {
149
+ const { sourceCode, reference, scopeManager, node, filename } = params;
150
+ const component = ASTUtils.getFunctionAncestor(sourceCode, node);
151
+ const queryFnScope = scopeManager.acquire(node);
152
+ if (queryFnScope === null || reference.isValueReference === false) return false;
153
+ let currentScope = reference.resolved?.scope ?? null;
154
+ while (currentScope !== null) {
155
+ if (currentScope === queryFnScope) return false;
156
+ currentScope = currentScope.upper;
157
+ }
158
+ if (component !== void 0) {
159
+ if (!ASTUtils.isDeclaredInNode({
160
+ scopeManager,
161
+ reference,
162
+ functionNode: component
163
+ })) return false;
164
+ } else {
165
+ if (!filename.endsWith(".vue")) return false;
166
+ const definition = reference.resolved?.defs[0];
167
+ const isGlobalVariable = definition === void 0;
168
+ const isImport = definition?.type === "ImportBinding";
169
+ if (isGlobalVariable || isImport) return false;
170
+ }
171
+ return reference.identifier.name !== "undefined" && !ExhaustiveDepsUtils.isFunctionCallTarget(reference.identifier) && reference.identifier.parent.type !== import_dist.AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent);
172
+ },
173
+ isFunctionCallTarget(identifier) {
174
+ const callee = ASTUtils.traverseUpMemberExpression(identifier);
175
+ return callee.parent !== void 0 && callee.parent.type === import_dist.AST_NODE_TYPES.CallExpression && callee.parent.callee === callee;
176
+ },
177
+ /**
178
+ * Given required refs and existing queryKey entries, compute missing dependency paths
179
+ * respecting allowlisted variables and types.
180
+ * @param params - The references the query function needs, the allowlisted variables, and the
181
+ * root identifiers and full paths already in the query key.
182
+ * @returns The missing dependency paths, without paths whose root is already missing.
183
+ */
184
+ computeFilteredMissingPaths(params) {
185
+ const { requiredRefs, allowlistedVariables, existingRootIdentifiers, existingFullPaths } = params;
186
+ const missingPaths = /* @__PURE__ */ new Set();
187
+ for (const { root, path, allowlistedByType } of requiredRefs) {
188
+ if (existingRootIdentifiers.has(root)) continue;
189
+ if (allowlistedVariables.has(root)) continue;
190
+ if (existingFullPaths.has(path)) continue;
191
+ if (allowlistedByType) continue;
192
+ missingPaths.add(path);
193
+ }
194
+ for (const path of missingPaths) {
195
+ const root = path.split(".")[0];
196
+ if (root !== path && root !== void 0 && missingPaths.has(root)) missingPaths.delete(path);
197
+ }
198
+ return Array.from(missingPaths);
199
+ },
200
+ /**
201
+ * Extract existing queryKey deps as root identifiers and full member paths.
202
+ * @param params - The source code, the scope manager, and the query key node to scan.
203
+ * @returns The root identifiers that cover all of their members, and every dependency path.
204
+ */
205
+ collectQueryKeyDeps(params) {
206
+ const { sourceCode, scopeManager, queryKeyNode } = params;
207
+ const roots = /* @__PURE__ */ new Set();
208
+ const paths = /* @__PURE__ */ new Set();
209
+ const visitorKeys = sourceCode.visitorKeys;
210
+ /**
211
+ * Records an identifier that covers all of its members.
212
+ * @param name - The identifier, normalized before it is recorded.
213
+ */
214
+ function addRoot(name) {
215
+ const cleaned = ExhaustiveDepsUtils.normalizeChain(name);
216
+ roots.add(cleaned);
217
+ paths.add(cleaned);
218
+ }
219
+ /**
220
+ * Records a full member path.
221
+ * @param text - The path, normalized before it is recorded.
222
+ */
223
+ function addFull(text) {
224
+ const cleaned = ExhaustiveDepsUtils.normalizeChain(text);
225
+ paths.add(cleaned);
226
+ }
227
+ /**
228
+ * Records a computed reference path as a root or a full path.
229
+ * @param refPath - The reference path, or `null` to record nothing.
230
+ */
231
+ function addRefPath(refPath) {
232
+ if (!refPath) return;
233
+ if (refPath.coversRootMembers) {
234
+ addRoot(refPath.root);
235
+ return;
236
+ }
237
+ addFull(refPath.path);
238
+ }
239
+ /**
240
+ * Visits every child node of a node.
241
+ * @param node - The node whose children are visited.
242
+ */
243
+ function visitChildren(node) {
244
+ const keys = visitorKeys[node.type] ?? [];
245
+ for (const key of keys) {
246
+ const value = node[key];
247
+ if (Array.isArray(value)) {
248
+ for (const item of value) if (ExhaustiveDepsUtils.isNode(item)) visit(item);
249
+ continue;
250
+ }
251
+ if (ExhaustiveDepsUtils.isNode(value)) visit(value);
252
+ }
253
+ }
254
+ /**
255
+ * Records the dependencies of a node: identifiers directly, and the external references of
256
+ * functions. Other nodes are visited recursively.
257
+ * @param node - The node to visit.
258
+ */
259
+ function visit(node) {
260
+ if (!node) return;
261
+ switch (node.type) {
262
+ case import_dist.AST_NODE_TYPES.Identifier:
263
+ addRefPath(ExhaustiveDepsUtils.computeRefPath({
264
+ identifier: node,
265
+ sourceCode
266
+ }));
267
+ return;
268
+ case import_dist.AST_NODE_TYPES.ArrowFunctionExpression:
269
+ case import_dist.AST_NODE_TYPES.FunctionExpression:
270
+ for (const reference of ExhaustiveDepsUtils.collectExternalRefsInFunction({
271
+ functionNode: node,
272
+ scopeManager
273
+ })) {
274
+ if (reference.identifier.type !== import_dist.AST_NODE_TYPES.Identifier) continue;
275
+ addRefPath(ExhaustiveDepsUtils.computeRefPath({
276
+ identifier: reference.identifier,
277
+ sourceCode
278
+ }));
279
+ }
280
+ return;
281
+ case import_dist.AST_NODE_TYPES.Property:
282
+ visit(node.value);
283
+ return;
284
+ case import_dist.AST_NODE_TYPES.MemberExpression:
285
+ if (node.parent.type === import_dist.AST_NODE_TYPES.CallExpression && node.parent.callee === node && node.object.type === import_dist.AST_NODE_TYPES.Identifier) addRoot(node.object.name);
286
+ else visit(node.object);
287
+ return;
288
+ case import_dist.AST_NODE_TYPES.CallExpression:
289
+ node.arguments.forEach((argument) => visit(argument));
290
+ switch (node.callee.type) {
291
+ case import_dist.AST_NODE_TYPES.Identifier:
292
+ case import_dist.AST_NODE_TYPES.MemberExpression:
293
+ case import_dist.AST_NODE_TYPES.ChainExpression:
294
+ case import_dist.AST_NODE_TYPES.TSNonNullExpression: visit(node.callee);
295
+ }
296
+ return;
297
+ }
298
+ visitChildren(node);
299
+ }
300
+ visit(queryKeyNode);
301
+ return {
302
+ roots,
303
+ paths
304
+ };
305
+ },
306
+ isNode(value) {
307
+ return typeof value === "object" && value !== null && "type" in value && typeof value.type === "string";
308
+ },
309
+ /**
310
+ * Checks whether the resolved variable is allowlisted by its type annotation.
311
+ * @param params - The allowlisted type names, and the variable to check.
312
+ * @returns `true` if a type referenced in the variable's type annotation is allowlisted.
313
+ */
314
+ variableIsAllowlistedByType(params) {
315
+ const { allowlistedTypes, variable } = params;
316
+ if (allowlistedTypes.size === 0) return false;
317
+ if (!variable) return false;
318
+ for (const id of variable.identifiers) if (id.typeAnnotation) {
319
+ const typeIdentifiers = /* @__PURE__ */ new Set();
320
+ ExhaustiveDepsUtils.collectTypeIdentifiers(id.typeAnnotation.typeAnnotation, typeIdentifiers);
321
+ for (const typeIdentifier of typeIdentifiers) if (allowlistedTypes.has(typeIdentifier)) return true;
322
+ }
323
+ return false;
324
+ },
325
+ isInstanceOfKind(node) {
326
+ return node.type === import_dist.AST_NODE_TYPES.BinaryExpression && node.operator === "instanceof";
327
+ },
328
+ /**
329
+ * Normalizes a chain by removing optional chaining operators
330
+ *
331
+ * Example: `a?.b.c!` -> `a.b.c`
332
+ * @param text - The source text of the chain.
333
+ * @returns The chain without optional chaining, non-null assertions, and whitespace.
334
+ */
335
+ normalizeChain(text) {
336
+ return text.replace(/(?:\?(\.)|!)/g, "$1").replace(/\s+/g, "");
337
+ },
338
+ /**
339
+ * Computes the reference path for an identifier
340
+ *
341
+ * Example: `a.b.c!` -> `{ path: 'a.b.c', root: 'a' }`
342
+ * @param params - The identifier, and the source code to read the chain from.
343
+ * @returns The dependency `path`, its `root`, and whether the path is the root itself and covers
344
+ * all of its members. For a method call, the method name is dropped from the path.
345
+ */
346
+ computeRefPath(params) {
347
+ const { identifier, sourceCode } = params;
348
+ const fullChainNode = ASTUtils.traverseUpMemberExpression(identifier);
349
+ const fullText = ExhaustiveDepsUtils.normalizeChain(sourceCode.getText(fullChainNode));
350
+ const parent = fullChainNode.parent;
351
+ let dependencyPath = fullText;
352
+ let coversRootMembers = fullText === identifier.name;
353
+ if (parent && parent.type === import_dist.AST_NODE_TYPES.CallExpression && parent.callee === fullChainNode) {
354
+ const segments = fullText.split(".");
355
+ if (segments.length > 1) dependencyPath = segments.slice(0, -1).join(".");
356
+ coversRootMembers = false;
357
+ }
358
+ dependencyPath = dependencyPath.split(".")[0] === "" ? identifier.name : dependencyPath;
359
+ const root = dependencyPath.split(".")[0];
360
+ return {
361
+ path: dependencyPath,
362
+ root: root ?? identifier.name,
363
+ coversRootMembers: coversRootMembers && dependencyPath === root
364
+ };
365
+ },
366
+ collectExternalRefsInFunction(params) {
367
+ const { functionNode, scopeManager } = params;
368
+ const functionScope = scopeManager.acquire(functionNode);
369
+ if (functionScope === null) return [];
370
+ const externalRefs = [];
371
+ /**
372
+ * Collects the read references of a scope and its child scopes that resolve to variables
373
+ * declared outside the function.
374
+ * @param scope - The scope to collect from.
375
+ */
376
+ function collect(scope) {
377
+ for (const reference of scope.references) {
378
+ if (!reference.isRead() || reference.resolved === null) continue;
379
+ let currentScope = reference.resolved.scope;
380
+ let declaredInsideFunction = false;
381
+ while (currentScope !== null) {
382
+ if (currentScope === functionScope) {
383
+ declaredInsideFunction = true;
384
+ break;
385
+ }
386
+ currentScope = currentScope.upper;
387
+ }
388
+ if (!declaredInsideFunction) externalRefs.push(reference);
389
+ }
390
+ for (const childScope of scope.childScopes) collect(childScope);
391
+ }
392
+ collect(functionScope);
393
+ return externalRefs;
394
+ },
395
+ /**
396
+ * Recursively collects type identifiers from a type annotation.
397
+ * @param typeNode - The type to collect from: type references, unions, intersections, arrays, and
398
+ * tuples are handled.
399
+ * @param out - The set the type names are added to.
400
+ */
401
+ collectTypeIdentifiers(typeNode, out) {
402
+ switch (typeNode.type) {
403
+ case import_dist.AST_NODE_TYPES.TSTypeReference:
404
+ if (typeNode.typeName.type === import_dist.AST_NODE_TYPES.Identifier) out.add(typeNode.typeName.name);
405
+ break;
406
+ case import_dist.AST_NODE_TYPES.TSUnionType:
407
+ case import_dist.AST_NODE_TYPES.TSIntersectionType:
408
+ typeNode.types.forEach((t) => ExhaustiveDepsUtils.collectTypeIdentifiers(t, out));
409
+ break;
410
+ case import_dist.AST_NODE_TYPES.TSArrayType:
411
+ ExhaustiveDepsUtils.collectTypeIdentifiers(typeNode.elementType, out);
412
+ break;
413
+ case import_dist.AST_NODE_TYPES.TSTupleType: typeNode.elementTypes.forEach((et) => ExhaustiveDepsUtils.collectTypeIdentifiers(et, out));
414
+ }
415
+ },
416
+ /**
417
+ * Gets the function expression nodes from a queryFn property, handling conditional expressions.
418
+ * When neither branch is skipToken, returns both branches so all deps are scanned.
419
+ * @param queryFn - The `queryFn` property.
420
+ * @returns The nodes to scan for dependencies.
421
+ */
422
+ getQueryFnNodes(queryFn) {
423
+ if (queryFn.value.type !== import_dist.AST_NODE_TYPES.ConditionalExpression) return [queryFn.value];
424
+ if (queryFn.value.consequent.type === import_dist.AST_NODE_TYPES.Identifier && queryFn.value.consequent.name === "skipToken") return [queryFn.value.alternate];
425
+ if (queryFn.value.alternate.type === import_dist.AST_NODE_TYPES.Identifier && queryFn.value.alternate.name === "skipToken") return [queryFn.value.consequent];
426
+ return [queryFn.value.consequent, queryFn.value.alternate];
427
+ }
428
+ };
429
+ const QUERY_KEY = "queryKey";
430
+ const QUERY_FN = "queryFn";
431
+ const name$7 = "exhaustive-deps";
432
+ const rule$7 = import_eslint_utils.RuleCreator(getDocsUrl)({
433
+ name: name$7,
434
+ meta: {
435
+ type: "problem",
436
+ docs: {
437
+ description: "Exhaustive deps rule for useQuery",
438
+ recommended: "error"
439
+ },
440
+ messages: {
441
+ missingDeps: `The following dependencies are missing in your queryKey: {{deps}}`,
442
+ fixTo: "Fix to {{result}}"
443
+ },
444
+ hasSuggestions: true,
445
+ schema: [{
446
+ type: "object",
447
+ properties: { allowlist: {
448
+ type: "object",
449
+ properties: {
450
+ variables: {
451
+ type: "array",
452
+ items: { type: "string" }
453
+ },
454
+ types: {
455
+ type: "array",
456
+ items: { type: "string" }
457
+ }
458
+ },
459
+ additionalProperties: false
460
+ } },
461
+ additionalProperties: false
462
+ }]
463
+ },
464
+ defaultOptions: [],
465
+ create: detectTanstackQueryImports((context) => {
466
+ return { ObjectExpression: (node) => {
467
+ const scopeManager = context.sourceCode.scopeManager;
468
+ const queryKey = ASTUtils.findPropertyWithIdentifierKey(node.properties, QUERY_KEY);
469
+ const queryFn = ASTUtils.findPropertyWithIdentifierKey(node.properties, QUERY_FN);
470
+ if (scopeManager === null || queryKey === void 0 || queryFn === void 0 || !ASTUtils.isNodeOfOneOf(queryFn.value, [
471
+ import_dist.AST_NODE_TYPES.ArrowFunctionExpression,
472
+ import_dist.AST_NODE_TYPES.FunctionExpression,
473
+ import_dist.AST_NODE_TYPES.ConditionalExpression
474
+ ])) return;
475
+ const queryKeyNode = dereferenceVariablesAndTypeAssertions(queryKey.value, context);
476
+ const queryFnNodes = ExhaustiveDepsUtils.getQueryFnNodes(queryFn);
477
+ const relevantRefs = queryFnNodes.flatMap((fnNode) => ASTUtils.getExternalRefs({
478
+ scopeManager,
479
+ sourceCode: context.sourceCode,
480
+ node: fnNode
481
+ })).filter((reference) => queryFnNodes.some((fnNode) => ExhaustiveDepsUtils.isRelevantReference({
482
+ sourceCode: context.sourceCode,
483
+ reference,
484
+ scopeManager,
485
+ node: fnNode,
486
+ filename: context.filename
487
+ })));
488
+ const ruleOptions = context.options.at(0);
489
+ const allowlistedVariables = new Set(ruleOptions?.allowlist?.variables ?? []);
490
+ const allowlistedTypes = new Set(ruleOptions?.allowlist?.types ?? []);
491
+ const requiredRefs = relevantRefs.flatMap((ref) => {
492
+ if (ref.identifier.type !== import_dist.AST_NODE_TYPES.Identifier) return [];
493
+ const refPath = ExhaustiveDepsUtils.computeRefPath({
494
+ identifier: ref.identifier,
495
+ sourceCode: context.sourceCode
496
+ });
497
+ if (refPath === null) return [];
498
+ return [{
499
+ ...refPath,
500
+ allowlistedByType: ExhaustiveDepsUtils.variableIsAllowlistedByType({
501
+ allowlistedTypes,
502
+ variable: ref.resolved ?? null
503
+ })
504
+ }];
505
+ });
506
+ if (requiredRefs.length === 0) return;
507
+ const queryKeyDeps = ExhaustiveDepsUtils.collectQueryKeyDeps({
508
+ sourceCode: context.sourceCode,
509
+ scopeManager,
510
+ queryKeyNode
511
+ });
512
+ const missingPaths = ExhaustiveDepsUtils.computeFilteredMissingPaths({
513
+ requiredRefs,
514
+ allowlistedVariables,
515
+ existingRootIdentifiers: queryKeyDeps.roots,
516
+ existingFullPaths: queryKeyDeps.paths
517
+ });
518
+ if (missingPaths.length === 0) return;
519
+ const missingAsText = missingPaths.join(", ");
520
+ const suggestions = buildSuggestions({
521
+ queryKeyNode,
522
+ missingPaths,
523
+ missingAsText,
524
+ sourceCode: context.sourceCode
525
+ });
526
+ context.report({
527
+ node,
528
+ messageId: "missingDeps",
529
+ data: { deps: missingAsText },
530
+ suggest: suggestions
531
+ });
532
+ } };
533
+ })
534
+ });
535
+ /**
536
+ * Builds the suggestion that adds the missing dependencies to an array query key.
537
+ * @param params - The query key node, the missing paths and their text, and the source code.
538
+ * @returns The suggestion, or none if the query key is not an array literal.
539
+ */
540
+ function buildSuggestions(params) {
541
+ const { queryKeyNode, missingPaths, missingAsText, sourceCode } = params;
542
+ if (queryKeyNode.type !== import_dist.AST_NODE_TYPES.ArrayExpression) return [];
543
+ const closingBracket = sourceCode.getLastToken(queryKeyNode);
544
+ if (!closingBracket) return [];
545
+ const resultText = `[${[...queryKeyNode.elements.filter((el) => el !== null).map((el) => sourceCode.getText(el)), ...missingPaths].join(", ")}]`;
546
+ if (queryKeyNode.elements.length === 0) return [{
547
+ messageId: "fixTo",
548
+ data: { result: resultText },
549
+ fix: (fixer) => fixer.replaceText(queryKeyNode, resultText)
550
+ }];
551
+ const separator = sourceCode.getTokenBefore(closingBracket)?.value === "," ? " " : ", ";
552
+ return [{
553
+ messageId: "fixTo",
554
+ data: { result: resultText },
555
+ fix: (fixer) => fixer.insertTextBefore(closingBracket, `${separator}${missingAsText}`)
556
+ }];
557
+ }
558
+ /**
559
+ * Follows variable references and `as` assertions from a query key node to the expression it comes
560
+ * from.
561
+ * @param queryKeyNode - The query key node to start from.
562
+ * @param context - The rule context, used to resolve variables.
563
+ * @returns The innermost node that is neither a resolvable variable nor an `as` assertion.
564
+ */
565
+ function dereferenceVariablesAndTypeAssertions(queryKeyNode, context) {
566
+ const visitedNodes = /* @__PURE__ */ new Set();
567
+ for (let i = 0; i < 256; ++i) {
568
+ if (visitedNodes.has(queryKeyNode)) return queryKeyNode;
569
+ visitedNodes.add(queryKeyNode);
570
+ switch (queryKeyNode.type) {
571
+ case import_dist.AST_NODE_TYPES.TSAsExpression:
572
+ queryKeyNode = queryKeyNode.expression;
573
+ break;
574
+ case import_dist.AST_NODE_TYPES.Identifier: {
575
+ const expression = ASTUtils.getReferencedExpressionByIdentifier({
576
+ context,
577
+ node: queryKeyNode
578
+ });
579
+ if (expression == null) return queryKeyNode;
580
+ queryKeyNode = expression;
581
+ break;
582
+ }
583
+ default: return queryKeyNode;
584
+ }
585
+ }
586
+ return queryKeyNode;
587
+ }
588
+ const name$6 = "stable-query-client";
589
+ const rule$6 = import_eslint_utils.RuleCreator(getDocsUrl)({
590
+ name: name$6,
591
+ meta: {
592
+ type: "problem",
593
+ docs: {
594
+ description: "Makes sure that QueryClient is stable",
595
+ recommended: "error"
596
+ },
597
+ messages: {
598
+ unstable: ["QueryClient is not stable. It should be either extracted from the component or wrapped in React.useState.", "See https://tkdodo.eu/blog/react-query-fa-qs#2-the-queryclient-is-not-stable"].join("\n"),
599
+ fixTo: "Fix to {{result}}"
600
+ },
601
+ hasSuggestions: true,
602
+ fixable: "code",
603
+ schema: []
604
+ },
605
+ defaultOptions: [],
606
+ create: detectTanstackQueryImports((context, _, helpers) => {
607
+ return { NewExpression: (node) => {
608
+ if (node.callee.type !== import_dist.AST_NODE_TYPES.Identifier || node.callee.name !== "QueryClient" || !helpers.isSpecificTanstackQueryImport(node.callee, "@tanstack/react-query")) return;
609
+ const fnAncestor = context.sourceCode.getAncestors(node).reverse().find((ancestor) => ASTUtils.isNodeOfOneOf(ancestor, [
610
+ import_dist.AST_NODE_TYPES.FunctionDeclaration,
611
+ import_dist.AST_NODE_TYPES.FunctionExpression,
612
+ import_dist.AST_NODE_TYPES.ArrowFunctionExpression
613
+ ]));
614
+ const fnName = fnAncestor?.parent.type === import_dist.AST_NODE_TYPES.VariableDeclarator && fnAncestor.parent.id.type === import_dist.AST_NODE_TYPES.Identifier ? fnAncestor.parent.id : fnAncestor?.id;
615
+ const isReactServerComponent = fnAncestor?.async === true;
616
+ if (!ASTUtils.isValidReactComponentOrHookName(fnName) || isReactServerComponent) return;
617
+ context.report({
618
+ node: node.parent.type === import_dist.AST_NODE_TYPES.VariableDeclarator ? node.parent : node,
619
+ messageId: "unstable",
620
+ fix: (() => {
621
+ const { parent } = node;
622
+ if (parent.type !== import_dist.AST_NODE_TYPES.VariableDeclarator || parent.id.type !== import_dist.AST_NODE_TYPES.Identifier) return;
623
+ const nodeText = (context.sourceCode ?? context.getSourceCode()).getText(node);
624
+ const variableName = parent.id.name;
625
+ return (fixer) => {
626
+ return fixer.replaceTextRange([parent.range[0], parent.range[1]], `[${variableName}] = React.useState(() => ${nodeText})`);
627
+ };
628
+ })()
629
+ });
630
+ } };
631
+ })
632
+ });
633
+ const QUERY_RESULT_TYPE_NAMES = /* @__PURE__ */ new Set([
634
+ "UseBaseQueryResult",
635
+ "UseQueryResult",
636
+ "UseSuspenseQueryResult",
637
+ "DefinedUseQueryResult",
638
+ "UseInfiniteQueryResult",
639
+ "UseSuspenseInfiniteQueryResult",
640
+ "DefinedUseInfiniteQueryResult",
641
+ "QueryObserverResult",
642
+ "InfiniteQueryObserverResult"
643
+ ]);
644
+ /**
645
+ * Checks whether a type is one of the query result types, or a union that contains one.
646
+ * @param type - The type to check.
647
+ * @returns `true` if the type's alias or symbol name is a known query result type.
648
+ */
649
+ function isQueryResultType(type) {
650
+ if (type.aliasSymbol && QUERY_RESULT_TYPE_NAMES.has(type.aliasSymbol.name)) return true;
651
+ const symbol = type.getSymbol();
652
+ if (symbol && QUERY_RESULT_TYPE_NAMES.has(symbol.name)) return true;
653
+ return type.isUnion() && type.types.some(isQueryResultType);
654
+ }
655
+ const NoRestDestructuringUtils = {
656
+ isObjectRestDestructuring(node) {
657
+ if (node.type !== import_dist.AST_NODE_TYPES.ObjectPattern) return false;
658
+ return node.properties.some((p) => p.type === import_dist.AST_NODE_TYPES.RestElement);
659
+ },
660
+ isQueryResultCall(node, parserServices) {
661
+ if (!parserServices?.program || !parserServices.esTreeNodeToTSNodeMap) return false;
662
+ const checker = parserServices.program.getTypeChecker();
663
+ const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node.callee);
664
+ return checker.getTypeAtLocation(tsNode).getCallSignatures().some((sig) => isQueryResultType(sig.getReturnType()));
665
+ }
666
+ };
667
+ const name$5 = "no-rest-destructuring";
668
+ const queryHooks$1 = [
669
+ "useQuery",
670
+ "useQueries",
671
+ "useInfiniteQuery",
672
+ "useSuspenseQuery",
673
+ "useSuspenseQueries",
674
+ "useSuspenseInfiniteQuery"
675
+ ];
676
+ const rule$5 = import_eslint_utils.RuleCreator(getDocsUrl)({
677
+ name: name$5,
678
+ meta: {
679
+ type: "problem",
680
+ docs: {
681
+ description: "Disallows rest destructuring in queries",
682
+ recommended: "warn"
683
+ },
684
+ messages: { objectRestDestructure: `Object rest destructuring on a query will observe all changes to the query, leading to excessive re-renders.` },
685
+ schema: []
686
+ },
687
+ defaultOptions: [],
688
+ create: detectTanstackQueryImports((context, _, helpers) => {
689
+ const queryResultVariables = /* @__PURE__ */ new Set();
690
+ return {
691
+ CallExpression: (node) => {
692
+ if (node.parent.type !== import_dist.AST_NODE_TYPES.VariableDeclarator) return;
693
+ const returnValue = node.parent.id;
694
+ if (!(ASTUtils.isIdentifierWithOneOfNames(node.callee, queryHooks$1) && helpers.isTanstackQueryImport(node.callee))) {
695
+ if (!(returnValue.type === import_dist.AST_NODE_TYPES.Identifier || NoRestDestructuringUtils.isObjectRestDestructuring(returnValue)) || !NoRestDestructuringUtils.isQueryResultCall(node, context.sourceCode.parserServices)) return;
696
+ }
697
+ const calleeName = ASTUtils.isIdentifier(node.callee) ? node.callee.name : null;
698
+ if (calleeName !== "useQueries" && calleeName !== "useSuspenseQueries") {
699
+ if (NoRestDestructuringUtils.isObjectRestDestructuring(returnValue)) return context.report({
700
+ node: node.parent,
701
+ messageId: "objectRestDestructure"
702
+ });
703
+ if (returnValue.type === import_dist.AST_NODE_TYPES.Identifier) queryResultVariables.add(returnValue.name);
704
+ return;
705
+ }
706
+ if (returnValue.type !== import_dist.AST_NODE_TYPES.ArrayPattern) {
707
+ if (returnValue.type === import_dist.AST_NODE_TYPES.Identifier) queryResultVariables.add(returnValue.name);
708
+ return;
709
+ }
710
+ returnValue.elements.forEach((queryResult) => {
711
+ if (queryResult === null) return;
712
+ if (NoRestDestructuringUtils.isObjectRestDestructuring(queryResult)) context.report({
713
+ node: queryResult,
714
+ messageId: "objectRestDestructure"
715
+ });
716
+ });
717
+ },
718
+ VariableDeclarator: (node) => {
719
+ if (node.init?.type === import_dist.AST_NODE_TYPES.Identifier && queryResultVariables.has(node.init.name) && NoRestDestructuringUtils.isObjectRestDestructuring(node.id)) context.report({
720
+ node,
721
+ messageId: "objectRestDestructure"
722
+ });
723
+ },
724
+ SpreadElement: (node) => {
725
+ if (node.argument.type === import_dist.AST_NODE_TYPES.Identifier && queryResultVariables.has(node.argument.name)) context.report({
726
+ node,
727
+ messageId: "objectRestDestructure"
728
+ });
729
+ }
730
+ };
731
+ })
732
+ });
733
+ const name$4 = "no-unstable-deps";
734
+ const reactHookNames = [
735
+ "useEffect",
736
+ "useCallback",
737
+ "useMemo"
738
+ ];
739
+ const allHookNames = ["useMutation", ...[
740
+ "useQuery",
741
+ "useSuspenseQuery",
742
+ "useQueries",
743
+ "useSuspenseQueries",
744
+ "useInfiniteQuery",
745
+ "useSuspenseInfiniteQuery"
746
+ ]];
747
+ const rule$4 = import_eslint_utils.RuleCreator(getDocsUrl)({
748
+ name: name$4,
749
+ meta: {
750
+ type: "problem",
751
+ docs: {
752
+ description: "Disallow putting the result of query hooks directly in a React hook dependency array",
753
+ recommended: "error"
754
+ },
755
+ messages: { 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}}.` },
756
+ schema: []
757
+ },
758
+ defaultOptions: [],
759
+ create: detectTanstackQueryImports((context, _options, helpers) => {
760
+ const trackedVariables = Object.create(null);
761
+ const trackedCustomHooks = Object.create(null);
762
+ const hookAliasMap = Object.create(null);
763
+ const pendingVariableDeclarators = [];
764
+ const pendingDependencyChecks = [];
765
+ /**
766
+ * Returns the name of the React hook a call expression calls, if it is one: a known hook, an
767
+ * alias of one, or `React.<hook>`.
768
+ * @param node - The call expression.
769
+ * @returns The hook name, or `undefined` if the call is not a React hook.
770
+ */
771
+ function getReactHook(node) {
772
+ if (node.callee.type === "Identifier") {
773
+ const calleeName = node.callee.name;
774
+ if (reactHookNames.includes(calleeName) || calleeName in hookAliasMap) return calleeName;
775
+ } else if (node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === "React" && node.callee.property.type === "Identifier" && reactHookNames.includes(node.callee.property.name)) return node.callee.property.name;
776
+ }
777
+ /**
778
+ * Tracks the variables bound to a query hook's result, so they can be reported when used as
779
+ * dependencies.
780
+ * @param pattern - The binding: an identifier, or an array pattern whose elements and rest
781
+ * element are tracked.
782
+ * @param queryHook - The name of the query hook the result comes from.
783
+ */
784
+ function collectVariableNames(pattern, queryHook) {
785
+ if (pattern.type === import_dist.AST_NODE_TYPES.Identifier) trackedVariables[pattern.name] = queryHook;
786
+ else if (pattern.type === import_dist.AST_NODE_TYPES.ArrayPattern) for (const element of pattern.elements) {
787
+ if (element === null) continue;
788
+ if (element.type === import_dist.AST_NODE_TYPES.Identifier) trackedVariables[element.name] = queryHook;
789
+ else if (element.type === import_dist.AST_NODE_TYPES.RestElement && element.argument.type === import_dist.AST_NODE_TYPES.Identifier) trackedVariables[element.argument.name] = queryHook;
790
+ }
791
+ }
792
+ /**
793
+ * Checks whether a name follows the custom hook naming convention.
794
+ * @param hookName - The name to check.
795
+ * @returns `true` if the name starts with `use` followed by an uppercase letter or a digit.
796
+ */
797
+ function isCustomHookName(hookName) {
798
+ return /^use[A-Z0-9]/.test(hookName);
799
+ }
800
+ /**
801
+ * Checks whether a call passes an object literal with a `combine` property as its first argument.
802
+ * @param callExpression - The call expression to check.
803
+ * @returns `true` if the first argument has a `combine` property.
804
+ */
805
+ function hasCombineProperty(callExpression) {
806
+ if (callExpression.arguments.length === 0) return false;
807
+ const firstArg = callExpression.arguments[0];
808
+ if (!firstArg || firstArg.type !== import_dist.AST_NODE_TYPES.ObjectExpression) return false;
809
+ return firstArg.properties.some((prop) => prop.type === import_dist.AST_NODE_TYPES.Property && prop.key.type === import_dist.AST_NODE_TYPES.Identifier && prop.key.name === "combine");
810
+ }
811
+ /**
812
+ * Returns the name of the TanStack Query hook a call expression calls directly. `useQueries` and
813
+ * `useSuspenseQueries` with `combine` are ignored, since their result can be stable.
814
+ * @param callExpression - The call to check.
815
+ * @returns The hook name, or `undefined` if the call is not a tracked query hook.
816
+ */
817
+ function getDirectQueryHook(callExpression) {
818
+ if (callExpression.callee.type !== import_dist.AST_NODE_TYPES.Identifier || !allHookNames.includes(callExpression.callee.name) || !helpers.isTanstackQueryImport(callExpression.callee)) return;
819
+ if ((callExpression.callee.name === "useQueries" || callExpression.callee.name === "useSuspenseQueries") && hasCombineProperty(callExpression)) return;
820
+ return callExpression.callee.name;
821
+ }
822
+ /**
823
+ * Returns the query hook behind a call expression: a direct query hook call, or a custom hook that
824
+ * returns one.
825
+ * @param callExpression - The call to check.
826
+ * @returns The query hook name, or `undefined` if there is none.
827
+ */
828
+ function getTrackedQueryHook(callExpression) {
829
+ const directQueryHook = getDirectQueryHook(callExpression);
830
+ if (directQueryHook !== void 0) return directQueryHook;
831
+ if (callExpression.callee.type === import_dist.AST_NODE_TYPES.Identifier) return trackedCustomHooks[callExpression.callee.name];
832
+ }
833
+ /**
834
+ * Returns the query hook that a custom hook's body returns: either an expression body that calls
835
+ * one, or a block with a single `return` of such a call.
836
+ * @param body - The body of the custom hook.
837
+ * @returns The query hook name, or `undefined` if the body doesn't return one.
838
+ */
839
+ function getReturnedQueryHook(body) {
840
+ if (body.type === import_dist.AST_NODE_TYPES.CallExpression) return getDirectQueryHook(body);
841
+ if (body.type !== import_dist.AST_NODE_TYPES.BlockStatement) return;
842
+ const returnStatements = body.body.filter((statement) => statement.type === import_dist.AST_NODE_TYPES.ReturnStatement);
843
+ if (returnStatements.length !== 1) return;
844
+ const returnArgument = returnStatements[0]?.argument;
845
+ if (returnArgument?.type === import_dist.AST_NODE_TYPES.CallExpression) return getDirectQueryHook(returnArgument);
846
+ }
847
+ /**
848
+ * Reports the tracked query results used in a React hook's dependency array.
849
+ * @param reactHook - The name of the React hook.
850
+ * @param depsArray - The dependency array to check.
851
+ */
852
+ function checkDependencyArray(reactHook, depsArray) {
853
+ depsArray.elements.forEach((dep) => {
854
+ if (dep !== null && dep.type === import_dist.AST_NODE_TYPES.Identifier && trackedVariables[dep.name] !== void 0) {
855
+ const queryHook = trackedVariables[dep.name];
856
+ context.report({
857
+ node: dep,
858
+ messageId: "noUnstableDeps",
859
+ data: {
860
+ queryHook,
861
+ reactHook
862
+ }
863
+ });
864
+ }
865
+ });
866
+ }
867
+ return {
868
+ ImportDeclaration(node) {
869
+ if (node.specifiers.length > 0 && node.importKind === "value" && node.source.value === "react") node.specifiers.forEach((specifier) => {
870
+ if (specifier.type === import_dist.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === import_dist.AST_NODE_TYPES.Identifier && reactHookNames.includes(specifier.imported.name)) hookAliasMap[specifier.local.name] = specifier.imported.name;
871
+ });
872
+ },
873
+ FunctionDeclaration(node) {
874
+ if (node.id === null || !isCustomHookName(node.id.name)) return;
875
+ const queryHook = getReturnedQueryHook(node.body);
876
+ if (queryHook !== void 0) trackedCustomHooks[node.id.name] = queryHook;
877
+ },
878
+ VariableDeclarator(node) {
879
+ if (node.id.type === import_dist.AST_NODE_TYPES.Identifier && isCustomHookName(node.id.name) && node.init !== null && (node.init.type === import_dist.AST_NODE_TYPES.ArrowFunctionExpression || node.init.type === import_dist.AST_NODE_TYPES.FunctionExpression)) {
880
+ const queryHook = getReturnedQueryHook(node.init.body);
881
+ if (queryHook !== void 0) trackedCustomHooks[node.id.name] = queryHook;
882
+ }
883
+ if (node.init !== null && node.init.type === import_dist.AST_NODE_TYPES.CallExpression) pendingVariableDeclarators.push(node);
884
+ },
885
+ CallExpression: (node) => {
886
+ const reactHook = getReactHook(node);
887
+ if (reactHook !== void 0 && node.arguments.length > 1 && node.arguments[1]?.type === import_dist.AST_NODE_TYPES.ArrayExpression) pendingDependencyChecks.push({
888
+ reactHook,
889
+ depsArray: node.arguments[1]
890
+ });
891
+ },
892
+ "Program:exit"() {
893
+ pendingVariableDeclarators.forEach((node) => {
894
+ if (node.init?.type !== import_dist.AST_NODE_TYPES.CallExpression) return;
895
+ const queryHook = getTrackedQueryHook(node.init);
896
+ if (queryHook !== void 0) collectVariableNames(node.id, queryHook);
897
+ });
898
+ pendingDependencyChecks.forEach(({ reactHook, depsArray }) => {
899
+ checkDependencyArray(reactHook, depsArray);
900
+ });
901
+ }
902
+ };
903
+ })
904
+ });
905
+ /**
906
+ * Sorts the items covered by the order rules into the required order, keeping the other items in
907
+ * place.
908
+ * @param data - The items to sort.
909
+ * @param orderRules - Pairs of groups: items whose `key` is in the first group must come before
910
+ * those in the second.
911
+ * @param key - The property of each item to compare against the groups.
912
+ * @returns The sorted items, or `null` if they were already in order.
913
+ */
914
+ function sortDataByOrder(data, orderRules, key) {
915
+ const getSubsetIndex = (item, subsets) => {
916
+ for (let i = 0; i < subsets.length; i++) if (subsets[i]?.includes(item)) return i;
917
+ return null;
918
+ };
919
+ const orderSets = orderRules.reduce((sets, [A, B]) => [
920
+ ...sets,
921
+ A,
922
+ B
923
+ ], []);
924
+ const inOrderArray = data.filter((item) => getSubsetIndex(item[key], orderSets) !== null);
925
+ let wasResorted = false;
926
+ const inOrderIterator = inOrderArray.sort((a, b) => {
927
+ const aKey = a[key], bKey = b[key];
928
+ const aSubsetIndex = getSubsetIndex(aKey, orderSets);
929
+ const bSubsetIndex = getSubsetIndex(bKey, orderSets);
930
+ if (aSubsetIndex !== null && bSubsetIndex !== null && aSubsetIndex !== bSubsetIndex) return aSubsetIndex - bSubsetIndex;
931
+ return 0;
932
+ }).values();
933
+ const result = data.map((item) => {
934
+ if (getSubsetIndex(item[key], orderSets) !== null) {
935
+ const sortedItem = inOrderIterator.next().value;
936
+ if (sortedItem[key] !== item[key]) wasResorted = true;
937
+ return sortedItem;
938
+ }
939
+ return item;
940
+ });
941
+ if (!wasResorted) return null;
942
+ return result;
943
+ }
944
+ const createRule$2 = import_eslint_utils.RuleCreator(getDocsUrl);
945
+ /**
946
+ * Creates a rule that reports when the properties of the options object passed to the target
947
+ * functions are not in the required order.
948
+ * @param options - The rule's metadata, such as `name`, `meta`, and `defaultOptions`.
949
+ * @param targetFunctions - The names of the functions whose first argument is checked.
950
+ * @param orderRules - Pairs of property groups: the properties of the first group must come before
951
+ * those of the second.
952
+ * @returns An ESLint rule that reports out-of-order properties and fixes them.
953
+ */
954
+ function createPropertyOrderRule(options, targetFunctions, orderRules) {
955
+ const targetFunctionSet = new Set(targetFunctions);
956
+ /**
957
+ * Checks whether a function name is one of the target functions.
958
+ * @param node - The function name.
959
+ * @returns `true` if the name is a target function.
960
+ */
961
+ function isTargetFunction(node) {
962
+ return targetFunctionSet.has(node);
963
+ }
964
+ return createRule$2({
965
+ ...options,
966
+ create: detectTanstackQueryImports((context) => {
967
+ return { CallExpression(node) {
968
+ if (node.callee.type !== import_dist.AST_NODE_TYPES.Identifier) return;
969
+ const functions = node.callee.name;
970
+ if (!isTargetFunction(functions)) return;
971
+ const argument = node.arguments[0];
972
+ if (argument === void 0 || argument.type !== "ObjectExpression") return;
973
+ const allProperties = argument.properties;
974
+ if (allProperties.length < 2) return;
975
+ const sortedProperties = sortDataByOrder(allProperties.flatMap((p, index) => {
976
+ if (p.type === import_dist.AST_NODE_TYPES.Property && p.key.type === import_dist.AST_NODE_TYPES.Identifier) return {
977
+ name: p.key.name,
978
+ property: p
979
+ };
980
+ else return {
981
+ name: `_property_${index}`,
982
+ property: p
983
+ };
984
+ }), orderRules, "name");
985
+ if (sortedProperties === null) return;
986
+ context.report({
987
+ node: argument,
988
+ data: { function: node.callee.name },
989
+ messageId: "invalidOrder",
990
+ fix(fixer) {
991
+ const sourceCode = context.sourceCode;
992
+ const reorderedText = sortedProperties.reduce((sourceText, specifier, index) => {
993
+ let textBetweenProperties = "";
994
+ if (index < allProperties.length - 1) textBetweenProperties = sourceCode.getText().slice(allProperties[index].range[1], allProperties[index + 1].range[0]);
995
+ return sourceText + sourceCode.getText(specifier.property) + textBetweenProperties;
996
+ }, "");
997
+ return fixer.replaceTextRange([allProperties[0].range[0], allProperties.at(-1).range[1]], reorderedText);
998
+ }
999
+ });
1000
+ } };
1001
+ })
1002
+ });
1003
+ }
1004
+ const infiniteQueryFunctions = [
1005
+ "infiniteQueryOptions",
1006
+ "useInfiniteQuery",
1007
+ "useSuspenseInfiniteQuery"
1008
+ ];
1009
+ const sortRules$1 = [[["queryFn"], ["getPreviousPageParam", "getNextPageParam"]]];
1010
+ const name$3 = "infinite-query-property-order";
1011
+ const rule$3 = createPropertyOrderRule({
1012
+ name: name$3,
1013
+ meta: {
1014
+ type: "problem",
1015
+ docs: {
1016
+ description: "Ensure correct order of inference sensitive properties for infinite queries",
1017
+ recommended: "error"
1018
+ },
1019
+ messages: { invalidOrder: "Invalid order of properties for `{{function}}`." },
1020
+ schema: [],
1021
+ hasSuggestions: true,
1022
+ fixable: "code"
1023
+ },
1024
+ defaultOptions: []
1025
+ }, infiniteQueryFunctions, sortRules$1);
1026
+ const name$2 = "no-void-query-fn";
1027
+ const rule$2 = import_eslint_utils.RuleCreator(getDocsUrl)({
1028
+ name: name$2,
1029
+ meta: {
1030
+ type: "problem",
1031
+ docs: {
1032
+ description: "Ensures queryFn returns a non-undefined value",
1033
+ recommended: "error"
1034
+ },
1035
+ messages: { noVoidReturn: "queryFn must return a non-undefined value" },
1036
+ schema: []
1037
+ },
1038
+ defaultOptions: [],
1039
+ create: detectTanstackQueryImports((context) => {
1040
+ return { Property(node) {
1041
+ if (!ASTUtils.isObjectExpression(node.parent) || !ASTUtils.isIdentifierWithName(node.key, "queryFn")) return;
1042
+ const parserServices = context.sourceCode.parserServices;
1043
+ if (!parserServices || !parserServices.esTreeNodeToTSNodeMap || !parserServices.program) return;
1044
+ const checker = parserServices.program.getTypeChecker();
1045
+ const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node.value);
1046
+ const type = checker.getTypeAtLocation(tsNode);
1047
+ if (type.getCallSignatures().length > 0) {
1048
+ const returnType = type.getCallSignatures()[0]?.getReturnType();
1049
+ if (!returnType) return;
1050
+ if (isIllegalReturn(checker, returnType)) context.report({
1051
+ node: node.value,
1052
+ messageId: "noVoidReturn"
1053
+ });
1054
+ }
1055
+ } };
1056
+ })
1057
+ });
1058
+ /**
1059
+ * Checks whether a query function's return type resolves to `void` or `undefined`, including in any
1060
+ * member of a union.
1061
+ * @param checker - The TypeScript type checker.
1062
+ * @param type - The return type of the query function.
1063
+ * @returns `true` if the awaited type, or a member of it, is `void` or `undefined`.
1064
+ */
1065
+ function isIllegalReturn(checker, type) {
1066
+ const awaited = checker.getAwaitedType(type);
1067
+ if (!awaited) return false;
1068
+ if (awaited.isUnion()) return awaited.types.some((t) => isIllegalReturn(checker, t));
1069
+ const typeString = checker.typeToString(awaited);
1070
+ return typeString === "void" || typeString === "undefined";
1071
+ }
1072
+ const mutationFunctions = ["useMutation"];
1073
+ const sortRules = [[["onMutate"], ["onError", "onSettled"]]];
1074
+ const name$1 = "mutation-property-order";
1075
+ const rule$1 = createPropertyOrderRule({
1076
+ name: name$1,
1077
+ meta: {
1078
+ type: "problem",
1079
+ docs: {
1080
+ description: "Ensure correct order of inference-sensitive properties in useMutation()",
1081
+ recommended: "error"
1082
+ },
1083
+ messages: { invalidOrder: "Invalid order of properties for `{{function}}`." },
1084
+ schema: [],
1085
+ hasSuggestions: true,
1086
+ fixable: "code"
1087
+ },
1088
+ defaultOptions: []
1089
+ }, mutationFunctions, sortRules);
1090
+ const name = "prefer-query-options";
1091
+ const queryHooks = [
1092
+ "useQuery",
1093
+ "useInfiniteQuery",
1094
+ "useSuspenseQuery",
1095
+ "useSuspenseInfiniteQuery",
1096
+ "usePrefetchQuery",
1097
+ "usePrefetchInfiniteQuery"
1098
+ ];
1099
+ const queriesHooks = ["useQueries", "useSuspenseQueries"];
1100
+ const filterHooks = ["useIsFetching"];
1101
+ const queryClientOptionMethods = [
1102
+ "fetchQuery",
1103
+ "prefetchQuery",
1104
+ "fetchInfiniteQuery",
1105
+ "prefetchInfiniteQuery",
1106
+ "ensureQueryData",
1107
+ "ensureInfiniteQueryData"
1108
+ ];
1109
+ const queryClientQueryKeyMethods = [
1110
+ "getQueryData",
1111
+ "setQueryData",
1112
+ "getQueryState",
1113
+ "setQueryDefaults",
1114
+ "getQueryDefaults"
1115
+ ];
1116
+ const queryClientFilterMethods = [
1117
+ "invalidateQueries",
1118
+ "cancelQueries",
1119
+ "refetchQueries",
1120
+ "removeQueries",
1121
+ "resetQueries",
1122
+ "isFetching",
1123
+ "getQueriesData",
1124
+ "setQueriesData"
1125
+ ];
1126
+ const queryOptionsBuilders = ["queryOptions", "infiniteQueryOptions"];
1127
+ const rule = import_eslint_utils.RuleCreator(getDocsUrl)({
1128
+ name,
1129
+ meta: {
1130
+ type: "problem",
1131
+ docs: {
1132
+ description: "Prefer using queryOptions() to co-locate queryKey and queryFn",
1133
+ recommended: "strict"
1134
+ },
1135
+ messages: {
1136
+ preferQueryOptions: "Prefer using queryOptions() or infiniteQueryOptions() to co-locate queryKey and queryFn.",
1137
+ preferQueryOptionsQueryKey: "Prefer referencing a queryKey from a queryOptions() result instead of typing it manually."
1138
+ },
1139
+ schema: []
1140
+ },
1141
+ defaultOptions: [],
1142
+ create: detectTanstackQueryImports((context, _, helpers) => {
1143
+ /**
1144
+ * Reports an object literal passed as query options that defines `queryKey` or `queryFn` inline.
1145
+ * @param node - The argument passed as query options.
1146
+ */
1147
+ function reportInlineQueryOptions(node) {
1148
+ if (ASTUtils.isObjectExpression(node) && hasInlineQueryOptions(node)) context.report({
1149
+ node,
1150
+ messageId: "preferQueryOptions"
1151
+ });
1152
+ }
1153
+ /**
1154
+ * Reports an object literal passed as query filters whose `queryKey` is an inline array.
1155
+ * @param node - The filters node.
1156
+ */
1157
+ function reportInlineFilterQueryKey(node) {
1158
+ if (ASTUtils.isObjectExpression(node) && hasInlineFilterQueryKey(node)) context.report({
1159
+ node,
1160
+ messageId: "preferQueryOptionsQueryKey"
1161
+ });
1162
+ }
1163
+ return { CallExpression: (node) => {
1164
+ if (ASTUtils.isIdentifier(node.callee)) {
1165
+ const importedName = getTanstackImportName(context, helpers, node.callee);
1166
+ if (importedName === null) return;
1167
+ if (queryOptionsBuilders.includes(importedName)) return;
1168
+ const options = node.arguments[0];
1169
+ if (options === void 0) return;
1170
+ if (queryHooks.includes(importedName)) {
1171
+ reportInlineQueryOptions(options);
1172
+ return;
1173
+ }
1174
+ if (queriesHooks.includes(importedName) && ASTUtils.isObjectExpression(options)) {
1175
+ const queries = ASTUtils.findPropertyWithIdentifierKey(options.properties, "queries")?.value;
1176
+ if (queries !== void 0) getQueryObjects(queries).forEach((query) => {
1177
+ reportInlineQueryOptions(query);
1178
+ });
1179
+ return;
1180
+ }
1181
+ if (filterHooks.includes(importedName)) reportInlineFilterQueryKey(options);
1182
+ return;
1183
+ }
1184
+ if (node.callee.type !== import_dist.AST_NODE_TYPES.MemberExpression || !ASTUtils.isIdentifier(node.callee.property) || !isTanstackQueryClient(node.callee.object, context, helpers)) return;
1185
+ const method = node.callee.property.name;
1186
+ const options = node.arguments[0];
1187
+ if (options === void 0) return;
1188
+ if (queryClientOptionMethods.includes(method)) {
1189
+ reportInlineQueryOptions(options);
1190
+ return;
1191
+ }
1192
+ if (queryClientQueryKeyMethods.includes(method) && isInlineArrayExpression(options)) {
1193
+ context.report({
1194
+ node: options,
1195
+ messageId: "preferQueryOptionsQueryKey"
1196
+ });
1197
+ return;
1198
+ }
1199
+ if (queryClientFilterMethods.includes(method)) reportInlineFilterQueryKey(options);
1200
+ } };
1201
+ })
1202
+ });
1203
+ /**
1204
+ * Checks whether an object literal defines `queryKey` or `queryFn` inline.
1205
+ * @param node - The object literal.
1206
+ * @returns `true` if it has a `queryKey` or `queryFn` property.
1207
+ */
1208
+ function hasInlineQueryOptions(node) {
1209
+ return ASTUtils.findPropertyWithIdentifierKey(node.properties, "queryKey") !== void 0 || ASTUtils.findPropertyWithIdentifierKey(node.properties, "queryFn") !== void 0;
1210
+ }
1211
+ /**
1212
+ * Checks whether an object literal has a `queryKey` written as an inline array.
1213
+ * @param node - The object literal.
1214
+ * @returns `true` if its `queryKey` is an array literal, ignoring type assertions.
1215
+ */
1216
+ function hasInlineFilterQueryKey(node) {
1217
+ const queryKey = ASTUtils.findPropertyWithIdentifierKey(node.properties, "queryKey")?.value;
1218
+ return queryKey !== void 0 && isInlineArrayExpression(queryKey);
1219
+ }
1220
+ /**
1221
+ * Checks whether a node is an array literal, ignoring type assertions.
1222
+ * @param node - The node to check.
1223
+ * @returns `true` if the node is an array literal.
1224
+ */
1225
+ function isInlineArrayExpression(node) {
1226
+ return unwrapTypeAssertions(node).type === import_dist.AST_NODE_TYPES.ArrayExpression;
1227
+ }
1228
+ /**
1229
+ * Collects the object literals a node can evaluate to, following function bodies, `return`
1230
+ * statements, and conditional, logical, and sequence expressions.
1231
+ * @param node - The node to collect from.
1232
+ * @returns The object literals the node can evaluate to.
1233
+ */
1234
+ function getReturnedObjectExpressions(node) {
1235
+ if (ASTUtils.isObjectExpression(node)) return [node];
1236
+ if (node.type === import_dist.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_dist.AST_NODE_TYPES.FunctionExpression) return getReturnedObjectExpressions(node.body);
1237
+ if (node.type === import_dist.AST_NODE_TYPES.BlockStatement) return node.body.flatMap((statement) => {
1238
+ if (statement.type === import_dist.AST_NODE_TYPES.ReturnStatement && statement.argument !== null) return getReturnedObjectExpressions(statement.argument);
1239
+ return [];
1240
+ });
1241
+ if (node.type === import_dist.AST_NODE_TYPES.ConditionalExpression) return [...getReturnedObjectExpressions(node.consequent), ...getReturnedObjectExpressions(node.alternate)];
1242
+ if (node.type === import_dist.AST_NODE_TYPES.LogicalExpression) return [...getReturnedObjectExpressions(node.left), ...getReturnedObjectExpressions(node.right)];
1243
+ if (node.type === import_dist.AST_NODE_TYPES.SequenceExpression) return node.expressions.flatMap((expression) => getReturnedObjectExpressions(expression));
1244
+ return [];
1245
+ }
1246
+ /**
1247
+ * Collects the query option objects of a `queries` array: the object literals in an array literal,
1248
+ * or those returned by the callback of a `.map()` call.
1249
+ * @param node - The `queries` value.
1250
+ * @returns The query option object literals.
1251
+ */
1252
+ function getQueryObjects(node) {
1253
+ if (node.type === import_dist.AST_NODE_TYPES.ArrayExpression) return node.elements.flatMap((element) => {
1254
+ if (element !== null && ASTUtils.isObjectExpression(element)) return [element];
1255
+ return [];
1256
+ });
1257
+ if (node.type === import_dist.AST_NODE_TYPES.CallExpression && node.callee.type === import_dist.AST_NODE_TYPES.MemberExpression && ASTUtils.isIdentifierWithName(node.callee.property, "map")) {
1258
+ const mapper = node.arguments[0];
1259
+ if (mapper?.type === import_dist.AST_NODE_TYPES.ArrowFunctionExpression || mapper?.type === import_dist.AST_NODE_TYPES.FunctionExpression) return getReturnedObjectExpressions(mapper);
1260
+ }
1261
+ return [];
1262
+ }
1263
+ /**
1264
+ * Checks whether a node refers to a TanStack Query client, created with `useQueryClient()` or
1265
+ * `new QueryClient()`.
1266
+ * @param node - The node to check.
1267
+ * @param context - The rule context, used to resolve variables.
1268
+ * @param helpers - The helpers that check TanStack Query imports.
1269
+ * @returns `true` if the node comes from `useQueryClient()` or `new QueryClient()`.
1270
+ */
1271
+ function isTanstackQueryClient(node, context, helpers) {
1272
+ const source = resolveQueryClientSource(node, context);
1273
+ if (source.type === import_dist.AST_NODE_TYPES.CallExpression && ASTUtils.isIdentifier(source.callee)) return getTanstackImportName(context, helpers, source.callee) === "useQueryClient";
1274
+ if (source.type === import_dist.AST_NODE_TYPES.NewExpression && ASTUtils.isIdentifier(source.callee)) return getTanstackImportName(context, helpers, source.callee) === "QueryClient";
1275
+ return false;
1276
+ }
1277
+ /**
1278
+ * Returns the name an identifier was imported under from TanStack Query.
1279
+ * @param context - The rule context.
1280
+ * @param helpers - The helpers that check TanStack Query imports.
1281
+ * @param node - The identifier.
1282
+ * @returns The imported name, or `null` if the identifier isn't a named TanStack Query import.
1283
+ */
1284
+ function getTanstackImportName(context, helpers, node) {
1285
+ if (!helpers.isTanstackQueryImport(node)) return null;
1286
+ const definition = context.sourceCode.getScope(node).references.find((reference) => reference.identifier === node)?.resolved?.defs[0]?.node;
1287
+ if (definition?.type !== import_dist.AST_NODE_TYPES.ImportSpecifier || definition.imported.type !== import_dist.AST_NODE_TYPES.Identifier) return null;
1288
+ return definition.imported.name;
1289
+ }
1290
+ /**
1291
+ * Follows variable references, optional chains, and type assertions from a node to the expression it
1292
+ * comes from.
1293
+ * @param node - The node to start from.
1294
+ * @param context - The rule context, used to resolve variables.
1295
+ * @returns The innermost node that can't be resolved further.
1296
+ */
1297
+ function resolveQueryClientSource(node, context) {
1298
+ const visitedNodes = /* @__PURE__ */ new Set();
1299
+ while (!visitedNodes.has(node)) {
1300
+ visitedNodes.add(node);
1301
+ if (node.type === import_dist.AST_NODE_TYPES.ChainExpression) {
1302
+ node = node.expression;
1303
+ continue;
1304
+ }
1305
+ node = unwrapTypeAssertions(node);
1306
+ if (node.type !== import_dist.AST_NODE_TYPES.Identifier) return node;
1307
+ const expression = ASTUtils.getReferencedExpressionByIdentifier({
1308
+ context,
1309
+ node
1310
+ });
1311
+ if (expression === null) return node;
1312
+ node = expression;
1313
+ }
1314
+ return node;
1315
+ }
1316
+ /**
1317
+ * Removes `as`, `satisfies`, and angle-bracket type assertions around a node.
1318
+ * @param node - The node to unwrap.
1319
+ * @returns The node inside the type assertions.
1320
+ */
1321
+ function unwrapTypeAssertions(node) {
1322
+ while (node.type === import_dist.AST_NODE_TYPES.TSAsExpression || node.type === import_dist.AST_NODE_TYPES.TSSatisfiesExpression || node.type === import_dist.AST_NODE_TYPES.TSTypeAssertion) node = node.expression;
1323
+ return node;
1324
+ }
1325
+ const rules = {
1326
+ [name$7]: rule$7,
1327
+ [name$6]: rule$6,
1328
+ [name$5]: rule$5,
1329
+ [name$4]: rule$4,
1330
+ [name$3]: rule$3,
1331
+ [name$2]: rule$2,
1332
+ [name$1]: rule$1,
1333
+ [name]: rule
1334
+ };
1335
+ // ../../node_modules/.pnpm/@tanstack+eslint-plugin-query@5.105.3_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__su_d952cca362d1d08c5aa1aaa1487f168b/node_modules/@tanstack/eslint-plugin-query/build/modern/index.js
1336
+ const recommendedRules = {
1337
+ "@tanstack/query/exhaustive-deps": "error",
1338
+ "@tanstack/query/no-rest-destructuring": "warn",
1339
+ "@tanstack/query/stable-query-client": "error",
1340
+ "@tanstack/query/no-unstable-deps": "error",
1341
+ "@tanstack/query/infinite-query-property-order": "error",
1342
+ "@tanstack/query/no-void-query-fn": "error",
1343
+ "@tanstack/query/mutation-property-order": "error"
1344
+ };
1345
+ const recommendedStrictRules = {
1346
+ ...recommendedRules,
1347
+ "@tanstack/query/prefer-query-options": "error"
1348
+ };
1349
+ const plugin$1 = {
1350
+ meta: { name: "@tanstack/eslint-plugin-query" },
1351
+ configs: {
1352
+ recommended: {
1353
+ plugins: ["@tanstack/query"],
1354
+ rules: recommendedRules
1355
+ },
1356
+ recommendedStrict: {
1357
+ plugins: ["@tanstack/query"],
1358
+ rules: recommendedStrictRules
1359
+ },
1360
+ "flat/recommended": [{
1361
+ name: "tanstack/query/flat/recommended",
1362
+ plugins: { "@tanstack/query": {} },
1363
+ rules: recommendedRules
1364
+ }],
1365
+ "flat/recommended-strict": [{
1366
+ name: "tanstack/query/flat/recommended-strict",
1367
+ plugins: { "@tanstack/query": {} },
1368
+ rules: recommendedStrictRules
1369
+ }]
1370
+ },
1371
+ rules
1372
+ };
1373
+ plugin$1.configs["flat/recommended"][0].plugins["@tanstack/query"] = plugin$1;
1374
+ plugin$1.configs["flat/recommended-strict"][0].plugins["@tanstack/query"] = plugin$1;
1375
+ // src/tanstack-query.ts
1376
+ const plugin = upstreamPlugin("tanstack-query", plugin$1, optionallyTypedRules);
1377
+ export { plugin as default };
1378
+
1379
+ //# sourceMappingURL=tanstack-query.mjs.map