@tanstack/eslint-plugin-query 5.0.0-alpha.88 → 5.0.0-beta.5
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/configs/index.cjs +46 -0
- package/build/legacy/configs/index.cjs.map +1 -0
- package/build/legacy/configs/index.d.cts +8 -0
- package/build/legacy/configs/index.d.ts +8 -0
- package/build/legacy/configs/index.js +21 -0
- package/build/legacy/configs/index.js.map +1 -0
- package/build/legacy/configs/index.test.cjs +21 -0
- package/build/legacy/configs/index.test.cjs.map +1 -0
- package/build/legacy/configs/index.test.d.cts +2 -0
- package/build/legacy/configs/index.test.d.ts +2 -0
- package/build/legacy/configs/index.test.js +19 -0
- package/build/legacy/configs/index.test.js.map +1 -0
- package/build/legacy/index.cjs +28 -431
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/index.d.cts +3 -14
- package/build/legacy/index.d.ts +3 -14
- package/build/legacy/index.js +3 -432
- package/build/legacy/index.js.map +1 -1
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.cjs +141 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.cjs.map +1 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.d.cts +6 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.d.ts +6 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.js +115 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.js.map +1 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.cjs +722 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.cjs.map +1 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.d.cts +2 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.d.ts +2 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.js +720 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.js.map +1 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.cjs +52 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.cjs.map +1 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.d.cts +12 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.d.ts +12 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.js +27 -0
- package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.js.map +1 -0
- package/build/legacy/rules/index.cjs +44 -0
- package/build/legacy/rules/index.cjs.map +1 -0
- package/build/legacy/rules/index.d.cts +7 -0
- package/build/legacy/rules/index.d.ts +7 -0
- package/build/legacy/rules/index.js +9 -0
- package/build/legacy/rules/index.js.map +1 -0
- package/build/legacy/utils/ast-utils.cjs +247 -0
- package/build/legacy/utils/ast-utils.cjs.map +1 -0
- package/build/legacy/utils/ast-utils.d.cts +41 -0
- package/build/legacy/utils/ast-utils.d.ts +41 -0
- package/build/legacy/utils/ast-utils.js +222 -0
- package/build/legacy/utils/ast-utils.js.map +1 -0
- package/build/legacy/utils/create-rule.cjs +39 -0
- package/build/legacy/utils/create-rule.cjs.map +1 -0
- package/build/legacy/utils/create-rule.d.cts +10 -0
- package/build/legacy/utils/create-rule.d.ts +10 -0
- package/build/legacy/utils/create-rule.js +14 -0
- package/build/legacy/utils/create-rule.js.map +1 -0
- package/build/legacy/utils/detect-react-query-imports.cjs +70 -0
- package/build/legacy/utils/detect-react-query-imports.cjs.map +1 -0
- package/build/legacy/utils/detect-react-query-imports.d.cts +12 -0
- package/build/legacy/utils/detect-react-query-imports.d.ts +12 -0
- package/build/legacy/utils/detect-react-query-imports.js +45 -0
- package/build/legacy/utils/detect-react-query-imports.js.map +1 -0
- package/build/legacy/utils/object-utils.cjs +33 -0
- package/build/legacy/utils/object-utils.cjs.map +1 -0
- package/build/legacy/utils/object-utils.d.cts +3 -0
- package/build/legacy/utils/object-utils.d.ts +3 -0
- package/build/legacy/utils/object-utils.js +8 -0
- package/build/legacy/utils/object-utils.js.map +1 -0
- package/build/legacy/utils/test-utils.cjs +36 -0
- package/build/legacy/utils/test-utils.cjs.map +1 -0
- package/build/legacy/utils/test-utils.d.cts +3 -0
- package/build/legacy/utils/test-utils.d.ts +3 -0
- package/build/legacy/utils/test-utils.js +11 -0
- package/build/legacy/utils/test-utils.js.map +1 -0
- package/build/legacy/utils/unique-by.cjs +33 -0
- package/build/legacy/utils/unique-by.cjs.map +1 -0
- package/build/legacy/utils/unique-by.d.cts +3 -0
- package/build/legacy/utils/unique-by.d.ts +3 -0
- package/build/legacy/utils/unique-by.js +8 -0
- package/build/legacy/utils/unique-by.js.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/rules/exhaustive-deps/exhaustive-deps.rule.ts","../../src/utils/ast-utils.ts","../../src/utils/unique-by.ts","../../src/utils/create-rule.ts","../../src/utils/detect-react-query-imports.ts","../../src/rules/exhaustive-deps/exhaustive-deps.utils.ts","../../src/rules/index.ts","../../src/configs/index.ts"],"names":["AST_NODE_TYPES","name","rule"],"mappings":";AAAA,SAAS,kBAAAA,uBAAsB;;;ACA/B,SAAS,sBAAsB;;;ACAxB,SAAS,SAAY,KAAU,IAA4B;AAChE,SAAO,IAAI,OAAO,CAAC,GAAG,GAAG,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;AAC1E;;;ADIO,IAAM,WAAW;AAAA,EACtB,cACE,MACA,OACqC;AACrC,WAAO,MAAM,SAAS,KAAK,IAAS;AAAA,EACtC;AAAA,EACA,aAAa,MAAkD;AAC7D,WAAO,KAAK,SAAS,eAAe;AAAA,EACtC;AAAA,EACA,qBACE,MACAC,OAC6B;AAC7B,WAAO,SAAS,aAAa,IAAI,KAAK,KAAK,SAASA;AAAA,EACtD;AAAA,EACA,2BACE,MACAA,OACmD;AACnD,WAAO,SAAS,aAAa,IAA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a;AAAA,IACX,SAAS,CAAC,+BAA+B;AAAA,IACzC,OAAO,0BAA0B,KAAK;AAAA,EACxC;AACF","sourcesContent":["import { AST_NODE_TYPES } from '@typescript-eslint/utils'\nimport { ASTUtils } from '../../utils/ast-utils'\nimport { createRule } from '../../utils/create-rule'\nimport { uniqueBy } from '../../utils/unique-by'\nimport { ExhaustiveDepsUtils } from './exhaustive-deps.utils'\nimport type { TSESLint } from '@typescript-eslint/utils'\n\nconst QUERY_KEY = 'queryKey'\nconst QUERY_FN = 'queryFn'\n\nexport const name = 'exhaustive-deps'\n\nexport const rule = createRule({\n name,\n meta: {\n type: 'problem',\n docs: {\n description: 'Exhaustive deps rule for useQuery',\n recommended: 'error',\n },\n messages: {\n missingDeps: `The following dependencies are missing in your queryKey: {{deps}}`,\n fixTo: 'Fix to {{result}}',\n },\n hasSuggestions: true,\n fixable: 'code',\n schema: [],\n },\n defaultOptions: [],\n\n create(context) {\n return {\n Property(node) {\n if (\n node.parent === undefined ||\n !ASTUtils.isObjectExpression(node.parent) ||\n !ASTUtils.isIdentifierWithName(node.key, QUERY_KEY)\n ) {\n return\n }\n\n const scopeManager = context.getSourceCode().scopeManager\n const queryKey = ASTUtils.findPropertyWithIdentifierKey(\n node.parent.properties,\n QUERY_KEY,\n )\n const queryFn = ASTUtils.findPropertyWithIdentifierKey(\n node.parent.properties,\n QUERY_FN,\n )\n\n if (\n scopeManager === null ||\n queryKey === undefined ||\n queryFn === undefined ||\n queryFn.value.type !== AST_NODE_TYPES.ArrowFunctionExpression\n ) {\n return\n }\n\n let queryKeyNode = queryKey.value\n\n if (\n queryKeyNode.type === AST_NODE_TYPES.TSAsExpression &&\n queryKeyNode.expression.type === AST_NODE_TYPES.ArrayExpression\n ) {\n queryKeyNode = queryKeyNode.expression\n }\n\n if (queryKeyNode.type === AST_NODE_TYPES.Identifier) {\n const expression = ASTUtils.getReferencedExpressionByIdentifier({\n context,\n node: queryKeyNode,\n })\n\n if (expression?.type === AST_NODE_TYPES.ArrayExpression) {\n queryKeyNode = expression\n }\n }\n\n const sourceCode = context.getSourceCode()\n const queryKeyValue = queryKeyNode\n const externalRefs = ASTUtils.getExternalRefs({\n scopeManager,\n sourceCode,\n node: queryFn.value,\n })\n\n const relevantRefs = externalRefs.filter((reference) =>\n ExhaustiveDepsUtils.isRelevantReference({\n context,\n reference,\n scopeManager,\n }),\n )\n\n const existingKeys = ASTUtils.getNestedIdentifiers(queryKeyValue).map(\n (identifier) => ASTUtils.mapKeyNodeToText(identifier, sourceCode),\n )\n\n const missingRefs = relevantRefs\n .map((ref) => ({\n ref: ref,\n text: ASTUtils.mapKeyNodeToText(ref.identifier, sourceCode),\n }))\n .filter(({ ref, text }) => {\n return (\n !ref.isTypeReference &&\n !ASTUtils.isAncestorIsCallee(ref.identifier) &&\n !existingKeys.some((existingKey) => existingKey === text) &&\n !existingKeys.includes(text.split('.')[0] ?? '')\n )\n })\n .map(({ ref, text }) => ({\n identifier: ref.identifier,\n text: text,\n }))\n\n const uniqueMissingRefs = uniqueBy(missingRefs, (x) => x.text)\n\n if (uniqueMissingRefs.length > 0) {\n const missingAsText = uniqueMissingRefs\n .map((ref) => ASTUtils.mapKeyNodeToText(ref.identifier, sourceCode))\n .join(', ')\n\n const existingWithMissing = sourceCode\n .getText(queryKeyValue)\n .replace(/\\]$/, `, ${missingAsText}]`)\n\n const suggestions: TSESLint.ReportSuggestionArray<string> = []\n\n if (queryKeyNode.type === AST_NODE_TYPES.ArrayExpression) {\n suggestions.push({\n messageId: 'fixTo',\n data: { result: existingWithMissing },\n fix(fixer) {\n return fixer.replaceText(queryKeyValue, existingWithMissing)\n },\n })\n }\n\n context.report({\n node: node,\n messageId: 'missingDeps',\n data: {\n deps: uniqueMissingRefs.map((ref) => ref.text).join(', '),\n },\n suggest: suggestions,\n })\n }\n },\n }\n },\n})\n","import { AST_NODE_TYPES } from '@typescript-eslint/utils'\nimport { uniqueBy } from './unique-by'\nimport type { TSESLint, TSESTree } from '@typescript-eslint/utils'\nimport type TSESLintScopeManager from '@typescript-eslint/scope-manager'\nimport type { RuleContext } from '@typescript-eslint/utils/dist/ts-eslint'\n\nexport const ASTUtils = {\n isNodeOfOneOf<T extends AST_NODE_TYPES>(\n node: TSESTree.Node,\n types: readonly 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 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: TSESTree.ObjectLiteralElement[],\n key: string,\n ): TSESTree.Property | undefined {\n return properties.find((x) =>\n ASTUtils.isPropertyWithIdentifierKey(x, key),\n ) as TSESTree.Property | undefined\n },\n getNestedIdentifiers(node: TSESTree.Node): TSESTree.Identifier[] {\n const identifiers: TSESTree.Identifier[] = []\n\n if (ASTUtils.isIdentifier(node)) {\n identifiers.push(node)\n }\n\n if ('arguments' in node) {\n node.arguments.forEach((x) => {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n })\n }\n\n if ('elements' in node) {\n node.elements.forEach((x) => {\n if (x !== null) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n }\n })\n }\n\n if ('properties' in node) {\n node.properties.forEach((x) => {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n })\n }\n\n if ('expressions' in node) {\n node.expressions.forEach((x) => {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n })\n }\n\n if (node.type === AST_NODE_TYPES.Property) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.value))\n }\n\n if (node.type === AST_NODE_TYPES.SpreadElement) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.argument))\n }\n\n if (node.type === AST_NODE_TYPES.MemberExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.object))\n }\n\n if (node.type === AST_NODE_TYPES.UnaryExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.argument))\n }\n\n if (node.type === AST_NODE_TYPES.ChainExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.expression))\n }\n\n if (node.type === AST_NODE_TYPES.TSNonNullExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.expression))\n }\n\n return identifiers\n },\n isAncestorIsCallee(identifier: TSESTree.Node) {\n let previousNode = identifier\n let currentNode = identifier.parent\n\n while (currentNode !== undefined) {\n if (\n currentNode.type === AST_NODE_TYPES.CallExpression &&\n currentNode.callee === previousNode\n ) {\n return true\n }\n\n if (currentNode.type !== AST_NODE_TYPES.MemberExpression) {\n return false\n }\n\n previousNode = currentNode\n currentNode = currentNode.parent\n }\n\n return false\n },\n traverseUpOnly(\n identifier: TSESTree.Node,\n allowedNodeTypes: 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 isDeclaredInNode(params: {\n functionNode: TSESTree.Node\n reference: TSESLintScopeManager.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 }): 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 references = scope.references\n .filter((x) => x.isRead() && !scope.set.has(x.identifier.name))\n .map((x) => {\n const referenceNode = 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 mapKeyNodeToText(\n node: TSESTree.Node,\n sourceCode: Readonly<TSESLint.SourceCode>,\n ) {\n return sourceCode.getText(\n ASTUtils.traverseUpOnly(node, [\n AST_NODE_TYPES.MemberExpression,\n AST_NODE_TYPES.Identifier,\n ]),\n )\n },\n isValidReactComponentOrHookName(identifier: TSESTree.Identifier | null) {\n return identifier !== null && /^(use|[A-Z])/.test(identifier.name)\n },\n getFunctionAncestor(\n context: Readonly<RuleContext<string, readonly unknown[]>>,\n ) {\n return context.getAncestors().find((x) => {\n if (x.type === AST_NODE_TYPES.FunctionDeclaration) {\n return true\n }\n\n return (\n x.parent?.type === AST_NODE_TYPES.VariableDeclarator &&\n x.parent.id.type === AST_NODE_TYPES.Identifier &&\n ASTUtils.isNodeOfOneOf(x, [\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n ])\n )\n })\n },\n getReferencedExpressionByIdentifier(params: {\n node: TSESTree.Node\n context: Readonly<RuleContext<string, readonly unknown[]>>\n }) {\n const { node, context } = params\n\n const resolvedNode = context\n .getScope()\n .references.find((ref) => ref.identifier === node)?.resolved\n ?.defs[0]?.node\n\n if (resolvedNode?.type !== AST_NODE_TYPES.VariableDeclarator) {\n return null\n }\n\n return resolvedNode.init\n },\n getNestedReturnStatements(node: TSESTree.Node): TSESTree.ReturnStatement[] {\n const returnStatements: TSESTree.ReturnStatement[] = []\n\n if (node.type === AST_NODE_TYPES.ReturnStatement) {\n returnStatements.push(node)\n }\n\n if ('body' in node && node.body !== undefined && node.body !== null) {\n Array.isArray(node.body)\n ? node.body.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n : returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.body),\n )\n }\n\n if ('consequent' in node) {\n Array.isArray(node.consequent)\n ? node.consequent.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n : returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.consequent),\n )\n }\n\n if ('alternate' in node && node.alternate !== null) {\n Array.isArray(node.alternate)\n ? node.alternate.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n : returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.alternate),\n )\n }\n\n if ('cases' in node) {\n node.cases.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n }\n\n if ('block' in node) {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(node.block))\n }\n\n if ('handler' in node && node.handler !== null) {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(node.handler))\n }\n\n if ('finalizer' in node && node.finalizer !== null) {\n returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.finalizer),\n )\n }\n\n if (\n 'expression' in node &&\n node.expression !== true &&\n node.expression !== false\n ) {\n returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.expression),\n )\n }\n\n if ('test' in node && node.test !== null) {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(node.test))\n }\n\n return returnStatements\n },\n}\n","export function uniqueBy<T>(arr: T[], fn: (x: T) => unknown): T[] {\n return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i)\n}\n","import { ESLintUtils } from '@typescript-eslint/utils'\nimport { detectTanstackQueryImports } from './detect-react-query-imports'\nimport type { EnhancedCreate } from './detect-react-query-imports'\n\nconst getDocsUrl = (ruleName: string): string =>\n `https://tanstack.com/query/v4/docs/eslint/${ruleName}`\n\ntype EslintRule = Omit<\n Parameters<ReturnType<typeof ESLintUtils.RuleCreator>>[0],\n 'create'\n> & {\n create: EnhancedCreate\n}\n\nexport function createRule({ create, ...rest }: EslintRule) {\n return ESLintUtils.RuleCreator(getDocsUrl)({\n ...rest,\n create: detectTanstackQueryImports(create),\n })\n}\n","import type { ESLintUtils, TSESLint, TSESTree } 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 isTanstackQueryImport: (node: TSESTree.Identifier) => boolean\n}\n\nexport type EnhancedCreate = (\n context: Context,\n options: Options,\n helpers: Helpers,\n) => ReturnType<Create>\n\nexport function detectTanstackQueryImports(create: EnhancedCreate): Create {\n return (context, optionsWithDefault) => {\n const tanstackQueryImportSpecifiers: TSESTree.ImportClause[] = []\n\n const helpers: Helpers = {\n isTanstackQueryImport(node) {\n return !!tanstackQueryImportSpecifiers.find((specifier) => {\n if (specifier.type === '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 node.importKind === 'value' &&\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 // TODO: canReportErrors()\n if (ruleInstructions[instruction]) {\n return ruleInstructions[instruction]?.(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 } from '@typescript-eslint/utils'\n\nexport const ExhaustiveDepsUtils = {\n isRelevantReference(params: {\n context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>\n reference: TSESLint.Scope.Reference\n scopeManager: TSESLint.Scope.ScopeManager\n }) {\n const { reference, scopeManager, context } = params\n const component = ASTUtils.getFunctionAncestor(context)\n\n if (\n component !== undefined &&\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.isQueryClientReference(reference)\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","import * as exhaustiveDeps from './exhaustive-deps/exhaustive-deps.rule'\n\nexport const rules = {\n [exhaustiveDeps.name]: exhaustiveDeps.rule,\n}\n","import { rules } from '../rules'\nimport type { TSESLint } from '@typescript-eslint/utils'\n\nfunction generateRecommendedConfig(\n allRules: Record<string, TSESLint.RuleModule<any, any>>,\n) {\n return Object.entries(allRules).reduce((memo, [name, rule]) => {\n const { recommended } = rule.meta.docs || {}\n\n return {\n ...memo,\n ...(recommended ? { [`@tanstack/query/${name}`]: recommended } : {}),\n }\n }, {} as Record<string, 'strict' | 'error' | 'warn'>)\n}\n\nexport const configs = {\n recommended: {\n plugins: ['@tanstack/eslint-plugin-query'],\n rules: generateRecommendedConfig(rules),\n },\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { configs } from './configs'\nexport { rules } from './rules'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AACxB,mBAAsB;","names":[]}
|
package/build/legacy/index.d.cts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
recommended: {
|
|
5
|
-
plugins: string[];
|
|
6
|
-
rules: Record<string, "error" | "strict" | "warn">;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
declare const rules: {
|
|
11
|
-
"exhaustive-deps": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<string, readonly unknown[], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { configs, rules };
|
|
1
|
+
export { configs } from './configs/index.cjs';
|
|
2
|
+
export { rules } from './rules/index.cjs';
|
|
3
|
+
import '@typescript-eslint/utils/dist/ts-eslint/Rule';
|
package/build/legacy/index.d.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
recommended: {
|
|
5
|
-
plugins: string[];
|
|
6
|
-
rules: Record<string, "error" | "strict" | "warn">;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
declare const rules: {
|
|
11
|
-
"exhaustive-deps": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<string, readonly unknown[], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { configs, rules };
|
|
1
|
+
export { configs } from './configs/index.js';
|
|
2
|
+
export { rules } from './rules/index.js';
|
|
3
|
+
import '@typescript-eslint/utils/dist/ts-eslint/Rule';
|
package/build/legacy/index.js
CHANGED
|
@@ -1,435 +1,6 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
// src/utils/ast-utils.ts
|
|
5
|
-
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
6
|
-
|
|
7
|
-
// src/utils/unique-by.ts
|
|
8
|
-
function uniqueBy(arr, fn) {
|
|
9
|
-
return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// src/utils/ast-utils.ts
|
|
13
|
-
var ASTUtils = {
|
|
14
|
-
isNodeOfOneOf(node, types) {
|
|
15
|
-
return types.includes(node.type);
|
|
16
|
-
},
|
|
17
|
-
isIdentifier(node) {
|
|
18
|
-
return node.type === AST_NODE_TYPES.Identifier;
|
|
19
|
-
},
|
|
20
|
-
isIdentifierWithName(node, name2) {
|
|
21
|
-
return ASTUtils.isIdentifier(node) && node.name === name2;
|
|
22
|
-
},
|
|
23
|
-
isIdentifierWithOneOfNames(node, name2) {
|
|
24
|
-
return ASTUtils.isIdentifier(node) && name2.includes(node.name);
|
|
25
|
-
},
|
|
26
|
-
isProperty(node) {
|
|
27
|
-
return node.type === AST_NODE_TYPES.Property;
|
|
28
|
-
},
|
|
29
|
-
isObjectExpression(node) {
|
|
30
|
-
return node.type === AST_NODE_TYPES.ObjectExpression;
|
|
31
|
-
},
|
|
32
|
-
isPropertyWithIdentifierKey(node, key) {
|
|
33
|
-
return ASTUtils.isProperty(node) && ASTUtils.isIdentifierWithName(node.key, key);
|
|
34
|
-
},
|
|
35
|
-
findPropertyWithIdentifierKey(properties, key) {
|
|
36
|
-
return properties.find(
|
|
37
|
-
(x) => ASTUtils.isPropertyWithIdentifierKey(x, key)
|
|
38
|
-
);
|
|
39
|
-
},
|
|
40
|
-
getNestedIdentifiers(node) {
|
|
41
|
-
const identifiers = [];
|
|
42
|
-
if (ASTUtils.isIdentifier(node)) {
|
|
43
|
-
identifiers.push(node);
|
|
44
|
-
}
|
|
45
|
-
if ("arguments" in node) {
|
|
46
|
-
node.arguments.forEach((x) => {
|
|
47
|
-
identifiers.push(...ASTUtils.getNestedIdentifiers(x));
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if ("elements" in node) {
|
|
51
|
-
node.elements.forEach((x) => {
|
|
52
|
-
if (x !== null) {
|
|
53
|
-
identifiers.push(...ASTUtils.getNestedIdentifiers(x));
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
if ("properties" in node) {
|
|
58
|
-
node.properties.forEach((x) => {
|
|
59
|
-
identifiers.push(...ASTUtils.getNestedIdentifiers(x));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
if ("expressions" in node) {
|
|
63
|
-
node.expressions.forEach((x) => {
|
|
64
|
-
identifiers.push(...ASTUtils.getNestedIdentifiers(x));
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if (node.type === AST_NODE_TYPES.Property) {
|
|
68
|
-
identifiers.push(...ASTUtils.getNestedIdentifiers(node.value));
|
|
69
|
-
}
|
|
70
|
-
if (node.type === AST_NODE_TYPES.SpreadElement) {
|
|
71
|
-
identifiers.push(...ASTUtils.getNestedIdentifiers(node.argument));
|
|
72
|
-
}
|
|
73
|
-
if (node.type === AST_NODE_TYPES.MemberExpression) {
|
|
74
|
-
identifiers.push(...ASTUtils.getNestedIdentifiers(node.object));
|
|
75
|
-
}
|
|
76
|
-
if (node.type === AST_NODE_TYPES.UnaryExpression) {
|
|
77
|
-
identifiers.push(...ASTUtils.getNestedIdentifiers(node.argument));
|
|
78
|
-
}
|
|
79
|
-
if (node.type === AST_NODE_TYPES.ChainExpression) {
|
|
80
|
-
identifiers.push(...ASTUtils.getNestedIdentifiers(node.expression));
|
|
81
|
-
}
|
|
82
|
-
if (node.type === AST_NODE_TYPES.TSNonNullExpression) {
|
|
83
|
-
identifiers.push(...ASTUtils.getNestedIdentifiers(node.expression));
|
|
84
|
-
}
|
|
85
|
-
return identifiers;
|
|
86
|
-
},
|
|
87
|
-
isAncestorIsCallee(identifier) {
|
|
88
|
-
let previousNode = identifier;
|
|
89
|
-
let currentNode = identifier.parent;
|
|
90
|
-
while (currentNode !== void 0) {
|
|
91
|
-
if (currentNode.type === AST_NODE_TYPES.CallExpression && currentNode.callee === previousNode) {
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
if (currentNode.type !== AST_NODE_TYPES.MemberExpression) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
previousNode = currentNode;
|
|
98
|
-
currentNode = currentNode.parent;
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
101
|
-
},
|
|
102
|
-
traverseUpOnly(identifier, allowedNodeTypes) {
|
|
103
|
-
const parent = identifier.parent;
|
|
104
|
-
if (parent !== void 0 && allowedNodeTypes.includes(parent.type)) {
|
|
105
|
-
return ASTUtils.traverseUpOnly(parent, allowedNodeTypes);
|
|
106
|
-
}
|
|
107
|
-
return identifier;
|
|
108
|
-
},
|
|
109
|
-
isDeclaredInNode(params) {
|
|
110
|
-
const { functionNode, reference, scopeManager } = params;
|
|
111
|
-
const scope = scopeManager.acquire(functionNode);
|
|
112
|
-
if (scope === null) {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
return scope.set.has(reference.identifier.name);
|
|
116
|
-
},
|
|
117
|
-
getExternalRefs(params) {
|
|
118
|
-
const { scopeManager, sourceCode, node } = params;
|
|
119
|
-
const scope = scopeManager.acquire(node);
|
|
120
|
-
if (scope === null) {
|
|
121
|
-
return [];
|
|
122
|
-
}
|
|
123
|
-
const references = scope.references.filter((x) => x.isRead() && !scope.set.has(x.identifier.name)).map((x) => {
|
|
124
|
-
const referenceNode = ASTUtils.traverseUpOnly(x.identifier, [
|
|
125
|
-
AST_NODE_TYPES.MemberExpression,
|
|
126
|
-
AST_NODE_TYPES.Identifier
|
|
127
|
-
]);
|
|
128
|
-
return {
|
|
129
|
-
variable: x,
|
|
130
|
-
node: referenceNode,
|
|
131
|
-
text: sourceCode.getText(referenceNode)
|
|
132
|
-
};
|
|
133
|
-
});
|
|
134
|
-
const localRefIds = new Set(
|
|
135
|
-
[...scope.set.values()].map((x) => sourceCode.getText(x.identifiers[0]))
|
|
136
|
-
);
|
|
137
|
-
const externalRefs = references.filter(
|
|
138
|
-
(x) => x.variable.resolved === null || !localRefIds.has(x.text)
|
|
139
|
-
);
|
|
140
|
-
return uniqueBy(externalRefs, (x) => x.text).map((x) => x.variable);
|
|
141
|
-
},
|
|
142
|
-
mapKeyNodeToText(node, sourceCode) {
|
|
143
|
-
return sourceCode.getText(
|
|
144
|
-
ASTUtils.traverseUpOnly(node, [
|
|
145
|
-
AST_NODE_TYPES.MemberExpression,
|
|
146
|
-
AST_NODE_TYPES.Identifier
|
|
147
|
-
])
|
|
148
|
-
);
|
|
149
|
-
},
|
|
150
|
-
isValidReactComponentOrHookName(identifier) {
|
|
151
|
-
return identifier !== null && /^(use|[A-Z])/.test(identifier.name);
|
|
152
|
-
},
|
|
153
|
-
getFunctionAncestor(context) {
|
|
154
|
-
return context.getAncestors().find((x) => {
|
|
155
|
-
var _a;
|
|
156
|
-
if (x.type === AST_NODE_TYPES.FunctionDeclaration) {
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
return ((_a = x.parent) == null ? void 0 : _a.type) === AST_NODE_TYPES.VariableDeclarator && x.parent.id.type === AST_NODE_TYPES.Identifier && ASTUtils.isNodeOfOneOf(x, [
|
|
160
|
-
AST_NODE_TYPES.FunctionDeclaration,
|
|
161
|
-
AST_NODE_TYPES.FunctionExpression,
|
|
162
|
-
AST_NODE_TYPES.ArrowFunctionExpression
|
|
163
|
-
]);
|
|
164
|
-
});
|
|
165
|
-
},
|
|
166
|
-
getReferencedExpressionByIdentifier(params) {
|
|
167
|
-
var _a, _b, _c;
|
|
168
|
-
const { node, context } = params;
|
|
169
|
-
const resolvedNode = (_c = (_b = (_a = context.getScope().references.find((ref) => ref.identifier === node)) == null ? void 0 : _a.resolved) == null ? void 0 : _b.defs[0]) == null ? void 0 : _c.node;
|
|
170
|
-
if ((resolvedNode == null ? void 0 : resolvedNode.type) !== AST_NODE_TYPES.VariableDeclarator) {
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
return resolvedNode.init;
|
|
174
|
-
},
|
|
175
|
-
getNestedReturnStatements(node) {
|
|
176
|
-
const returnStatements = [];
|
|
177
|
-
if (node.type === AST_NODE_TYPES.ReturnStatement) {
|
|
178
|
-
returnStatements.push(node);
|
|
179
|
-
}
|
|
180
|
-
if ("body" in node && node.body !== void 0 && node.body !== null) {
|
|
181
|
-
Array.isArray(node.body) ? node.body.forEach((x) => {
|
|
182
|
-
returnStatements.push(...ASTUtils.getNestedReturnStatements(x));
|
|
183
|
-
}) : returnStatements.push(
|
|
184
|
-
...ASTUtils.getNestedReturnStatements(node.body)
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
if ("consequent" in node) {
|
|
188
|
-
Array.isArray(node.consequent) ? node.consequent.forEach((x) => {
|
|
189
|
-
returnStatements.push(...ASTUtils.getNestedReturnStatements(x));
|
|
190
|
-
}) : returnStatements.push(
|
|
191
|
-
...ASTUtils.getNestedReturnStatements(node.consequent)
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
if ("alternate" in node && node.alternate !== null) {
|
|
195
|
-
Array.isArray(node.alternate) ? node.alternate.forEach((x) => {
|
|
196
|
-
returnStatements.push(...ASTUtils.getNestedReturnStatements(x));
|
|
197
|
-
}) : returnStatements.push(
|
|
198
|
-
...ASTUtils.getNestedReturnStatements(node.alternate)
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
if ("cases" in node) {
|
|
202
|
-
node.cases.forEach((x) => {
|
|
203
|
-
returnStatements.push(...ASTUtils.getNestedReturnStatements(x));
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
if ("block" in node) {
|
|
207
|
-
returnStatements.push(...ASTUtils.getNestedReturnStatements(node.block));
|
|
208
|
-
}
|
|
209
|
-
if ("handler" in node && node.handler !== null) {
|
|
210
|
-
returnStatements.push(...ASTUtils.getNestedReturnStatements(node.handler));
|
|
211
|
-
}
|
|
212
|
-
if ("finalizer" in node && node.finalizer !== null) {
|
|
213
|
-
returnStatements.push(
|
|
214
|
-
...ASTUtils.getNestedReturnStatements(node.finalizer)
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
if ("expression" in node && node.expression !== true && node.expression !== false) {
|
|
218
|
-
returnStatements.push(
|
|
219
|
-
...ASTUtils.getNestedReturnStatements(node.expression)
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
if ("test" in node && node.test !== null) {
|
|
223
|
-
returnStatements.push(...ASTUtils.getNestedReturnStatements(node.test));
|
|
224
|
-
}
|
|
225
|
-
return returnStatements;
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
// src/utils/create-rule.ts
|
|
230
|
-
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
231
|
-
|
|
232
|
-
// src/utils/detect-react-query-imports.ts
|
|
233
|
-
function detectTanstackQueryImports(create) {
|
|
234
|
-
return (context, optionsWithDefault) => {
|
|
235
|
-
const tanstackQueryImportSpecifiers = [];
|
|
236
|
-
const helpers = {
|
|
237
|
-
isTanstackQueryImport(node) {
|
|
238
|
-
return !!tanstackQueryImportSpecifiers.find((specifier) => {
|
|
239
|
-
if (specifier.type === "ImportSpecifier") {
|
|
240
|
-
return node.name === specifier.local.name;
|
|
241
|
-
}
|
|
242
|
-
return false;
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
const detectionInstructions = {
|
|
247
|
-
ImportDeclaration(node) {
|
|
248
|
-
if (node.specifiers.length > 0 && node.importKind === "value" && node.source.value.startsWith("@tanstack/") && node.source.value.endsWith("-query")) {
|
|
249
|
-
tanstackQueryImportSpecifiers.push(...node.specifiers);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
const ruleInstructions = create(context, optionsWithDefault, helpers);
|
|
254
|
-
const enhancedRuleInstructions = {};
|
|
255
|
-
const allKeys = new Set(
|
|
256
|
-
Object.keys(detectionInstructions).concat(Object.keys(ruleInstructions))
|
|
257
|
-
);
|
|
258
|
-
allKeys.forEach((instruction) => {
|
|
259
|
-
enhancedRuleInstructions[instruction] = (node) => {
|
|
260
|
-
var _a, _b;
|
|
261
|
-
if (instruction in detectionInstructions) {
|
|
262
|
-
(_a = detectionInstructions[instruction]) == null ? void 0 : _a.call(detectionInstructions, node);
|
|
263
|
-
}
|
|
264
|
-
if (ruleInstructions[instruction]) {
|
|
265
|
-
return (_b = ruleInstructions[instruction]) == null ? void 0 : _b.call(ruleInstructions, node);
|
|
266
|
-
}
|
|
267
|
-
return void 0;
|
|
268
|
-
};
|
|
269
|
-
});
|
|
270
|
-
return enhancedRuleInstructions;
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// src/utils/create-rule.ts
|
|
275
|
-
var getDocsUrl = (ruleName) => `https://tanstack.com/query/v4/docs/eslint/${ruleName}`;
|
|
276
|
-
function createRule({ create, ...rest }) {
|
|
277
|
-
return ESLintUtils.RuleCreator(getDocsUrl)({
|
|
278
|
-
...rest,
|
|
279
|
-
create: detectTanstackQueryImports(create)
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// src/rules/exhaustive-deps/exhaustive-deps.utils.ts
|
|
284
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/utils";
|
|
285
|
-
var ExhaustiveDepsUtils = {
|
|
286
|
-
isRelevantReference(params) {
|
|
287
|
-
var _a;
|
|
288
|
-
const { reference, scopeManager, context } = params;
|
|
289
|
-
const component = ASTUtils.getFunctionAncestor(context);
|
|
290
|
-
if (component !== void 0 && !ASTUtils.isDeclaredInNode({
|
|
291
|
-
scopeManager,
|
|
292
|
-
reference,
|
|
293
|
-
functionNode: component
|
|
294
|
-
})) {
|
|
295
|
-
return false;
|
|
296
|
-
}
|
|
297
|
-
return reference.identifier.name !== "undefined" && ((_a = reference.identifier.parent) == null ? void 0 : _a.type) !== AST_NODE_TYPES2.NewExpression && !ExhaustiveDepsUtils.isQueryClientReference(reference);
|
|
298
|
-
},
|
|
299
|
-
isQueryClientReference(reference) {
|
|
300
|
-
var _a, _b, _c;
|
|
301
|
-
const declarator = (_b = (_a = reference.resolved) == null ? void 0 : _a.defs[0]) == null ? void 0 : _b.node;
|
|
302
|
-
return (declarator == null ? void 0 : declarator.type) === AST_NODE_TYPES2.VariableDeclarator && ((_c = declarator.init) == null ? void 0 : _c.type) === AST_NODE_TYPES2.CallExpression && declarator.init.callee.type === AST_NODE_TYPES2.Identifier && declarator.init.callee.name === "useQueryClient";
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
// src/rules/exhaustive-deps/exhaustive-deps.rule.ts
|
|
307
|
-
var QUERY_KEY = "queryKey";
|
|
308
|
-
var QUERY_FN = "queryFn";
|
|
309
|
-
var name = "exhaustive-deps";
|
|
310
|
-
var rule = createRule({
|
|
311
|
-
name,
|
|
312
|
-
meta: {
|
|
313
|
-
type: "problem",
|
|
314
|
-
docs: {
|
|
315
|
-
description: "Exhaustive deps rule for useQuery",
|
|
316
|
-
recommended: "error"
|
|
317
|
-
},
|
|
318
|
-
messages: {
|
|
319
|
-
missingDeps: `The following dependencies are missing in your queryKey: {{deps}}`,
|
|
320
|
-
fixTo: "Fix to {{result}}"
|
|
321
|
-
},
|
|
322
|
-
hasSuggestions: true,
|
|
323
|
-
fixable: "code",
|
|
324
|
-
schema: []
|
|
325
|
-
},
|
|
326
|
-
defaultOptions: [],
|
|
327
|
-
create(context) {
|
|
328
|
-
return {
|
|
329
|
-
Property(node) {
|
|
330
|
-
if (node.parent === void 0 || !ASTUtils.isObjectExpression(node.parent) || !ASTUtils.isIdentifierWithName(node.key, QUERY_KEY)) {
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
const scopeManager = context.getSourceCode().scopeManager;
|
|
334
|
-
const queryKey = ASTUtils.findPropertyWithIdentifierKey(
|
|
335
|
-
node.parent.properties,
|
|
336
|
-
QUERY_KEY
|
|
337
|
-
);
|
|
338
|
-
const queryFn = ASTUtils.findPropertyWithIdentifierKey(
|
|
339
|
-
node.parent.properties,
|
|
340
|
-
QUERY_FN
|
|
341
|
-
);
|
|
342
|
-
if (scopeManager === null || queryKey === void 0 || queryFn === void 0 || queryFn.value.type !== AST_NODE_TYPES3.ArrowFunctionExpression) {
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
let queryKeyNode = queryKey.value;
|
|
346
|
-
if (queryKeyNode.type === AST_NODE_TYPES3.TSAsExpression && queryKeyNode.expression.type === AST_NODE_TYPES3.ArrayExpression) {
|
|
347
|
-
queryKeyNode = queryKeyNode.expression;
|
|
348
|
-
}
|
|
349
|
-
if (queryKeyNode.type === AST_NODE_TYPES3.Identifier) {
|
|
350
|
-
const expression = ASTUtils.getReferencedExpressionByIdentifier({
|
|
351
|
-
context,
|
|
352
|
-
node: queryKeyNode
|
|
353
|
-
});
|
|
354
|
-
if ((expression == null ? void 0 : expression.type) === AST_NODE_TYPES3.ArrayExpression) {
|
|
355
|
-
queryKeyNode = expression;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
const sourceCode = context.getSourceCode();
|
|
359
|
-
const queryKeyValue = queryKeyNode;
|
|
360
|
-
const externalRefs = ASTUtils.getExternalRefs({
|
|
361
|
-
scopeManager,
|
|
362
|
-
sourceCode,
|
|
363
|
-
node: queryFn.value
|
|
364
|
-
});
|
|
365
|
-
const relevantRefs = externalRefs.filter(
|
|
366
|
-
(reference) => ExhaustiveDepsUtils.isRelevantReference({
|
|
367
|
-
context,
|
|
368
|
-
reference,
|
|
369
|
-
scopeManager
|
|
370
|
-
})
|
|
371
|
-
);
|
|
372
|
-
const existingKeys = ASTUtils.getNestedIdentifiers(queryKeyValue).map(
|
|
373
|
-
(identifier) => ASTUtils.mapKeyNodeToText(identifier, sourceCode)
|
|
374
|
-
);
|
|
375
|
-
const missingRefs = relevantRefs.map((ref) => ({
|
|
376
|
-
ref,
|
|
377
|
-
text: ASTUtils.mapKeyNodeToText(ref.identifier, sourceCode)
|
|
378
|
-
})).filter(({ ref, text }) => {
|
|
379
|
-
return !ref.isTypeReference && !ASTUtils.isAncestorIsCallee(ref.identifier) && !existingKeys.some((existingKey) => existingKey === text) && !existingKeys.includes(text.split(".")[0] ?? "");
|
|
380
|
-
}).map(({ ref, text }) => ({
|
|
381
|
-
identifier: ref.identifier,
|
|
382
|
-
text
|
|
383
|
-
}));
|
|
384
|
-
const uniqueMissingRefs = uniqueBy(missingRefs, (x) => x.text);
|
|
385
|
-
if (uniqueMissingRefs.length > 0) {
|
|
386
|
-
const missingAsText = uniqueMissingRefs.map((ref) => ASTUtils.mapKeyNodeToText(ref.identifier, sourceCode)).join(", ");
|
|
387
|
-
const existingWithMissing = sourceCode.getText(queryKeyValue).replace(/\]$/, `, ${missingAsText}]`);
|
|
388
|
-
const suggestions = [];
|
|
389
|
-
if (queryKeyNode.type === AST_NODE_TYPES3.ArrayExpression) {
|
|
390
|
-
suggestions.push({
|
|
391
|
-
messageId: "fixTo",
|
|
392
|
-
data: { result: existingWithMissing },
|
|
393
|
-
fix(fixer) {
|
|
394
|
-
return fixer.replaceText(queryKeyValue, existingWithMissing);
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
context.report({
|
|
399
|
-
node,
|
|
400
|
-
messageId: "missingDeps",
|
|
401
|
-
data: {
|
|
402
|
-
deps: uniqueMissingRefs.map((ref) => ref.text).join(", ")
|
|
403
|
-
},
|
|
404
|
-
suggest: suggestions
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
// src/rules/index.ts
|
|
413
|
-
var rules = {
|
|
414
|
-
[name]: rule
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
// src/configs/index.ts
|
|
418
|
-
function generateRecommendedConfig(allRules) {
|
|
419
|
-
return Object.entries(allRules).reduce((memo, [name2, rule2]) => {
|
|
420
|
-
const { recommended } = rule2.meta.docs || {};
|
|
421
|
-
return {
|
|
422
|
-
...memo,
|
|
423
|
-
...recommended ? { [`@tanstack/query/${name2}`]: recommended } : {}
|
|
424
|
-
};
|
|
425
|
-
}, {});
|
|
426
|
-
}
|
|
427
|
-
var configs = {
|
|
428
|
-
recommended: {
|
|
429
|
-
plugins: ["@tanstack/eslint-plugin-query"],
|
|
430
|
-
rules: generateRecommendedConfig(rules)
|
|
431
|
-
}
|
|
432
|
-
};
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { configs } from "./configs.js";
|
|
3
|
+
import { rules } from "./rules.js";
|
|
433
4
|
export {
|
|
434
5
|
configs,
|
|
435
6
|
rules
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/rules/exhaustive-deps/exhaustive-deps.rule.ts","../../src/utils/ast-utils.ts","../../src/utils/unique-by.ts","../../src/utils/create-rule.ts","../../src/utils/detect-react-query-imports.ts","../../src/rules/exhaustive-deps/exhaustive-deps.utils.ts","../../src/rules/index.ts","../../src/configs/index.ts"],"sourcesContent":["import { AST_NODE_TYPES } from '@typescript-eslint/utils'\nimport { ASTUtils } from '../../utils/ast-utils'\nimport { createRule } from '../../utils/create-rule'\nimport { uniqueBy } from '../../utils/unique-by'\nimport { ExhaustiveDepsUtils } from './exhaustive-deps.utils'\nimport type { TSESLint } from '@typescript-eslint/utils'\n\nconst QUERY_KEY = 'queryKey'\nconst QUERY_FN = 'queryFn'\n\nexport const name = 'exhaustive-deps'\n\nexport const rule = createRule({\n name,\n meta: {\n type: 'problem',\n docs: {\n description: 'Exhaustive deps rule for useQuery',\n recommended: 'error',\n },\n messages: {\n missingDeps: `The following dependencies are missing in your queryKey: {{deps}}`,\n fixTo: 'Fix to {{result}}',\n },\n hasSuggestions: true,\n fixable: 'code',\n schema: [],\n },\n defaultOptions: [],\n\n create(context) {\n return {\n Property(node) {\n if (\n node.parent === undefined ||\n !ASTUtils.isObjectExpression(node.parent) ||\n !ASTUtils.isIdentifierWithName(node.key, QUERY_KEY)\n ) {\n return\n }\n\n const scopeManager = context.getSourceCode().scopeManager\n const queryKey = ASTUtils.findPropertyWithIdentifierKey(\n node.parent.properties,\n QUERY_KEY,\n )\n const queryFn = ASTUtils.findPropertyWithIdentifierKey(\n node.parent.properties,\n QUERY_FN,\n )\n\n if (\n scopeManager === null ||\n queryKey === undefined ||\n queryFn === undefined ||\n queryFn.value.type !== AST_NODE_TYPES.ArrowFunctionExpression\n ) {\n return\n }\n\n let queryKeyNode = queryKey.value\n\n if (\n queryKeyNode.type === AST_NODE_TYPES.TSAsExpression &&\n queryKeyNode.expression.type === AST_NODE_TYPES.ArrayExpression\n ) {\n queryKeyNode = queryKeyNode.expression\n }\n\n if (queryKeyNode.type === AST_NODE_TYPES.Identifier) {\n const expression = ASTUtils.getReferencedExpressionByIdentifier({\n context,\n node: queryKeyNode,\n })\n\n if (expression?.type === AST_NODE_TYPES.ArrayExpression) {\n queryKeyNode = expression\n }\n }\n\n const sourceCode = context.getSourceCode()\n const queryKeyValue = queryKeyNode\n const externalRefs = ASTUtils.getExternalRefs({\n scopeManager,\n sourceCode,\n node: queryFn.value,\n })\n\n const relevantRefs = externalRefs.filter((reference) =>\n ExhaustiveDepsUtils.isRelevantReference({\n context,\n reference,\n scopeManager,\n }),\n )\n\n const existingKeys = ASTUtils.getNestedIdentifiers(queryKeyValue).map(\n (identifier) => ASTUtils.mapKeyNodeToText(identifier, sourceCode),\n )\n\n const missingRefs = relevantRefs\n .map((ref) => ({\n ref: ref,\n text: ASTUtils.mapKeyNodeToText(ref.identifier, sourceCode),\n }))\n .filter(({ ref, text }) => {\n return (\n !ref.isTypeReference &&\n !ASTUtils.isAncestorIsCallee(ref.identifier) &&\n !existingKeys.some((existingKey) => existingKey === text) &&\n !existingKeys.includes(text.split('.')[0] ?? '')\n )\n })\n .map(({ ref, text }) => ({\n identifier: ref.identifier,\n text: text,\n }))\n\n const uniqueMissingRefs = uniqueBy(missingRefs, (x) => x.text)\n\n if (uniqueMissingRefs.length > 0) {\n const missingAsText = uniqueMissingRefs\n .map((ref) => ASTUtils.mapKeyNodeToText(ref.identifier, sourceCode))\n .join(', ')\n\n const existingWithMissing = sourceCode\n .getText(queryKeyValue)\n .replace(/\\]$/, `, ${missingAsText}]`)\n\n const suggestions: TSESLint.ReportSuggestionArray<string> = []\n\n if (queryKeyNode.type === AST_NODE_TYPES.ArrayExpression) {\n suggestions.push({\n messageId: 'fixTo',\n data: { result: existingWithMissing },\n fix(fixer) {\n return fixer.replaceText(queryKeyValue, existingWithMissing)\n },\n })\n }\n\n context.report({\n node: node,\n messageId: 'missingDeps',\n data: {\n deps: uniqueMissingRefs.map((ref) => ref.text).join(', '),\n },\n suggest: suggestions,\n })\n }\n },\n }\n },\n})\n","import { AST_NODE_TYPES } from '@typescript-eslint/utils'\nimport { uniqueBy } from './unique-by'\nimport type { TSESLint, TSESTree } from '@typescript-eslint/utils'\nimport type TSESLintScopeManager from '@typescript-eslint/scope-manager'\nimport type { RuleContext } from '@typescript-eslint/utils/dist/ts-eslint'\n\nexport const ASTUtils = {\n isNodeOfOneOf<T extends AST_NODE_TYPES>(\n node: TSESTree.Node,\n types: readonly 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 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: TSESTree.ObjectLiteralElement[],\n key: string,\n ): TSESTree.Property | undefined {\n return properties.find((x) =>\n ASTUtils.isPropertyWithIdentifierKey(x, key),\n ) as TSESTree.Property | undefined\n },\n getNestedIdentifiers(node: TSESTree.Node): TSESTree.Identifier[] {\n const identifiers: TSESTree.Identifier[] = []\n\n if (ASTUtils.isIdentifier(node)) {\n identifiers.push(node)\n }\n\n if ('arguments' in node) {\n node.arguments.forEach((x) => {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n })\n }\n\n if ('elements' in node) {\n node.elements.forEach((x) => {\n if (x !== null) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n }\n })\n }\n\n if ('properties' in node) {\n node.properties.forEach((x) => {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n })\n }\n\n if ('expressions' in node) {\n node.expressions.forEach((x) => {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n })\n }\n\n if (node.type === AST_NODE_TYPES.Property) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.value))\n }\n\n if (node.type === AST_NODE_TYPES.SpreadElement) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.argument))\n }\n\n if (node.type === AST_NODE_TYPES.MemberExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.object))\n }\n\n if (node.type === AST_NODE_TYPES.UnaryExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.argument))\n }\n\n if (node.type === AST_NODE_TYPES.ChainExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.expression))\n }\n\n if (node.type === AST_NODE_TYPES.TSNonNullExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.expression))\n }\n\n return identifiers\n },\n isAncestorIsCallee(identifier: TSESTree.Node) {\n let previousNode = identifier\n let currentNode = identifier.parent\n\n while (currentNode !== undefined) {\n if (\n currentNode.type === AST_NODE_TYPES.CallExpression &&\n currentNode.callee === previousNode\n ) {\n return true\n }\n\n if (currentNode.type !== AST_NODE_TYPES.MemberExpression) {\n return false\n }\n\n previousNode = currentNode\n currentNode = currentNode.parent\n }\n\n return false\n },\n traverseUpOnly(\n identifier: TSESTree.Node,\n allowedNodeTypes: 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 isDeclaredInNode(params: {\n functionNode: TSESTree.Node\n reference: TSESLintScopeManager.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 }): 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 references = scope.references\n .filter((x) => x.isRead() && !scope.set.has(x.identifier.name))\n .map((x) => {\n const referenceNode = 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 mapKeyNodeToText(\n node: TSESTree.Node,\n sourceCode: Readonly<TSESLint.SourceCode>,\n ) {\n return sourceCode.getText(\n ASTUtils.traverseUpOnly(node, [\n AST_NODE_TYPES.MemberExpression,\n AST_NODE_TYPES.Identifier,\n ]),\n )\n },\n isValidReactComponentOrHookName(identifier: TSESTree.Identifier | null) {\n return identifier !== null && /^(use|[A-Z])/.test(identifier.name)\n },\n getFunctionAncestor(\n context: Readonly<RuleContext<string, readonly unknown[]>>,\n ) {\n return context.getAncestors().find((x) => {\n if (x.type === AST_NODE_TYPES.FunctionDeclaration) {\n return true\n }\n\n return (\n x.parent?.type === AST_NODE_TYPES.VariableDeclarator &&\n x.parent.id.type === AST_NODE_TYPES.Identifier &&\n ASTUtils.isNodeOfOneOf(x, [\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n ])\n )\n })\n },\n getReferencedExpressionByIdentifier(params: {\n node: TSESTree.Node\n context: Readonly<RuleContext<string, readonly unknown[]>>\n }) {\n const { node, context } = params\n\n const resolvedNode = context\n .getScope()\n .references.find((ref) => ref.identifier === node)?.resolved\n ?.defs[0]?.node\n\n if (resolvedNode?.type !== AST_NODE_TYPES.VariableDeclarator) {\n return null\n }\n\n return resolvedNode.init\n },\n getNestedReturnStatements(node: TSESTree.Node): TSESTree.ReturnStatement[] {\n const returnStatements: TSESTree.ReturnStatement[] = []\n\n if (node.type === AST_NODE_TYPES.ReturnStatement) {\n returnStatements.push(node)\n }\n\n if ('body' in node && node.body !== undefined && node.body !== null) {\n Array.isArray(node.body)\n ? node.body.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n : returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.body),\n )\n }\n\n if ('consequent' in node) {\n Array.isArray(node.consequent)\n ? node.consequent.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n : returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.consequent),\n )\n }\n\n if ('alternate' in node && node.alternate !== null) {\n Array.isArray(node.alternate)\n ? node.alternate.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n : returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.alternate),\n )\n }\n\n if ('cases' in node) {\n node.cases.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n }\n\n if ('block' in node) {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(node.block))\n }\n\n if ('handler' in node && node.handler !== null) {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(node.handler))\n }\n\n if ('finalizer' in node && node.finalizer !== null) {\n returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.finalizer),\n )\n }\n\n if (\n 'expression' in node &&\n node.expression !== true &&\n node.expression !== false\n ) {\n returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.expression),\n )\n }\n\n if ('test' in node && node.test !== null) {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(node.test))\n }\n\n return returnStatements\n },\n}\n","export function uniqueBy<T>(arr: T[], fn: (x: T) => unknown): T[] {\n return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i)\n}\n","import { ESLintUtils } from '@typescript-eslint/utils'\nimport { detectTanstackQueryImports } from './detect-react-query-imports'\nimport type { EnhancedCreate } from './detect-react-query-imports'\n\nconst getDocsUrl = (ruleName: string): string =>\n `https://tanstack.com/query/v4/docs/eslint/${ruleName}`\n\ntype EslintRule = Omit<\n Parameters<ReturnType<typeof ESLintUtils.RuleCreator>>[0],\n 'create'\n> & {\n create: EnhancedCreate\n}\n\nexport function createRule({ create, ...rest }: EslintRule) {\n return ESLintUtils.RuleCreator(getDocsUrl)({\n ...rest,\n create: detectTanstackQueryImports(create),\n })\n}\n","import type { ESLintUtils, TSESLint, TSESTree } 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 isTanstackQueryImport: (node: TSESTree.Identifier) => boolean\n}\n\nexport type EnhancedCreate = (\n context: Context,\n options: Options,\n helpers: Helpers,\n) => ReturnType<Create>\n\nexport function detectTanstackQueryImports(create: EnhancedCreate): Create {\n return (context, optionsWithDefault) => {\n const tanstackQueryImportSpecifiers: TSESTree.ImportClause[] = []\n\n const helpers: Helpers = {\n isTanstackQueryImport(node) {\n return !!tanstackQueryImportSpecifiers.find((specifier) => {\n if (specifier.type === '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 node.importKind === 'value' &&\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 // TODO: canReportErrors()\n if (ruleInstructions[instruction]) {\n return ruleInstructions[instruction]?.(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 } from '@typescript-eslint/utils'\n\nexport const ExhaustiveDepsUtils = {\n isRelevantReference(params: {\n context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>\n reference: TSESLint.Scope.Reference\n scopeManager: TSESLint.Scope.ScopeManager\n }) {\n const { reference, scopeManager, context } = params\n const component = ASTUtils.getFunctionAncestor(context)\n\n if (\n component !== undefined &&\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.isQueryClientReference(reference)\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","import * as exhaustiveDeps from './exhaustive-deps/exhaustive-deps.rule'\n\nexport const rules = {\n [exhaustiveDeps.name]: exhaustiveDeps.rule,\n}\n","import { rules } from '../rules'\nimport type { TSESLint } from '@typescript-eslint/utils'\n\nfunction generateRecommendedConfig(\n allRules: Record<string, TSESLint.RuleModule<any, any>>,\n) {\n return Object.entries(allRules).reduce((memo, [name, rule]) => {\n const { recommended } = rule.meta.docs || {}\n\n return {\n ...memo,\n ...(recommended ? { [`@tanstack/query/${name}`]: recommended } : {}),\n }\n }, {} as Record<string, 'strict' | 'error' | 'warn'>)\n}\n\nexport const configs = {\n recomm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X,MAAM;AAAA,cACJ,MAAM,kBAAkB,IAAI,CAAC,QAAQ,IAAI,IAAI,EAAE,KAAK,IAAI;AAAA,YAC1D;AAAA,YACA,SAAS;AAAA,UACX,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AMvJM,IAAM,QAAQ;AAAA,EACnB,CAAgB,IAAI,GAAkB;AACxC;;;ACDA,SAAS,0BACP,UACA;AACA,SAAO,OAAO,QAAQ,QAAQ,EAAE,OAAO,CAAC,MAAM,CAACC,OAAMC,KAAI,MAAM;AAC7D,UAAM,EAAE,YAAY,IAAIA,MAAK,KAAK,QAAQ,CAAC;AAE3C,WAAO;AAAA,MACL,GAAG;AAAA,MACH,GAAI,cAAc,EAAE,CAAC,mBAAmBD,KAAI,EAAE,GAAG,YAAY,IAAI,CAAC;AAAA,IACpE;AAAA,EACF,GAAG,CAAC,CAAgD;AACtD;AAEO,IAAM,UAAU;AAAA,EACrB,aAAa;AAAA,IACX,SAAS,CAAC,+BAA+B;AAAA,IACzC,OAAO,0BAA0B,KAAK;AAAA,EACxC;AACF;","names":["AST_NODE_TYPES","name","AST_NODE_TYPES","AST_NODE_TYPES","AST_NODE_TYPES","name","rule"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { configs } from './configs'\nexport { rules } from './rules'\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,aAAa;","names":[]}
|