@tanstack/eslint-plugin-query 5.65.0 → 5.66.0

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.
@@ -16,15 +16,10 @@ const ExhaustiveDepsUtils = {
16
16
  })) {
17
17
  return false;
18
18
  }
19
- return reference.identifier.name !== "undefined" && reference.identifier.parent.type !== utils.AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent) && !ExhaustiveDepsUtils.isQueryClientReference(reference);
19
+ return reference.identifier.name !== "undefined" && reference.identifier.parent.type !== utils.AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent);
20
20
  },
21
21
  isInstanceOfKind(node) {
22
22
  return node.type === utils.AST_NODE_TYPES.BinaryExpression && node.operator === "instanceof";
23
- },
24
- isQueryClientReference(reference) {
25
- var _a, _b, _c;
26
- const declarator = (_b = (_a = reference.resolved) == null ? void 0 : _a.defs[0]) == null ? void 0 : _b.node;
27
- return (declarator == null ? void 0 : declarator.type) === utils.AST_NODE_TYPES.VariableDeclarator && ((_c = declarator.init) == null ? void 0 : _c.type) === utils.AST_NODE_TYPES.CallExpression && declarator.init.callee.type === utils.AST_NODE_TYPES.Identifier && declarator.init.callee.name === "useQueryClient";
28
23
  }
29
24
  };
30
25
  exports.ExhaustiveDepsUtils = ExhaustiveDepsUtils;
