@tanstack/eslint-plugin-query 5.65.0 → 5.66.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/dist/cjs/index.cjs +1 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/rules/exhaustive-deps/exhaustive-deps.utils.cjs +1 -6
- package/dist/cjs/rules/exhaustive-deps/exhaustive-deps.utils.cjs.map +1 -1
- package/dist/cjs/rules/exhaustive-deps/exhaustive-deps.utils.d.cts +0 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/rules/exhaustive-deps/exhaustive-deps.utils.d.ts +0 -1
- package/dist/esm/rules/exhaustive-deps/exhaustive-deps.utils.js +1 -6
- package/dist/esm/rules/exhaustive-deps/exhaustive-deps.utils.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/rules/exhaustive-deps/exhaustive-deps.utils.ts +1 -12
package/dist/cjs/index.cjs
CHANGED
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import { rules } from './rules'\nimport type { ESLint, Linter } from 'eslint'\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint'\n\ntype RuleKey = keyof typeof rules\n\nexport interface Plugin extends Omit<ESLint.Plugin, 'rules'> {\n rules: Record<RuleKey, RuleModule<any, any, any>>\n configs: {\n recommended: ESLint.ConfigData\n 'flat/recommended': Array<Linter.
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import { rules } from './rules'\nimport type { ESLint, Linter } from 'eslint'\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint'\n\ntype RuleKey = keyof typeof rules\n\nexport interface Plugin extends Omit<ESLint.Plugin, 'rules'> {\n rules: Record<RuleKey, RuleModule<any, any, any>>\n configs: {\n recommended: ESLint.ConfigData\n 'flat/recommended': Array<Linter.Config>\n }\n}\n\nconst plugin: Plugin = {\n meta: {\n name: '@tanstack/eslint-plugin-query',\n },\n configs: {} as Plugin['configs'],\n rules,\n}\n\n// Assign configs here so we can reference `plugin`\nObject.assign(plugin.configs, {\n recommended: {\n plugins: ['@tanstack/query'],\n rules: {\n '@tanstack/query/exhaustive-deps': 'error',\n '@tanstack/query/no-rest-destructuring': 'warn',\n '@tanstack/query/stable-query-client': 'error',\n '@tanstack/query/no-unstable-deps': 'error',\n '@tanstack/query/infinite-query-property-order': 'error',\n },\n },\n 'flat/recommended': [\n {\n name: 'tanstack/query/flat/recommended',\n plugins: {\n '@tanstack/query': plugin,\n },\n rules: {\n '@tanstack/query/exhaustive-deps': 'error',\n '@tanstack/query/no-rest-destructuring': 'warn',\n '@tanstack/query/stable-query-client': 'error',\n '@tanstack/query/no-unstable-deps': 'error',\n '@tanstack/query/infinite-query-property-order': 'error',\n },\n },\n ],\n})\n\nexport default plugin\n"],"names":["rules"],"mappings":";;AAcA,MAAM,SAAiB;AAAA,EACrB,MAAM;AAAA,IACJ,MAAM;AAAA,EACR;AAAA,EACA,SAAS,CAAC;AAAA,EACVA,OAAAA,MAAAA;AACF;AAGA,OAAO,OAAO,OAAO,SAAS;AAAA,EAC5B,aAAa;AAAA,IACX,SAAS,CAAC,iBAAiB;AAAA,IAC3B,OAAO;AAAA,MACL,mCAAmC;AAAA,MACnC,yCAAyC;AAAA,MACzC,uCAAuC;AAAA,MACvC,oCAAoC;AAAA,MACpC,iDAAiD;AAAA,IAAA;AAAA,EAErD;AAAA,EACA,oBAAoB;AAAA,IAClB;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,QACP,mBAAmB;AAAA,MACrB;AAAA,MACA,OAAO;AAAA,QACL,mCAAmC;AAAA,QACnC,yCAAyC;AAAA,QACzC,uCAAuC;AAAA,QACvC,oCAAoC;AAAA,QACpC,iDAAiD;AAAA,MAAA;AAAA,IACnD;AAAA,EACF;AAEJ,CAAC;;"}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@ export interface Plugin extends Omit<ESLint.Plugin, 'rules'> {
|
|
|
6
6
|
rules: Record<RuleKey, RuleModule<any, any, any>>;
|
|
7
7
|
configs: {
|
|
8
8
|
recommended: ESLint.ConfigData;
|
|
9
|
-
'flat/recommended': Array<Linter.
|
|
9
|
+
'flat/recommended': Array<Linter.Config>;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
declare const plugin: Plugin;
|
|
@@ -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)
|
|
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)
|
|
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;;"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface Plugin extends Omit<ESLint.Plugin, 'rules'> {
|
|
|
6
6
|
rules: Record<RuleKey, RuleModule<any, any, any>>;
|
|
7
7
|
configs: {
|
|
8
8
|
recommended: ESLint.ConfigData;
|
|
9
|
-
'flat/recommended': Array<Linter.
|
|
9
|
+
'flat/recommended': Array<Linter.Config>;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
declare const plugin: Plugin;
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { rules } from './rules'\nimport type { ESLint, Linter } from 'eslint'\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint'\n\ntype RuleKey = keyof typeof rules\n\nexport interface Plugin extends Omit<ESLint.Plugin, 'rules'> {\n rules: Record<RuleKey, RuleModule<any, any, any>>\n configs: {\n recommended: ESLint.ConfigData\n 'flat/recommended': Array<Linter.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { rules } from './rules'\nimport type { ESLint, Linter } from 'eslint'\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint'\n\ntype RuleKey = keyof typeof rules\n\nexport interface Plugin extends Omit<ESLint.Plugin, 'rules'> {\n rules: Record<RuleKey, RuleModule<any, any, any>>\n configs: {\n recommended: ESLint.ConfigData\n 'flat/recommended': Array<Linter.Config>\n }\n}\n\nconst plugin: Plugin = {\n meta: {\n name: '@tanstack/eslint-plugin-query',\n },\n configs: {} as Plugin['configs'],\n rules,\n}\n\n// Assign configs here so we can reference `plugin`\nObject.assign(plugin.configs, {\n recommended: {\n plugins: ['@tanstack/query'],\n rules: {\n '@tanstack/query/exhaustive-deps': 'error',\n '@tanstack/query/no-rest-destructuring': 'warn',\n '@tanstack/query/stable-query-client': 'error',\n '@tanstack/query/no-unstable-deps': 'error',\n '@tanstack/query/infinite-query-property-order': 'error',\n },\n },\n 'flat/recommended': [\n {\n name: 'tanstack/query/flat/recommended',\n plugins: {\n '@tanstack/query': plugin,\n },\n rules: {\n '@tanstack/query/exhaustive-deps': 'error',\n '@tanstack/query/no-rest-destructuring': 'warn',\n '@tanstack/query/stable-query-client': 'error',\n '@tanstack/query/no-unstable-deps': 'error',\n '@tanstack/query/infinite-query-property-order': 'error',\n },\n },\n ],\n})\n\nexport default plugin\n"],"names":[],"mappings":";AAcA,MAAM,SAAiB;AAAA,EACrB,MAAM;AAAA,IACJ,MAAM;AAAA,EACR;AAAA,EACA,SAAS,CAAC;AAAA,EACV;AACF;AAGA,OAAO,OAAO,OAAO,SAAS;AAAA,EAC5B,aAAa;AAAA,IACX,SAAS,CAAC,iBAAiB;AAAA,IAC3B,OAAO;AAAA,MACL,mCAAmC;AAAA,MACnC,yCAAyC;AAAA,MACzC,uCAAuC;AAAA,MACvC,oCAAoC;AAAA,MACpC,iDAAiD;AAAA,IAAA;AAAA,EAErD;AAAA,EACA,oBAAoB;AAAA,IAClB;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,QACP,mBAAmB;AAAA,MACrB;AAAA,MACA,OAAO;AAAA,QACL,mCAAmC;AAAA,QACnC,yCAAyC;AAAA,QACzC,uCAAuC;AAAA,QACvC,oCAAoC;AAAA,QACpC,iDAAiD;AAAA,MAAA;AAAA,IACnD;AAAA,EACF;AAEJ,CAAC;"}
|
|
@@ -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)
|
|
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)
|
|
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
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface Plugin extends Omit<ESLint.Plugin, 'rules'> {
|
|
|
8
8
|
rules: Record<RuleKey, RuleModule<any, any, any>>
|
|
9
9
|
configs: {
|
|
10
10
|
recommended: ESLint.ConfigData
|
|
11
|
-
'flat/recommended': Array<Linter.
|
|
11
|
+
'flat/recommended': Array<Linter.Config>
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -34,6 +34,7 @@ Object.assign(plugin.configs, {
|
|
|
34
34
|
},
|
|
35
35
|
'flat/recommended': [
|
|
36
36
|
{
|
|
37
|
+
name: 'tanstack/query/flat/recommended',
|
|
37
38
|
plugins: {
|
|
38
39
|
'@tanstack/query': plugin,
|
|
39
40
|
},
|
|
@@ -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
|
}
|