Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tanstack/eslint-plugin-query

Package Overview
Dependencies
Maintainers
2
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/eslint-plugin-query - npm Package Compare versions

Comparing version 5.57.1 to 5.57.2

7

dist/esm/rules/infinite-query-property-order/infinite-query-property-order.rule.js

@@ -52,5 +52,8 @@ import { ESLintUtils, AST_NODE_TYPES } from "@typescript-eslint/utils";

return { name: p.argument.name, property: p };
} else {
throw new Error("Unsupported spread element");
} else if (p.argument.type === AST_NODE_TYPES.CallExpression) {
if (p.argument.callee.type === AST_NODE_TYPES.Identifier) {
return { name: p.argument.callee.name, property: p };
}
}
throw new Error("Unsupported spread element");
}

@@ -57,0 +60,0 @@ return [];

{
"name": "@tanstack/eslint-plugin-query",
"version": "5.57.1",
"version": "5.57.2",
"description": "ESLint plugin for TanStack Query",

@@ -5,0 +5,0 @@ "author": "Eliya Cohen",

@@ -16,2 +16,3 @@ import { RuleTester } from '@typescript-eslint/rule-tester'

generatePermutations,
normalizeIndent,
} from './test-utils'

@@ -23,3 +24,7 @@ import type { InfiniteQueryFunctions } from '../rules/infinite-query-property-order/constants'

type CheckedProperties = (typeof checkedProperties)[number]
const orderIndependentProps = ['queryKey', '...foo'] as const
const orderIndependentProps = [
'queryKey',
'...objectExpressionSpread',
'...callExpressionSpread',
] as const
type OrderIndependentProps = (typeof orderIndependentProps)[number]

@@ -89,3 +94,3 @@

invalid.indexOf('getPreviousPageParam'),
) !== 1 && !invalid.includes('queryFn'),
) !== 1,
),

@@ -128,2 +133,10 @@ )

const callExpressionSpread = normalizeIndent`
...communitiesQuery({
filters: {
...fieldValues,
placementFormats: [],
},
})`
function getCode({

@@ -136,6 +149,7 @@ infiniteQueryFunction: infiniteQueryFunction,

) {
if (property.startsWith('...')) {
return property
}
switch (property) {
case '...objectExpressionSpread':
return `...objectExpressionSpread`
case '...callExpressionSpread':
return callExpressionSpread
case 'queryKey':

@@ -150,4 +164,2 @@ return `queryKey: ['projects']`

}
return `${property}: () => null`
}

@@ -189,1 +201,26 @@ return `

})
// regression tests
const regressionTestCases = {
valid: [
{
name: 'should pass with call expression spread',
code: normalizeIndent`
import { useInfiniteQuery } from '@tanstack/react-query'
const { data, isFetching, isLoading, hasNextPage, fetchNextPage } =
useInfiniteQuery({
...communitiesQuery({
filters: {
...fieldValues,
placementFormats: [],
},
}),
refetchOnMount: false,
})`,
},
],
invalid: [],
}
ruleTester.run(name, rule, regressionTestCases)

@@ -68,5 +68,8 @@ import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'

return { name: p.argument.name, property: p }
} else {
throw new Error('Unsupported spread element')
} else if (p.argument.type === AST_NODE_TYPES.CallExpression) {
if (p.argument.callee.type === AST_NODE_TYPES.Identifier) {
return { name: p.argument.callee.name, property: p }
}
}
throw new Error('Unsupported spread element')
}

@@ -73,0 +76,0 @@ return []

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc