Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Newbie012 committed Dec 14, 2022
1 parent 594217e commit bfde964
Showing 1 changed file with 5 additions and 8 deletions.
Expand Up @@ -185,7 +185,6 @@ function runCheckOnNode(params: {
node: callNode,
messageId: 'preferObjectSyntax',
fix(fixer) {
const ruleFixes: TSESLint.RuleFix[] = []
const optionsObjectProperties: string[] = []

// queryKey
Expand Down Expand Up @@ -216,15 +215,13 @@ function runCheckOnNode(params: {
optionsObjectProperties.push(...existingObjectProperties)
}

if (callNode.callee.type === AST_NODE_TYPES.Identifier) {
const argsText = `{ ${optionsObjectProperties.join(', ')} }`

ruleFixes.push(
fixer.replaceText(callNode, `${callNode.callee.name}(${argsText})`),
)
if (callNode.callee.type !== AST_NODE_TYPES.Identifier) {
return null
}

return ruleFixes
const argsText = `{ ${optionsObjectProperties.join(', ')} }`

return fixer.replaceText(callNode, `${callNode.callee.name}(${argsText})`)
},
})
}

0 comments on commit bfde964

Please sign in to comment.