@@ -1 +1 @@
1
- {"version":3,"file":"exhaustive-deps.utils.cjs","sources":["../../../../src/rules/exhaustive-deps/exhaustive-deps.utils.ts"],"sourcesContent":["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 }) {\n const { sourceCode, reference, scopeManager, node } = params\n const component = ASTUtils.getFunctionAncestor(sourceCode, node)\n\n if (component === undefined) {\n return false\n }\n\n if (\n !ASTUtils.isDeclaredInNode({\n scopeManager,\n reference,\n functionNode: component,\n })\n ) {\n return false\n }\n\n return (\n reference.identifier.name !== 'undefined' &&\n reference.identifier.parent.type !== AST_NODE_TYPES.NewExpression &&\n !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent) &&\n !ExhaustiveDepsUtils.isQueryClientReference(reference)\n )\n },\n isInstanceOfKind(node: TSESTree.Node) {\n return (\n node.type === AST_NODE_TYPES.BinaryExpression &&\n node.operator === 'instanceof'\n )\n },\n isQueryClientReference(reference: TSESLint.Scope.Reference) {\n const declarator = reference.resolved?.defs[0]?.node\n\n return (\n declarator?.type === AST_NODE_TYPES.VariableDeclarator &&\n declarator.init?.type === AST_NODE_TYPES.CallExpression &&\n declarator.init.callee.type === AST_NODE_TYPES.Identifier &&\n declarator.init.callee.name === 'useQueryClient'\n )\n },\n}\n"],"names":["ASTUtils","AST_NODE_TYPES"],"mappings":";;;;AAIO,MAAM,sBAAsB;AAAA,EACjC,oBAAoB,QAKjB;AACD,UAAM,EAAE,YAAY,WAAW,cAAc,KAAS,IAAA;AACtD,UAAM,YAAYA,SAAA,SAAS,oBAAoB,YAAY,IAAI;AAE/D,QAAI,cAAc,QAAW;AACpB,aAAA;AAAA,IAAA;AAIP,QAAA,CAACA,kBAAS,iBAAiB;AAAA,MACzB;AAAA,MACA;AAAA,MACA,cAAc;AAAA,IAAA,CACf,GACD;AACO,aAAA;AAAA,IAAA;AAIP,WAAA,UAAU,WAAW,SAAS,eAC9B,UAAU,WAAW,OAAO,SAASC,MAAe,eAAA,iBACpD,CAAC,oBAAoB,iBAAiB,UAAU,WAAW,MAAM,KACjE,CAAC,oBAAoB,uBAAuB,SAAS;AAAA,EAEzD;AAAA,EACA,iBAAiB,MAAqB;AACpC,WACE,KAAK,SAASA,MAAAA,eAAe,oBAC7B,KAAK,aAAa;AAAA,EAEtB;AAAA,EACA,uBAAuB,WAAqC;;AAC1D,UAAM,cAAa,qBAAU,aAAV,mBAAoB,KAAK,OAAzB,mBAA6B;AAEhD,YACE,yCAAY,UAASA,qBAAe,wBACpC,gBAAW,SAAX,mBAAiB,UAASA,MAAAA,eAAe,kBACzC,WAAW,KAAK,OAAO,SAASA,qBAAe,cAC/C,WAAW,KAAK,OAAO,SAAS;AAAA,EAAA;AAGtC;;"}
1
+ {"version":3,"file":"exhaustive-deps.utils.cjs","sources":["../../../../src/rules/exhaustive-deps/exhaustive-deps.utils.ts"],"sourcesContent":["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 }) {\n const { sourceCode, reference, scopeManager, node } = params\n const component = ASTUtils.getFunctionAncestor(sourceCode, node)\n\n if (component === undefined) {\n return false\n }\n\n if (\n !ASTUtils.isDeclaredInNode({\n scopeManager,\n reference,\n functionNode: component,\n })\n ) {\n return false\n }\n\n return (\n reference.identifier.name !== 'undefined' &&\n reference.identifier.parent.type !== AST_NODE_TYPES.NewExpression &&\n !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent)\n )\n },\n isInstanceOfKind(node: TSESTree.Node) {\n return (\n node.type === AST_NODE_TYPES.BinaryExpression &&\n node.operator === 'instanceof'\n )\n },\n}\n"],"names":["ASTUtils","AST_NODE_TYPES"],"mappings":";;;;AAIO,MAAM,sBAAsB;AAAA,EACjC,oBAAoB,QAKjB;AACD,UAAM,EAAE,YAAY,WAAW,cAAc,KAAS,IAAA;AACtD,UAAM,YAAYA,SAAA,SAAS,oBAAoB,YAAY,IAAI;AAE/D,QAAI,cAAc,QAAW;AACpB,aAAA;AAAA,IAAA;AAIP,QAAA,CAACA,kBAAS,iBAAiB;AAAA,MACzB;AAAA,MACA;AAAA,MACA,cAAc;AAAA,IAAA,CACf,GACD;AACO,aAAA;AAAA,IAAA;AAGT,WACE,UAAU,WAAW,SAAS,eAC9B,UAAU,WAAW,OAAO,SAASC,MAAA,eAAe,iBACpD,CAAC,oBAAoB,iBAAiB,UAAU,WAAW,MAAM;AAAA,EAErE;AAAA,EACA,iBAAiB,MAAqB;AACpC,WACE,KAAK,SAASA,MAAAA,eAAe,oBAC7B,KAAK,aAAa;AAAA,EAAA;AAGxB;;"}
@@ -7,5 +7,4 @@ export declare const ExhaustiveDepsUtils: {
7
7
  node: TSESTree.Node;
8
8
  }): boolean;
9
9
  isInstanceOfKind(node: TSESTree.Node): boolean;
10
- isQueryClientReference(reference: TSESLint.Scope.Reference): boolean;
11
10
  };
@@ -7,5 +7,4 @@ export declare const ExhaustiveDepsUtils: {
7
7
  node: TSESTree.Node;
8
8
  }): boolean;
9
9
  isInstanceOfKind(node: TSESTree.Node): boolean;
10
- isQueryClientReference(reference: TSESLint.Scope.Reference): boolean;
11
10
  };
@@ -14,15 +14,10 @@ const ExhaustiveDepsUtils = {
14
14
  })) {
15
15
  return false;
16
16
  }
