@tanstack/eslint-plugin-query 5.104.5 → 5.105.1
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.
- package/build/legacy/index.cjs +2 -3
- package/build/legacy/index.d.cts +0 -2
- package/build/legacy/index.d.cts.map +1 -1
- package/build/legacy/index.d.ts +0 -2
- package/build/legacy/index.d.ts.map +1 -1
- package/build/legacy/index.js +2 -3
- package/build/legacy/{rules-BAaZwHHh.cjs → rules-BLyIzGVm.cjs} +30 -44
- package/build/legacy/rules-BLyIzGVm.cjs.map +1 -0
- package/build/legacy/{rules-wRKyQ490.js → rules-CPKYJdWR.js} +30 -44
- package/build/legacy/rules-CPKYJdWR.js.map +1 -0
- package/build/legacy/rules.cjs +1 -1
- package/build/legacy/rules.d.cts +0 -2
- package/build/legacy/rules.d.cts.map +1 -1
- package/build/legacy/rules.d.ts +0 -2
- package/build/legacy/rules.d.ts.map +1 -1
- package/build/legacy/rules.js +1 -2
- package/build/legacy/types.d.cts +0 -2
- package/build/legacy/types.d.cts.map +1 -1
- package/build/legacy/types.d.ts +0 -2
- package/build/legacy/types.d.ts.map +1 -1
- package/build/modern/index.cjs +2 -3
- package/build/modern/index.d.cts +0 -2
- package/build/modern/index.d.cts.map +1 -1
- package/build/modern/index.d.ts +0 -2
- package/build/modern/index.d.ts.map +1 -1
- package/build/modern/index.js +2 -3
- package/build/modern/{rules-Dtf8GF21.cjs → rules-37gxMz0U.cjs} +30 -44
- package/build/modern/rules-37gxMz0U.cjs.map +1 -0
- package/build/modern/{rules-DegG1YV1.js → rules-D9GziSYo.js} +30 -44
- package/build/modern/rules-D9GziSYo.js.map +1 -0
- package/build/modern/rules.cjs +1 -1
- package/build/modern/rules.d.cts +0 -2
- package/build/modern/rules.d.cts.map +1 -1
- package/build/modern/rules.d.ts +0 -2
- package/build/modern/rules.d.ts.map +1 -1
- package/build/modern/rules.js +1 -2
- package/build/modern/types.d.cts +0 -2
- package/build/modern/types.d.cts.map +1 -1
- package/build/modern/types.d.ts +0 -2
- package/build/modern/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/rules/stable-query-client/stable-query-client.rule.ts +24 -8
- package/src/utils/detect-react-query-imports.ts +1 -1
- package/build/legacy/rules-BAaZwHHh.cjs.map +0 -1
- package/build/legacy/rules-wRKyQ490.js.map +0 -1
- package/build/modern/rules-DegG1YV1.js.map +0 -1
- package/build/modern/rules-Dtf8GF21.cjs.map +0 -1
package/build/legacy/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_rules = require("./rules-
|
|
6
|
-
|
|
5
|
+
const require_rules = require("./rules-BLyIzGVm.cjs");
|
|
6
|
+
// src/index.ts
|
|
7
7
|
const recommendedRules = {
|
|
8
8
|
"@tanstack/query/exhaustive-deps": "error",
|
|
9
9
|
"@tanstack/query/no-rest-destructuring": "warn",
|
|
@@ -43,7 +43,6 @@ const plugin = {
|
|
|
43
43
|
};
|
|
44
44
|
plugin.configs["flat/recommended"][0].plugins["@tanstack/query"] = plugin;
|
|
45
45
|
plugin.configs["flat/recommended-strict"][0].plugins["@tanstack/query"] = plugin;
|
|
46
|
-
//#endregion
|
|
47
46
|
exports.default = plugin;
|
|
48
47
|
exports.plugin = plugin;
|
|
49
48
|
|
package/build/legacy/index.d.cts
CHANGED
|
@@ -2,7 +2,6 @@ import { ExtraRuleDocs } from "./types.cjs";
|
|
|
2
2
|
import { rules } from "./rules.cjs";
|
|
3
3
|
import { ESLint, Linter } from "eslint";
|
|
4
4
|
import { RuleModule } from "@typescript-eslint/utils/ts-eslint";
|
|
5
|
-
//#region src/index.d.ts
|
|
6
5
|
type RuleKey = keyof typeof rules;
|
|
7
6
|
/**
|
|
8
7
|
* The ESLint plugin object: its `rules`, and its configs — the legacy `recommended` and
|
|
@@ -88,6 +87,5 @@ export declare const plugin: {
|
|
|
88
87
|
};
|
|
89
88
|
rules: Record<string, RuleModule<string, readonly unknown[], ExtraRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>>;
|
|
90
89
|
};
|
|
91
|
-
//#endregion
|
|
92
90
|
export { plugin as default };
|
|
93
91
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":["_$__types0.ExtraRuleDocs"],"sources":["../../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["_$__types0.ExtraRuleDocs"],"sources":["../../src/index.ts"],"mappings":";;;;KAIK,uBAAuB;;;;;iBAMX,eAAe,KAAK,OAAO;;;;EAI1C,OAAO,OAAO,SAAS;;;;;EAKvB;IACE,aAAa,OAAO;IACpB,mBAAmB,OAAO;IAC1B,oBAAoB,MAAM,OAAO;IACjC,2BAA2B,MAAM,OAAO;;;qBAmB/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;E,6DAAAA,4D"}
|
package/build/legacy/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ExtraRuleDocs } from "./types.js";
|
|
|
2
2
|
import { rules } from "./rules.js";
|
|
3
3
|
import { ESLint, Linter } from "eslint";
|
|
4
4
|
import { RuleModule } from "@typescript-eslint/utils/ts-eslint";
|
|
5
|
-
//#region src/index.d.ts
|
|
6
5
|
type RuleKey = keyof typeof rules;
|
|
7
6
|
/**
|
|
8
7
|
* The ESLint plugin object: its `rules`, and its configs — the legacy `recommended` and
|
|
@@ -88,6 +87,5 @@ export declare const plugin: {
|
|
|
88
87
|
};
|
|
89
88
|
rules: Record<string, RuleModule<string, readonly unknown[], ExtraRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>>;
|
|
90
89
|
};
|
|
91
|
-
//#endregion
|
|
92
90
|
export { plugin as default };
|
|
93
91
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["_$__types0.ExtraRuleDocs"],"sources":["../../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["_$__types0.ExtraRuleDocs"],"sources":["../../src/index.ts"],"mappings":";;;;KAIK,uBAAuB;;;;;iBAMX,eAAe,KAAK,OAAO;;;;EAI1C,OAAO,OAAO,SAAS;;;;;EAKvB;IACE,aAAa,OAAO;IACpB,mBAAmB,OAAO;IAC1B,oBAAoB,MAAM,OAAO;IACjC,2BAA2B,MAAM,OAAO;;;qBAmB/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;E,6DAAAA,4D"}
|
package/build/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as rules } from "./rules-
|
|
2
|
-
|
|
1
|
+
import { t as rules } from "./rules-CPKYJdWR.js";
|
|
2
|
+
// src/index.ts
|
|
3
3
|
const recommendedRules = {
|
|
4
4
|
"@tanstack/query/exhaustive-deps": "error",
|
|
5
5
|
"@tanstack/query/no-rest-destructuring": "warn",
|
|
@@ -39,7 +39,6 @@ const plugin = {
|
|
|
39
39
|
};
|
|
40
40
|
plugin.configs["flat/recommended"][0].plugins["@tanstack/query"] = plugin;
|
|
41
41
|
plugin.configs["flat/recommended-strict"][0].plugins["@tanstack/query"] = plugin;
|
|
42
|
-
//#endregion
|
|
43
42
|
export { plugin as default, plugin };
|
|
44
43
|
|
|
45
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
let _typescript_eslint_utils = require("@typescript-eslint/utils");
|
|
2
|
-
|
|
2
|
+
// src/utils/unique-by.ts
|
|
3
3
|
/**
|
|
4
4
|
* Removes duplicate items, keeping the first item for each key.
|
|
5
5
|
* @param arr - The items.
|
|
@@ -9,8 +9,7 @@ let _typescript_eslint_utils = require("@typescript-eslint/utils");
|
|
|
9
9
|
function uniqueBy(arr, fn) {
|
|
10
10
|
return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
//#region src/utils/ast-utils.ts
|
|
12
|
+
// src/utils/ast-utils.ts
|
|
14
13
|
const ASTUtils = {
|
|
15
14
|
isNodeOfOneOf(node, types) {
|
|
16
15
|
return types.includes(node.type);
|
|
@@ -101,16 +100,14 @@ const ASTUtils = {
|
|
|
101
100
|
return resolvedNode.init;
|
|
102
101
|
}
|
|
103
102
|
};
|
|
104
|
-
|
|
105
|
-
//#region src/utils/get-docs-url.ts
|
|
103
|
+
// src/utils/get-docs-url.ts
|
|
106
104
|
/**
|
|
107
105
|
* Builds the URL of a rule's documentation page.
|
|
108
106
|
* @param ruleName - The rule's name, e.g. `exhaustive-deps`.
|
|
109
107
|
* @returns The URL of the rule's page in the ESLint plugin docs.
|
|
110
108
|
*/
|
|
111
109
|
const getDocsUrl = (ruleName) => `https://tanstack.com/query/latest/docs/eslint/${ruleName}`;
|
|
112
|
-
|
|
113
|
-
//#region src/utils/detect-react-query-imports.ts
|
|
110
|
+
// src/utils/detect-react-query-imports.ts
|
|
114
111
|
/**
|
|
115
112
|
* Wraps a rule's `create` function to track the identifiers imported from TanStack Query packages,
|
|
116
113
|
* and passes helpers that check them.
|
|
@@ -152,8 +149,7 @@ function detectTanstackQueryImports(create) {
|
|
|
152
149
|
return enhancedRuleInstructions;
|
|
153
150
|
};
|
|
154
151
|
}
|
|
155
|
-
|
|
156
|
-
//#region src/rules/exhaustive-deps/exhaustive-deps.utils.ts
|
|
152
|
+
// src/rules/exhaustive-deps/exhaustive-deps.utils.ts
|
|
157
153
|
const ExhaustiveDepsUtils = {
|
|
158
154
|
isRelevantReference(params) {
|
|
159
155
|
var _reference$resolved;
|
|
@@ -438,8 +434,7 @@ const ExhaustiveDepsUtils = {
|
|
|
438
434
|
return [queryFn.value.consequent, queryFn.value.alternate];
|
|
439
435
|
}
|
|
440
436
|
};
|
|
441
|
-
|
|
442
|
-
//#region src/rules/exhaustive-deps/exhaustive-deps.rule.ts
|
|
437
|
+
// src/rules/exhaustive-deps/exhaustive-deps.rule.ts
|
|
443
438
|
const QUERY_KEY = "queryKey";
|
|
444
439
|
const QUERY_FN = "queryFn";
|
|
445
440
|
const name$7 = "exhaustive-deps";
|
|
@@ -601,8 +596,7 @@ function dereferenceVariablesAndTypeAssertions(queryKeyNode, context) {
|
|
|
601
596
|
}
|
|
602
597
|
return queryKeyNode;
|
|
603
598
|
}
|
|
604
|
-
|
|
605
|
-
//#region src/rules/stable-query-client/stable-query-client.rule.ts
|
|
599
|
+
// src/rules/stable-query-client/stable-query-client.rule.ts
|
|
606
600
|
const name$6 = "stable-query-client";
|
|
607
601
|
const rule$6 = _typescript_eslint_utils.ESLintUtils.RuleCreator(getDocsUrl)({
|
|
608
602
|
name: name$6,
|
|
@@ -623,16 +617,21 @@ const rule$6 = _typescript_eslint_utils.ESLintUtils.RuleCreator(getDocsUrl)({
|
|
|
623
617
|
defaultOptions: [],
|
|
624
618
|
create: detectTanstackQueryImports((context, _, helpers) => {
|
|
625
619
|
return { NewExpression: (node) => {
|
|
626
|
-
if (node.callee.type !== _typescript_eslint_utils.AST_NODE_TYPES.Identifier || node.callee.name !== "QueryClient" ||
|
|
627
|
-
const fnAncestor = ASTUtils.
|
|
620
|
+
if (node.callee.type !== _typescript_eslint_utils.AST_NODE_TYPES.Identifier || node.callee.name !== "QueryClient" || !helpers.isSpecificTanstackQueryImport(node.callee, "@tanstack/react-query")) return;
|
|
621
|
+
const fnAncestor = context.sourceCode.getAncestors(node).reverse().find((ancestor) => ASTUtils.isNodeOfOneOf(ancestor, [
|
|
622
|
+
_typescript_eslint_utils.AST_NODE_TYPES.FunctionDeclaration,
|
|
623
|
+
_typescript_eslint_utils.AST_NODE_TYPES.FunctionExpression,
|
|
624
|
+
_typescript_eslint_utils.AST_NODE_TYPES.ArrowFunctionExpression
|
|
625
|
+
]));
|
|
626
|
+
const fnName = (fnAncestor === null || fnAncestor === void 0 ? void 0 : fnAncestor.parent.type) === _typescript_eslint_utils.AST_NODE_TYPES.VariableDeclarator && fnAncestor.parent.id.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier ? fnAncestor.parent.id : fnAncestor === null || fnAncestor === void 0 ? void 0 : fnAncestor.id;
|
|
628
627
|
const isReactServerComponent = (fnAncestor === null || fnAncestor === void 0 ? void 0 : fnAncestor.async) === true;
|
|
629
|
-
if (!ASTUtils.isValidReactComponentOrHookName(
|
|
628
|
+
if (!ASTUtils.isValidReactComponentOrHookName(fnName) || isReactServerComponent) return;
|
|
630
629
|
context.report({
|
|
631
|
-
node: node.parent,
|
|
630
|
+
node: node.parent.type === _typescript_eslint_utils.AST_NODE_TYPES.VariableDeclarator ? node.parent : node,
|
|
632
631
|
messageId: "unstable",
|
|
633
632
|
fix: (() => {
|
|
634
633
|
const { parent } = node;
|
|
635
|
-
if (parent.id.type !== _typescript_eslint_utils.AST_NODE_TYPES.Identifier) return;
|
|
634
|
+
if (parent.type !== _typescript_eslint_utils.AST_NODE_TYPES.VariableDeclarator || parent.id.type !== _typescript_eslint_utils.AST_NODE_TYPES.Identifier) return;
|
|
636
635
|
const nodeText = (context.sourceCode ?? context.getSourceCode()).getText(node);
|
|
637
636
|
const variableName = parent.id.name;
|
|
638
637
|
return (fixer) => {
|
|
@@ -643,8 +642,7 @@ const rule$6 = _typescript_eslint_utils.ESLintUtils.RuleCreator(getDocsUrl)({
|
|
|
643
642
|
} };
|
|
644
643
|
})
|
|
645
644
|
});
|
|
646
|
-
|
|
647
|
-
//#region src/rules/no-rest-destructuring/no-rest-destructuring.utils.ts
|
|
645
|
+
// src/rules/no-rest-destructuring/no-rest-destructuring.utils.ts
|
|
648
646
|
const QUERY_RESULT_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
649
647
|
"UseBaseQueryResult",
|
|
650
648
|
"UseQueryResult",
|
|
@@ -679,8 +677,7 @@ const NoRestDestructuringUtils = {
|
|
|
679
677
|
return checker.getTypeAtLocation(tsNode).getCallSignatures().some((sig) => isQueryResultType(sig.getReturnType()));
|
|
680
678
|
}
|
|
681
679
|
};
|
|
682
|
-
|
|
683
|
-
//#region src/rules/no-rest-destructuring/no-rest-destructuring.rule.ts
|
|
680
|
+
// src/rules/no-rest-destructuring/no-rest-destructuring.rule.ts
|
|
684
681
|
const name$5 = "no-rest-destructuring";
|
|
685
682
|
const queryHooks$1 = [
|
|
686
683
|
"useQuery",
|
|
@@ -748,8 +745,7 @@ const rule$5 = _typescript_eslint_utils.ESLintUtils.RuleCreator(getDocsUrl)({
|
|
|
748
745
|
};
|
|
749
746
|
})
|
|
750
747
|
});
|
|
751
|
-
|
|
752
|
-
//#region src/rules/no-unstable-deps/no-unstable-deps.rule.ts
|
|
748
|
+
// src/rules/no-unstable-deps/no-unstable-deps.rule.ts
|
|
753
749
|
const name$4 = "no-unstable-deps";
|
|
754
750
|
const reactHookNames = [
|
|
755
751
|
"useEffect",
|
|
@@ -925,8 +921,7 @@ const rule$4 = _typescript_eslint_utils.ESLintUtils.RuleCreator(getDocsUrl)({
|
|
|
925
921
|
};
|
|
926
922
|
})
|
|
927
923
|
});
|
|
928
|
-
|
|
929
|
-
//#region src/utils/sort-data-by-order.ts
|
|
924
|
+
// src/utils/sort-data-by-order.ts
|
|
930
925
|
/**
|
|
931
926
|
* Sorts the items covered by the order rules into the required order, keeping the other items in
|
|
932
927
|
* place.
|
|
@@ -969,8 +964,7 @@ function sortDataByOrder(data, orderRules, key) {
|
|
|
969
964
|
if (!wasResorted) return null;
|
|
970
965
|
return result;
|
|
971
966
|
}
|
|
972
|
-
|
|
973
|
-
//#region src/utils/create-property-order-rule.ts
|
|
967
|
+
// src/utils/create-property-order-rule.ts
|
|
974
968
|
const createRule$2 = _typescript_eslint_utils.ESLintUtils.RuleCreator(getDocsUrl);
|
|
975
969
|
/**
|
|
976
970
|
* Creates a rule that reports when the properties of the options object passed to the target
|
|
@@ -1031,16 +1025,14 @@ function createPropertyOrderRule(options, targetFunctions, orderRules) {
|
|
|
1031
1025
|
})
|
|
1032
1026
|
});
|
|
1033
1027
|
}
|
|
1034
|
-
|
|
1035
|
-
//#region src/rules/infinite-query-property-order/constants.ts
|
|
1028
|
+
// src/rules/infinite-query-property-order/constants.ts
|
|
1036
1029
|
const infiniteQueryFunctions = [
|
|
1037
1030
|
"infiniteQueryOptions",
|
|
1038
1031
|
"useInfiniteQuery",
|
|
1039
1032
|
"useSuspenseInfiniteQuery"
|
|
1040
1033
|
];
|
|
1041
1034
|
const sortRules$1 = [[["queryFn"], ["getPreviousPageParam", "getNextPageParam"]]];
|
|
1042
|
-
|
|
1043
|
-
//#region src/rules/infinite-query-property-order/infinite-query-property-order.rule.ts
|
|
1035
|
+
// src/rules/infinite-query-property-order/infinite-query-property-order.rule.ts
|
|
1044
1036
|
const name$3 = "infinite-query-property-order";
|
|
1045
1037
|
const rule$3 = createPropertyOrderRule({
|
|
1046
1038
|
name: name$3,
|
|
@@ -1057,8 +1049,7 @@ const rule$3 = createPropertyOrderRule({
|
|
|
1057
1049
|
},
|
|
1058
1050
|
defaultOptions: []
|
|
1059
1051
|
}, infiniteQueryFunctions, sortRules$1);
|
|
1060
|
-
|
|
1061
|
-
//#region src/rules/no-void-query-fn/no-void-query-fn.rule.ts
|
|
1052
|
+
// src/rules/no-void-query-fn/no-void-query-fn.rule.ts
|
|
1062
1053
|
const name$2 = "no-void-query-fn";
|
|
1063
1054
|
const rule$2 = _typescript_eslint_utils.ESLintUtils.RuleCreator(getDocsUrl)({
|
|
1064
1055
|
name: name$2,
|
|
@@ -1106,12 +1097,10 @@ function isIllegalReturn(checker, type) {
|
|
|
1106
1097
|
const typeString = checker.typeToString(awaited);
|
|
1107
1098
|
return typeString === "void" || typeString === "undefined";
|
|
1108
1099
|
}
|
|
1109
|
-
|
|
1110
|
-
//#region src/rules/mutation-property-order/constants.ts
|
|
1100
|
+
// src/rules/mutation-property-order/constants.ts
|
|
1111
1101
|
const mutationFunctions = ["useMutation"];
|
|
1112
1102
|
const sortRules = [[["onMutate"], ["onError", "onSettled"]]];
|
|
1113
|
-
|
|
1114
|
-
//#region src/rules/mutation-property-order/mutation-property-order.rule.ts
|
|
1103
|
+
// src/rules/mutation-property-order/mutation-property-order.rule.ts
|
|
1115
1104
|
const name$1 = "mutation-property-order";
|
|
1116
1105
|
const rule$1 = createPropertyOrderRule({
|
|
1117
1106
|
name: name$1,
|
|
@@ -1128,8 +1117,7 @@ const rule$1 = createPropertyOrderRule({
|
|
|
1128
1117
|
},
|
|
1129
1118
|
defaultOptions: []
|
|
1130
1119
|
}, mutationFunctions, sortRules);
|
|
1131
|
-
|
|
1132
|
-
//#region src/rules/prefer-query-options/prefer-query-options.rule.ts
|
|
1120
|
+
// src/rules/prefer-query-options/prefer-query-options.rule.ts
|
|
1133
1121
|
const name = "prefer-query-options";
|
|
1134
1122
|
const queryHooks = [
|
|
1135
1123
|
"useQuery",
|
|
@@ -1368,8 +1356,7 @@ function unwrapTypeAssertions(node) {
|
|
|
1368
1356
|
while (node.type === _typescript_eslint_utils.AST_NODE_TYPES.TSAsExpression || node.type === _typescript_eslint_utils.AST_NODE_TYPES.TSSatisfiesExpression || node.type === _typescript_eslint_utils.AST_NODE_TYPES.TSTypeAssertion) node = node.expression;
|
|
1369
1357
|
return node;
|
|
1370
1358
|
}
|
|
1371
|
-
|
|
1372
|
-
//#region src/rules.ts
|
|
1359
|
+
// src/rules.ts
|
|
1373
1360
|
const rules = {
|
|
1374
1361
|
[name$7]: rule$7,
|
|
1375
1362
|
[name$6]: rule$6,
|
|
@@ -1380,7 +1367,6 @@ const rules = {
|
|
|
1380
1367
|
[name$1]: rule$1,
|
|
1381
1368
|
[name]: rule
|
|
1382
1369
|
};
|
|
1383
|
-
//#endregion
|
|
1384
1370
|
Object.defineProperty(exports, "rules", {
|
|
1385
1371
|
enumerable: true,
|
|
1386
1372
|
get: function() {
|
|
@@ -1388,4 +1374,4 @@ Object.defineProperty(exports, "rules", {
|
|
|
1388
1374
|
}
|
|
1389
1375
|
});
|
|
1390
1376
|
|
|
1391
|
-
//# sourceMappingURL=rules-
|
|
1377
|
+
//# sourceMappingURL=rules-BLyIzGVm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules-BLyIzGVm.cjs","names":["AST_NODE_TYPES","TSESTree","AST_NODE_TYPES","name","createRule","ESLintUtils","rule","AST_NODE_TYPES","name","createRule","ESLintUtils","rule","AST_NODE_TYPES","AST_NODE_TYPES","name","queryHooks","createRule","ESLintUtils","rule","AST_NODE_TYPES","name","createRule","ESLintUtils","rule","AST_NODE_TYPES","createRule","ESLintUtils","AST_NODE_TYPES","sortRules","name","rule","sortRules","name","createRule","ESLintUtils","rule","name","rule","ESLintUtils","AST_NODE_TYPES","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":["/**\n * Removes duplicate items, keeping the first item for each key.\n * @param arr - The items.\n * @param fn - Returns the key that identifies an item.\n * @returns The items with unique keys, in their original order.\n */\nexport 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 // oxlint-disable-next-line typescript/no-unnecessary-condition\n const sourceCode = context.sourceCode ?? context.getSourceCode()\n // oxlint-disable-next-line typescript/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","/**\n * Builds the URL of a rule's documentation page.\n * @param ruleName - The rule's name, e.g. `exhaustive-deps`.\n * @returns The URL of the rule's page in the ESLint plugin docs.\n */\nexport 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\n/**\n * Wraps a rule's `create` function to track the identifiers imported from TanStack Query packages,\n * and passes helpers that check them.\n * @param create - The rule's `create` function, which also receives the helpers.\n * @returns The wrapped `create` function.\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 // oxlint-disable-next-line typescript/no-unnecessary-condition -- 'importKind' is undefined when the file is not parsed as TypeScript\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 * @param params - The references the query function needs, the allowlisted variables, and the\n * root identifiers and full paths already in the query key.\n * @returns The missing dependency paths, without paths whose root is already missing.\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 * @param params - The source code, the scope manager, and the query key node to scan.\n * @returns The root identifiers that cover all of their members, and every dependency path.\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 /**\n * Records an identifier that covers all of its members.\n * @param name - The identifier, normalized before it is recorded.\n */\n function addRoot(name: string) {\n const cleaned = ExhaustiveDepsUtils.normalizeChain(name)\n roots.add(cleaned)\n paths.add(cleaned)\n }\n /**\n * Records a full member path.\n * @param text - The path, normalized before it is recorded.\n */\n function addFull(text: string) {\n const cleaned = ExhaustiveDepsUtils.normalizeChain(text)\n paths.add(cleaned)\n }\n /**\n * Records a computed reference path as a root or a full path.\n * @param refPath - The reference path, or `null` to record nothing.\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 /**\n * Visits every child node of a node.\n * @param node - The node whose children are visited.\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 /**\n * Records the dependencies of a node: identifiers directly, and the external references of\n * functions. Other nodes are visited recursively.\n * @param node - The node to visit.\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 * @param params - The allowlisted type names, and the variable to check.\n * @returns `true` if a type referenced in the variable's type annotation is allowlisted.\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 * @param text - The source text of the chain.\n * @returns The chain without optional chaining, non-null assertions, and whitespace.\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 * @param params - The identifier, and the source code to read the chain from.\n * @returns The dependency `path`, its `root`, and whether the path is the root itself and covers\n * all of its members. For a method call, the method name is dropped from the path.\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 /**\n * Collects the read references of a scope and its child scopes that resolve to variables\n * declared outside the function.\n * @param scope - The scope to collect from.\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 * @param typeNode - The type to collect from: type references, unions, intersections, arrays, and\n * tuples are handled.\n * @param out - The set the type names are added to.\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 * @param queryFn - The `queryFn` property.\n * @returns The nodes to scan for dependencies.\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 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\n/**\n * Builds the suggestion that adds the missing dependencies to an array query key.\n * @param params - The query key node, the missing paths and their text, and the source code.\n * @returns The suggestion, or none if the query key is not an array literal.\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\n/**\n * Follows variable references and `as` assertions from a query key node to the expression it comes\n * from.\n * @param queryKeyNode - The query key node to start from.\n * @param context - The rule context, used to resolve variables.\n * @returns The innermost node that is neither a resolvable variable nor an `as` assertion.\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 !helpers.isSpecificTanstackQueryImport(\n node.callee,\n '@tanstack/react-query',\n )\n ) {\n return\n }\n\n const fnAncestor = context.sourceCode\n .getAncestors(node)\n .reverse()\n .find((ancestor) =>\n ASTUtils.isNodeOfOneOf(ancestor, [\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n ]),\n )\n const fnName =\n fnAncestor?.parent.type === AST_NODE_TYPES.VariableDeclarator &&\n fnAncestor.parent.id.type === AST_NODE_TYPES.Identifier\n ? fnAncestor.parent.id\n : fnAncestor?.id\n const isReactServerComponent = fnAncestor?.async === true\n\n if (\n !ASTUtils.isValidReactComponentOrHookName(fnName) ||\n isReactServerComponent\n ) {\n return\n }\n\n context.report({\n node:\n node.parent.type === AST_NODE_TYPES.VariableDeclarator\n ? node.parent\n : node,\n messageId: 'unstable',\n fix: (() => {\n const { parent } = node\n\n if (\n parent.type !== AST_NODE_TYPES.VariableDeclarator ||\n parent.id.type !== AST_NODE_TYPES.Identifier\n ) {\n return\n }\n\n // we need the fallbacks for backwards compat with eslint < 8.37.0\n // oxlint-disable-next-line typescript/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\n/**\n * Checks whether a type is one of the query result types, or a union that contains one.\n * @param type - The type to check.\n * @returns `true` if the type's alias or symbol name is a known query result type.\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 /**\n * Returns the name of the React hook a call expression calls, if it is one: a known hook, an\n * alias of one, or `React.<hook>`.\n * @param node - The call expression.\n * @returns The hook name, or `undefined` if the call is not a React hook.\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 /**\n * Tracks the variables bound to a query hook's result, so they can be reported when used as\n * dependencies.\n * @param pattern - The binding: an identifier, or an array pattern whose elements and rest\n * element are tracked.\n * @param queryHook - The name of the query hook the result comes from.\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 /**\n * Checks whether a name follows the custom hook naming convention.\n * @param hookName - The name to check.\n * @returns `true` if the name starts with `use` followed by an uppercase letter or a digit.\n */\n function isCustomHookName(hookName: string): boolean {\n return /^use[A-Z0-9]/.test(hookName)\n }\n\n /**\n * Checks whether a call passes an object literal with a `combine` property as its first argument.\n * @param callExpression - The call expression to check.\n * @returns `true` if the first argument has a `combine` property.\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 /**\n * Returns the name of the TanStack Query hook a call expression calls directly. `useQueries` and\n * `useSuspenseQueries` with `combine` are ignored, since their result can be stable.\n * @param callExpression - The call to check.\n * @returns The hook name, or `undefined` if the call is not a tracked query hook.\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 /**\n * Returns the query hook behind a call expression: a direct query hook call, or a custom hook that\n * returns one.\n * @param callExpression - The call to check.\n * @returns The query hook name, or `undefined` if there is none.\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 /**\n * Returns the query hook that a custom hook's body returns: either an expression body that calls\n * one, or a block with a single `return` of such a call.\n * @param body - The body of the custom hook.\n * @returns The query hook name, or `undefined` if the body doesn't return one.\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 /**\n * Reports the tracked query results used in a React hook's dependency array.\n * @param reactHook - The name of the React hook.\n * @param depsArray - The dependency array to check.\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","/**\n * Sorts the items covered by the order rules into the required order, keeping the other items in\n * place.\n * @param data - The items to sort.\n * @param orderRules - Pairs of groups: items whose `key` is in the first group must come before\n * those in the second.\n * @param key - The property of each item to compare against the groups.\n * @returns The sorted items, or `null` if they were already in order.\n */\nexport 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\n/**\n * Creates a rule that reports when the properties of the options object passed to the target\n * functions are not in the required order.\n * @param options - The rule's metadata, such as `name`, `meta`, and `defaultOptions`.\n * @param targetFunctions - The names of the functions whose first argument is checked.\n * @param orderRules - Pairs of property groups: the properties of the first group must come before\n * those of the second.\n * @returns An ESLint rule that reports out-of-order properties and fixes them.\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 /**\n * Checks whether a function name is one of the target functions.\n * @param node - The function name.\n * @returns `true` if the name is a target function.\n */\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\n/**\n * The names of the functions whose options the `infinite-query-property-order` rule checks.\n */\nexport type InfiniteQueryFunctions = (typeof infiniteQueryFunctions)[number]\n\nexport const checkedProperties = [\n 'queryFn',\n 'getPreviousPageParam',\n 'getNextPageParam',\n] as const\n\n/**\n * The option properties whose order the `infinite-query-property-order` rule checks.\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\n/**\n * Checks whether a query function's return type resolves to `void` or `undefined`, including in any\n * member of a union.\n * @param checker - The TypeScript type checker.\n * @param type - The return type of the query function.\n * @returns `true` if the awaited type, or a member of it, is `void` or `undefined`.\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\n/**\n * The names of the functions whose options the `mutation-property-order` rule checks.\n */\nexport type MutationFunctions = (typeof mutationFunctions)[number]\n\nexport const checkedProperties = ['onMutate', 'onError', 'onSettled'] as const\n\n/**\n * The option properties whose order the `mutation-property-order` rule checks.\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 /**\n * Reports an object literal passed as query options that defines `queryKey` or `queryFn` inline.\n * @param node - The argument passed as query options.\n */\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 /**\n * Reports an object literal passed as query filters whose `queryKey` is an inline array.\n * @param node - The filters node.\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\n/**\n * Checks whether an object literal defines `queryKey` or `queryFn` inline.\n * @param node - The object literal.\n * @returns `true` if it has a `queryKey` or `queryFn` property.\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\n/**\n * Checks whether an object literal has a `queryKey` written as an inline array.\n * @param node - The object literal.\n * @returns `true` if its `queryKey` is an array literal, ignoring type assertions.\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\n/**\n * Checks whether a node is an array literal, ignoring type assertions.\n * @param node - The node to check.\n * @returns `true` if the node is an array literal.\n */\nfunction isInlineArrayExpression(node: TSESTree.Node): boolean {\n return unwrapTypeAssertions(node).type === AST_NODE_TYPES.ArrayExpression\n}\n\n/**\n * Collects the object literals a node can evaluate to, following function bodies, `return`\n * statements, and conditional, logical, and sequence expressions.\n * @param node - The node to collect from.\n * @returns The object literals the node can evaluate to.\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\n/**\n * Collects the query option objects of a `queries` array: the object literals in an array literal,\n * or those returned by the callback of a `.map()` call.\n * @param node - The `queries` value.\n * @returns The query option object literals.\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\n/**\n * Checks whether a node refers to a TanStack Query client, created with `useQueryClient()` or\n * `new QueryClient()`.\n * @param node - The node to check.\n * @param context - The rule context, used to resolve variables.\n * @param helpers - The helpers that check TanStack Query imports.\n * @returns `true` if the node comes from `useQueryClient()` or `new QueryClient()`.\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\n/**\n * Returns the name an identifier was imported under from TanStack Query.\n * @param context - The rule context.\n * @param helpers - The helpers that check TanStack Query imports.\n * @param node - The identifier.\n * @returns The imported name, or `null` if the identifier isn't a named TanStack Query import.\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\n/**\n * Follows variable references, optional chains, and type assertions from a node to the expression it\n * comes from.\n * @param node - The node to start from.\n * @param context - The rule context, used to resolve variables.\n * @returns The innermost node that can't be resolved further.\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\n/**\n * Removes `as`, `satisfies`, and angle-bracket type assertions around a node.\n * @param node - The node to unwrap.\n * @returns The node inside the type assertions.\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.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