Skip to content

Commit

Permalink
Run npm run format
Browse files Browse the repository at this point in the history
  • Loading branch information
mthadley committed Apr 24, 2024
1 parent 7e63fe6 commit 3039739
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/rules/sort-destructure-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function shouldCheck(scope, objectPatternNode, node) {
switch (node.value.type) {
case "ObjectPattern":
return node.value.properties.every((propertyNode) =>
shouldCheck(scope, objectPatternNode, propertyNode)
shouldCheck(scope, objectPatternNode, propertyNode),
);
case "ArrayPattern":
// Fake the element as a property for simplicity
Expand All @@ -106,22 +106,22 @@ function shouldCheck(scope, objectPatternNode, node) {
shouldCheck(scope, objectPatternNode, {
type: "Property",
value: element,
})
}),
);
case "AssignmentPattern":
if (node.value.left.type === "Identifier") {
return !isReferencedByOtherProperties(
scope,
objectPatternNode,
node.value.left
node.value.left,
);
}
return true;
case "Identifier":
return !isReferencedByOtherProperties(
scope,
objectPatternNode,
node.value
node.value,
);
default:
return true;
Expand Down Expand Up @@ -169,7 +169,7 @@ function createFix({ context, fixer, node, sorter }) {
: // Otherwise, we need to grab the text after the original node.
sourceText.slice(
node.properties[i].range[1], // End index of the current node .
node.properties[i + 1].range[0] // Start index of the next node.
node.properties[i + 1].range[0], // Start index of the next node.
);

return sourceCode.getText(child) + textAfter;
Expand All @@ -181,7 +181,7 @@ function createFix({ context, fixer, node, sorter }) {
node.properties[0].range[0], // Start index of the first node.
node.properties[node.properties.length - 1].range[1], // End index of the last node.
],
newText
newText,
);
}

Expand Down Expand Up @@ -228,7 +228,7 @@ module.exports = {
*/
if (
!objectPatternNode.properties.every((node) =>
shouldCheck(scope, objectPatternNode, node)
shouldCheck(scope, objectPatternNode, node),
)
) {
return;
Expand Down

0 comments on commit 3039739

Please sign in to comment.