Skip to content

Commit 26737a2

Browse files
committed
Merge branch 'feat-eslint-prefer-query-options' of github.com:TanStack/query into feat-eslint-prefer-query-options
2 parents afd00a9 + 3a8e0f4 commit 26737a2

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

packages/eslint-plugin-query/src/rules/prefer-query-options/prefer-query-options.rule.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ export const rule = createRule({
121121
return
122122
}
123123

124-
if (queriesHooks.includes(importedName) && ASTUtils.isObjectExpression(options)) {
124+
if (
125+
queriesHooks.includes(importedName) &&
126+
ASTUtils.isObjectExpression(options)
127+
) {
125128
const queries = ASTUtils.findPropertyWithIdentifierKey(
126129
options.properties,
127130
'queries',
@@ -296,14 +299,19 @@ function isTanstackQueryClient(
296299
source.type === AST_NODE_TYPES.CallExpression &&
297300
ASTUtils.isIdentifier(source.callee)
298301
) {
299-
return getTanstackImportName(context, helpers, source.callee) === 'useQueryClient'
302+
return (
303+
getTanstackImportName(context, helpers, source.callee) ===
304+
'useQueryClient'
305+
)
300306
}
301307

302308
if (
303309
source.type === AST_NODE_TYPES.NewExpression &&
304310
ASTUtils.isIdentifier(source.callee)
305311
) {
306-
return getTanstackImportName(context, helpers, source.callee) === 'QueryClient'
312+
return (
313+
getTanstackImportName(context, helpers, source.callee) === 'QueryClient'
314+
)
307315
}
308316

309317
return false
@@ -320,8 +328,8 @@ function getTanstackImportName(
320328

321329
const definition = context.sourceCode
322330
.getScope(node)
323-
.references.find((reference) => reference.identifier === node)
324-
?.resolved?.defs[0]?.node
331+
.references.find((reference) => reference.identifier === node)?.resolved
332+
?.defs[0]?.node
325333

326334
if (
327335
definition?.type !== AST_NODE_TYPES.ImportSpecifier ||

0 commit comments

Comments
 (0)