17
- return reference.identifier.name !== "undefined" && reference.identifier.parent.type !== AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent) && !ExhaustiveDepsUtils.isQueryClientReference(reference);
17
+ return reference.identifier.name !== "undefined" && reference.identifier.parent.type !== AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent);
18
18
  },
19
19
  isInstanceOfKind(node) {
20
20
  return node.type === AST_NODE_TYPES.BinaryExpression && node.operator === "instanceof";
21
- },
22
- isQueryClientReference(reference) {
23
- var _a, _b, _c;
24
- const declarator = (_b = (_a = reference.resolved) == null ? void 0 : _a.defs[0]) == null ? void 0 : _b.node;
25
- return (declarator == null ? void 0 : declarator.type) === AST_NODE_TYPES.VariableDeclarator && ((_c = declarator.init) == null ? void 0 : _c.type) === AST_NODE_TYPES.CallExpression && declarator.init.callee.type === AST_NODE_TYPES.Identifier && declarator.init.callee.name === "useQueryClient";
26
21
  }
27
22
  };
28
23
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"exhaustive-deps.utils.js","sources":["../../../../src/rules/exhaustive-deps/exhaustive-deps.utils.ts"],"sourcesContent":["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 }) {\n const { sourceCode, reference, scopeManager, node } = params\n const component = ASTUtils.getFunctionAncestor(sourceCode, node)\n\n if (component === undefined) {\n return false\n }\n\n if (\n !ASTUtils.isDeclaredInNode({\n scopeManager,\n reference,\n functionNode: component,\n })\n ) {\n return false\n }\n\n return (\n reference.identifier.name !== 'undefined' &&\n reference.identifier.parent.type !== AST_NODE_TYPES.NewExpression &&\n !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent) &&\n !ExhaustiveDepsUtils.isQueryClientReference(reference)\n )\n },\n isInstanceOfKind(node: TSESTree.Node) {\n return (\n node.type === AST_NODE_TYPES.BinaryExpression &&\n node.operator === 'instanceof'\n )\n },\n isQueryClientReference(reference: TSESLint.Scope.Reference) {\n const declarator = reference.resolved?.defs[0]?.node\n\n return (\n declarator?.type === AST_NODE_TYPES.VariableDeclarator &&\n declarator.init?.type === AST_NODE_TYPES.CallExpression &&\n declarator.init.callee.type === AST_NODE_TYPES.Identifier &&\n declarator.init.callee.name === 'useQueryClient'\n )\n },\n}\n"],"names":[],"mappings":";;AAIO,MAAM,sBAAsB;AAAA,EACjC,oBAAoB,QAKjB;AACD,UAAM,EAAE,YAAY,WAAW,cAAc,KAAS,IAAA;AACtD,UAAM,YAAY,SAAS,oBAAoB,YAAY,IAAI;AAE/D,QAAI,cAAc,QAAW;AACpB,aAAA;AAAA,IAAA;AAIP,QAAA,CAAC,SAAS,iBAAiB;AAAA,MACzB;AAAA,MACA;AAAA,MACA,cAAc;AAAA,IAAA,CACf,GACD;AACO,aAAA;AAAA,IAAA;AAIP,WAAA,UAAU,WAAW,SAAS,eAC9B,UAAU,WAAW,OAAO,SAAS,eAAe,iBACpD,CAAC,oBAAoB,iBAAiB,UAAU,WAAW,MAAM,KACjE,CAAC,oBAAoB,uBAAuB,SAAS;AAAA,EAEzD;AAAA,EACA,iBAAiB,MAAqB;AACpC,WACE,KAAK,SAAS,eAAe,oBAC7B,KAAK,aAAa;AAAA,EAEtB;AAAA,EACA,uBAAuB,WAAqC;;AAC1D,UAAM,cAAa,qBAAU,aAAV,mBAAoB,KAAK,OAAzB,mBAA6B;AAEhD,YACE,yCAAY,UAAS,eAAe,wBACpC,gBAAW,SAAX,mBAAiB,UAAS,eAAe,kBACzC,WAAW,KAAK,OAAO,SAAS,eAAe,cAC/C,WAAW,KAAK,OAAO,SAAS;AAAA,EAAA;AAGtC;"}
1
+ {"version":3,"file":"exhaustive-deps.utils.js","sources":["../../../../src/rules/exhaustive-deps/exhaustive-deps.utils.ts"],"sourcesContent":["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 }) {\n const { sourceCode, reference, scopeManager, node } = params\n const component = ASTUtils.getFunctionAncestor(sourceCode, node)\n\n if (component === undefined) {\n return false\n }\n\n if (\n !ASTUtils.isDeclaredInNode({\n scopeManager,\n reference,\n functionNode: component,\n })\n ) {\n return false\n }\n\n return (\n reference.identifier.name !== 'undefined' &&\n reference.identifier.parent.type !== AST_NODE_TYPES.NewExpression &&\n !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent)\n )\n },\n isInstanceOfKind(node: TSESTree.Node) {\n return (\n node.type === AST_NODE_TYPES.BinaryExpression &&\n node.operator === 'instanceof'\n )\n },\n}\n"],"names":[],"mappings":";;AAIO,MAAM,sBAAsB;AAAA,EACjC,oBAAoB,QAKjB;AACD,UAAM,EAAE,YAAY,WAAW,cAAc,KAAS,IAAA;AACtD,UAAM,YAAY,SAAS,oBAAoB,YAAY,IAAI;AAE/D,QAAI,cAAc,QAAW;AACpB,aAAA;AAAA,IAAA;AAIP,QAAA,CAAC,SAAS,iBAAiB;AAAA,MACzB;AAAA,MACA;AAAA,MACA,cAAc;AAAA,IAAA,CACf,GACD;AACO,aAAA;AAAA,IAAA;AAGT,WACE,UAAU,WAAW,SAAS,eAC9B,UAAU,WAAW,OAAO,SAAS,eAAe,iBACpD,CAAC,oBAAoB,iBAAiB,UAAU,WAAW,MAAM;AAAA,EAErE;AAAA,EACA,iBAAiB,MAAqB;AACpC,WACE,KAAK,SAAS,eAAe,oBAC7B,KAAK,aAAa;AAAA,EAAA;AAGxB;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/eslint-plugin-query",
3
- "version": "5.65.0",
3
+ "version": "5.66.0",
4
4
  "description": "ESLint plugin for TanStack Query",
5
5
  "author": "Eliya Cohen",
6
6
  "license": "MIT",
@@ -29,8 +29,7 @@ export const ExhaustiveDepsUtils = {
29
29
  return (
30
30
  reference.identifier.name !== 'undefined' &&
31
31
  reference.identifier.parent.type !== AST_NODE_TYPES.NewExpression &&
32
- !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent) &&
33
- !ExhaustiveDepsUtils.isQueryClientReference(reference)
32
+ !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent)
34
33
  )
35
34
  },
36
35
  isInstanceOfKind(node: TSESTree.Node) {
@@ -39,14 +38,4 @@ export const ExhaustiveDepsUtils = {
39
38
  node.operator === 'instanceof'
40
39
  )
41
40
  },
42
- isQueryClientReference(reference: TSESLint.Scope.Reference) {
43
- const declarator = reference.resolved?.defs[0]?.node
44
-
45
- return (
46
- declarator?.type === AST_NODE_TYPES.VariableDeclarator &&
47
- declarator.init?.type === AST_NODE_TYPES.CallExpression &&
48
- declarator.init.callee.type === AST_NODE_TYPES.Identifier &&
49
- declarator.init.callee.name === 'useQueryClient'
50
- )
51
- },
52
41
  }