-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Copy link
Description
Here’s a failing test-case for the rule infinite-query-property-order
{
name: 'should work with object spread',
code: normalizeIndent`
return useInfiniteQuery({
...myOptions.infiniteQueryOptions(),
refetchInterval: 10 * 1000,
})`,
},
crashes with:
Error: Unsupported spread element
Occurred while linting file.ts:2
Rule: "@rule-tester/infinite-query-property-order"
❯ flatMap src/rules/infinite-query-property-order/infinite-query-property-order.rule.ts:91:17
89| const reorderedText = sortedProperties.reduce(
90| (sourceText, specifier, index) => {
91| let textBetweenProperties = ''
| ^
92| if (index < allProperties.length - 1) {
93| textBetweenProperties = sourceCode
Note that it starts to work if the spread looks like this:
{
name: 'should work with object spread',
code: normalizeIndent`
return useInfiniteQuery({
- ...myOptions.infiniteQueryOptions(),
+ ...infiniteQueryOptions(),
refetchInterval: 10 * 1000,
})`,
},
so it seems to be about accessing a property of an object. Just ...myOptions.infiniteQueryOptions
also fails