Skip to content

Commit

Permalink
chore(eslint-plugin-query): change naming for text variables (#8135)
Browse files Browse the repository at this point in the history
  • Loading branch information
saul-atomrigs authored Oct 7, 2024
1 parent 2fe16e5 commit 495b086
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,28 @@ export const rule = createRule({
fix(fixer) {
const sourceCode = context.sourceCode

const text = sortedProperties.reduce(
const reorderedText = sortedProperties.reduce(
(sourceText, specifier, index) => {
let text = ''
let textBetweenProperties = ''
if (index < allProperties.length - 1) {
text = sourceCode
textBetweenProperties = sourceCode
.getText()
.slice(
allProperties[index]!.range[1],
allProperties[index + 1]!.range[0],
)
}
return (
sourceText + sourceCode.getText(specifier.property) + text
sourceText +
sourceCode.getText(specifier.property) +
textBetweenProperties
)
},
'',
)
return fixer.replaceTextRange(
[allProperties[0]!.range[0], allProperties.at(-1)!.range[1]],
text,
reorderedText,
)
},
})
Expand Down

0 comments on commit 495b086

Please sign in to comment.